LorrisProgrammer::LorrisProgrammer() : WorkTab(), m_logsink(this) { m_connectButton = NULL; ui = NULL; m_chipStopped = false; m_overvcc_dialog = NULL; m_overvcc = 0.0; m_enable_overvcc = false; m_overvcc_turnoff = false; lastVccIndex = 0; m_progress_dialog = NULL; m_state = 0; m_buttons_enabled = false; m_mode_act_signalmap = new QSignalMapper(this); connect(m_mode_act_signalmap, SIGNAL(mapped(int)), SLOT(modeSelected(int))); m_prog_speed_hz = sConfig.get(CFG_QUINT32_SHUPITO_PRG_SPEED); if(m_prog_speed_hz < 1) m_prog_speed_hz = 2000000; initMenus(); setUiType(UI_FULL); m_timeout_timer.setInterval(TIMEOUT_INTERVAL); connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), SLOT(focusChanged(QWidget*,QWidget*))); connect(&m_timeout_timer, SIGNAL(timeout()), SLOT(timeout())); connectedStatus(false); }
void unixUsbDriver::usbSendControl(uint8_t RequestType, uint8_t Request, uint16_t Value, uint16_t Index, uint16_t Length, unsigned char *LDATA){ //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; } else controlBuffer = LDATA; int error = libusb_control_transfer(handle, RequestType, Request, Value, Index, controlBuffer, Length, 4000); if(error<0){ qDebug() << "Error number:" << error; qDebug("unixUsbDriver::usbSendControl FAILED with error %s", libusb_error_name(error)); } //else qDebug() << "unixUsbDriver::usbSendControl SUCCESS"; if((error == LIBUSB_ERROR_NO_DEVICE) && (Request!=0xa7)){ //Bootloader Jump won't return; this is expected behaviour. qDebug() << "Device not found. Becoming an hero."; connectedStatus(false); killMe(); } return; }