mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +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(NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_mutex = new QMutex(QMutex::Recursive);
|
m_mutex = new QMutex(QMutex::Recursive);
|
||||||
|
|
||||||
// detect if the USB device is unplugged
|
// detect if the USB device is unplugged
|
||||||
QObject::connect(&dev, SIGNAL(deviceUnplugged(int)), this, SLOT(onDeviceUnplugged(int)));
|
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);
|
int opened = dev.open(USB_MAX_DEVICES, USBMonitor::idVendor_OpenPilot, -1, USB_USAGE_PAGE, USB_USAGE);
|
||||||
for (int i =0; i< opened; i++) {
|
for (int i =0; i< opened; i++) {
|
||||||
if (deviceName == dev.getserial(i))
|
if (deviceName == dev.getserial(i))
|
||||||
m_deviceNo = i;
|
m_deviceNo = i;
|
||||||
else
|
else
|
||||||
dev.close(i);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//didn't find the device we are trying to open (shouldnt happen)
|
//didn't find the device we are trying to open (shouldnt happen)
|
||||||
if (opened < 0)
|
if (opened < 0)
|
||||||
@ -369,14 +358,10 @@ bool RawHID::open(OpenMode mode)
|
|||||||
|
|
||||||
QIODevice::open(mode);
|
QIODevice::open(mode);
|
||||||
|
|
||||||
if (!m_readThread)
|
Q_ASSERT(m_readThread);
|
||||||
m_readThread = new RawHIDReadThread(this);
|
Q_ASSERT(m_writeThread);
|
||||||
|
if (m_readThread) m_readThread->start();
|
||||||
if (!m_writeThread)
|
if (m_writeThread) m_writeThread->start();
|
||||||
m_writeThread = new RawHIDWriteThread(this);
|
|
||||||
|
|
||||||
if (m_readThread) m_readThread->start(); // Pip
|
|
||||||
if (m_writeThread) m_writeThread->start(); // Pip
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user