Fixed connect - Windows + Unix now both return 0 on UsbInit

Seems to do nothing once the iso is set up, though...
This commit is contained in:
EspoTek 2017-02-19 14:29:19 +11:00
parent a1c45aff30
commit 2fef7a6648
14 changed files with 26099 additions and 362 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
#Last build type
#Sun, 19 Feb 2017 14:04:04 +1100
#Sun, 19 Feb 2017 14:25:15 +1100
build.last.target=debug

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,5 @@
#include "genericusbdriver.h"
#include "platformspecific.h"
genericUsbDriver::genericUsbDriver(QWidget *parent) : QLabel(parent)
{
@ -275,6 +276,7 @@ void genericUsbDriver::setGain(double newGain){
void genericUsbDriver::avrDebug(void){
usbSendControl(0xc0, 0xa0, 0, 0, sizeof(unified_debug), NULL);
#ifndef PLATFORM_ANDROID
unified_debug *udsPtr = (unified_debug *) inBuffer;
uint16_t trfcnt0 = (udsPtr->trfcntH0 << 8) + udsPtr->trfcntL0;
uint16_t trfcnt1 = (udsPtr->trfcntH1 << 8) + udsPtr->trfcntL1;
@ -297,8 +299,7 @@ void genericUsbDriver::avrDebug(void){
qDebug() << "CALB = " << udsPtr->CALB;
qDebug() << "dma_ch0_cnt = " << dma_ch0_cnt;
qDebug() << "dma_ch1_cnt = " << dma_ch1_cnt;
#endif
}
void genericUsbDriver::saveState(int *_out_deviceMode, double *_out_scopeGain, double *_out_currentPsuVoltage, int *_out_digitalPinState){
@ -313,7 +314,7 @@ void genericUsbDriver::checkConnection(){
//This will connect to the board, then wait one more period before actually starting the stack.
if(!connected){
qDebug() << "CHECKING CONNECTION!";
connected = usbInit(0x03eb, 0xa000);
connected = !(usbInit(0x03eb, 0xa000));
return;
}

View File

@ -52,6 +52,11 @@ void unixUsbDriver::usbSendControl(uint8_t RequestType, uint8_t Request, uint16_
//qDebug("Sending Control packet! 0x%x,\t0x%x,\t%u,\t%u,\t%d,\t%u", RequestType, Request, Value, Index, LDATA, Length);
unsigned char *controlBuffer;
if(!connected){
qDebug() << "Control packet requested before device has connected!";
return;
}
if (LDATA==NULL){
controlBuffer = inBuffer;
}

Binary file not shown.

View File

@ -41,7 +41,7 @@ unsigned char winUsbDriver::usbInit(unsigned long VIDin, unsigned long PIDin){
//List libusbk devices connected
if (!LstK_Init(&deviceList, (KLST_FLAG) 0)) {
qDebug("Error initializing device list");
return 0;
return 1;
} //else qDebug() << "Device List initialised!";
/*
@ -58,7 +58,7 @@ unsigned char winUsbDriver::usbInit(unsigned long VIDin, unsigned long PIDin){
LstK_Free(deviceList);
if (deviceInfo == NULL){
qDebug("Could not find device VID = %04X, PID = %04X", VIDin, PIDin);
return 0;
return 2;
}
//Open Labrador!!
@ -66,9 +66,10 @@ unsigned char winUsbDriver::usbInit(unsigned long VIDin, unsigned long PIDin){
if (!success){
ec = GetLastError();
qDebug("UsbK_Init failed. ErrorCode: %08Xh", ec);
return 3;
} else qDebug("Device opened successfully!");
return success;
return 0;
}
void winUsbDriver::usbSendControl(uint8_t RequestType, uint8_t Request, uint16_t Value, uint16_t Index, uint16_t Length, unsigned char *LDATA){