mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
GCS USB: Get rid of some unnecessary code
This commit is contained in:
parent
cf1c986550
commit
44d271ac79
@ -300,29 +300,18 @@ RawHID::RawHID(const QString &deviceName)
|
||||
m_mutex(NULL)
|
||||
{
|
||||
|
||||
m_mutex = new QMutex(QMutex::Recursive);
|
||||
m_mutex = new QMutex(QMutex::Recursive);
|
||||
|
||||
// detect if the USB device is unplugged
|
||||
QObject::connect(&dev, SIGNAL(deviceUnplugged(int)), this, SLOT(onDeviceUnplugged(int)));
|
||||
// detect if the USB device is unplugged
|
||||
QObject::connect(&dev, SIGNAL(deviceUnplugged(int)), this, SLOT(onDeviceUnplugged(int)));
|
||||
|
||||
int opened = dev.open(USB_MAX_DEVICES, USBMonitor::idVendor_OpenPilot, -1, USB_USAGE_PAGE, USB_USAGE);
|
||||
for (int i =0; i< opened; i++) {
|
||||
if (deviceName == dev.getserial(i))
|
||||
m_deviceNo = i;
|
||||
else
|
||||
dev.close(i);
|
||||
}
|
||||
|
||||
/*
|
||||
// TODO: NOT WORKING FOR MULTIPLE DEVICES with the same PID!
|
||||
QList<USBPortInfo> devices = USBMonitor::instance()->availableDevices(USBMonitor::idVendor_OpenPilot,-1,-1,USBMonitor::Running);
|
||||
foreach( USBPortInfo device, devices) {
|
||||
if (deviceName == device.serialNumber) {
|
||||
opened = dev.open(1,device.vendorID, device.productID,USB_USAGE_PAGE,USB_USAGE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
int opened = dev.open(USB_MAX_DEVICES, USBMonitor::idVendor_OpenPilot, -1, USB_USAGE_PAGE, USB_USAGE);
|
||||
for (int i =0; i< opened; i++) {
|
||||
if (deviceName == dev.getserial(i))
|
||||
m_deviceNo = i;
|
||||
else
|
||||
dev.close(i);
|
||||
}
|
||||
|
||||
//didn't find the device we are trying to open (shouldnt happen)
|
||||
if (opened < 0)
|
||||
@ -369,14 +358,10 @@ bool RawHID::open(OpenMode mode)
|
||||
|
||||
QIODevice::open(mode);
|
||||
|
||||
if (!m_readThread)
|
||||
m_readThread = new RawHIDReadThread(this);
|
||||
|
||||
if (!m_writeThread)
|
||||
m_writeThread = new RawHIDWriteThread(this);
|
||||
|
||||
if (m_readThread) m_readThread->start(); // Pip
|
||||
if (m_writeThread) m_writeThread->start(); // Pip
|
||||
Q_ASSERT(m_readThread);
|
||||
Q_ASSERT(m_writeThread);
|
||||
if (m_readThread) m_readThread->start();
|
||||
if (m_writeThread) m_writeThread->start();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user