mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-16 08:29:15 +01:00
OP-1798 fixed recently converted OPHID_DEBUG taking argument
This commit is contained in:
parent
0236074de4
commit
0cab4b0016
@ -74,7 +74,7 @@ void USBMonitor::deviceEventReceived()
|
|||||||
// this->monitorNotifier->setEnabled(0);
|
// this->monitorNotifier->setEnabled(0);
|
||||||
QString action = QString(udev_device_get_action(dev));
|
QString action = QString(udev_device_get_action(dev));
|
||||||
QString devtype = QString(udev_device_get_devtype(dev));
|
QString devtype = QString(udev_device_get_devtype(dev));
|
||||||
OPHID_DEBUG("[DEBUG] Action: " << action << " device: " << devtype);
|
OPHID_DEBUG("Action: %s device: %s", qPrintable(action), qPrintable(devtype));
|
||||||
if (action == "add" && devtype == "usb_device") {
|
if (action == "add" && devtype == "usb_device") {
|
||||||
printPortInfo(dev);
|
printPortInfo(dev);
|
||||||
emit deviceDiscovered(makePortInfo(dev));
|
emit deviceDiscovered(makePortInfo(dev));
|
||||||
|
@ -121,9 +121,9 @@ QList<USBPortInfo> USBMonitor::availableDevices(int vid, int pid, int bcdDeviceM
|
|||||||
OPHID_TRACE("IN");
|
OPHID_TRACE("IN");
|
||||||
|
|
||||||
// Print the list
|
// Print the list
|
||||||
OPHID_DEBUG("List off (" << knowndevices.length() << ") devices that are tracked:");
|
OPHID_DEBUG("List off (%d) devices that are tracked:", knowndevices.length());
|
||||||
foreach(USBPortInfo info, knowndevices /*thePortsWeWant*/) {
|
foreach(USBPortInfo info, knowndevices /*thePortsWeWant*/) {
|
||||||
OPHID_DEBUG("product:" << info.product << " bcdDevice:" << info.bcdDevice << " devicePath:" << info.devicePath);
|
OPHID_DEBUG("product: %s bcdDevice: %d devicePath: %s", qPrintable(info.product), info.bcdDevice, qPrintable(info.devicePath));
|
||||||
|
|
||||||
// Filter to return only the one request (if exists)
|
// Filter to return only the one request (if exists)
|
||||||
if ((info.vendorID == vid || vid == -1) &&
|
if ((info.vendorID == vid || vid == -1) &&
|
||||||
@ -246,7 +246,7 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
|||||||
{
|
{
|
||||||
OPHID_TRACE("IN");
|
OPHID_TRACE("IN");
|
||||||
|
|
||||||
OPHID_DEBUG("[STATUS CHANGE] from device ID: " << deviceID);
|
OPHID_DEBUG("[STATUS CHANGE] from device ID: %s", qPrintable(deviceID));
|
||||||
bool rc;
|
bool rc;
|
||||||
SP_DEVINFO_DATA spDevInfoData;
|
SP_DEVINFO_DATA spDevInfoData;
|
||||||
DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : 0 /*DIGCF_ALLCLASSES*/;
|
DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : 0 /*DIGCF_ALLCLASSES*/;
|
||||||
@ -260,9 +260,9 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
|||||||
DWORD nSize = 0;
|
DWORD nSize = 0;
|
||||||
TCHAR buf[MAX_PATH];
|
TCHAR buf[MAX_PATH];
|
||||||
rc = SetupDiGetDeviceInstanceId(devInfo, &spDevInfoData, buf, MAX_PATH, &nSize);
|
rc = SetupDiGetDeviceInstanceId(devInfo, &spDevInfoData, buf, MAX_PATH, &nSize);
|
||||||
OPHID_DEBUG("Found:" << TCHARToQString(buf));
|
OPHID_DEBUG("Found: %s", qPrintable(TCHARToQString(buf)));
|
||||||
if (rc && deviceID.contains(TCHARToQString(buf))) {
|
if (rc && deviceID.contains(TCHARToQString(buf))) {
|
||||||
OPHID_DEBUG("[MATCH] " << TCHARToQString(buf));
|
OPHID_DEBUG("[MATCH] %s", qPrintable(TCHARToQString(buf)));
|
||||||
USBPortInfo info;
|
USBPortInfo info;
|
||||||
info.devicePath = deviceID;
|
info.devicePath = deviceID;
|
||||||
if (wParam == DBT_DEVICEARRIVAL) {
|
if (wParam == DBT_DEVICEARRIVAL) {
|
||||||
@ -287,14 +287,14 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
knowndevices.append(info);
|
knowndevices.append(info);
|
||||||
OPHID_DEBUG("[SIGNAL] Device discovered on device:" << info.product << info.bcdDevice);
|
OPHID_DEBUG("[SIGNAL] Device discovered on device: %s %d", qPrintable(info.product), info.bcdDevice);
|
||||||
emit deviceDiscovered(info);
|
emit deviceDiscovered(info);
|
||||||
break;
|
break;
|
||||||
} else if (wParam == DBT_DEVICEREMOVECOMPLETE) {
|
} else if (wParam == DBT_DEVICEREMOVECOMPLETE) {
|
||||||
for (int x = 0; x < knowndevices.count(); ++x) {
|
for (int x = 0; x < knowndevices.count(); ++x) {
|
||||||
USBPortInfo temp = knowndevices.at(x);
|
USBPortInfo temp = knowndevices.at(x);
|
||||||
knowndevices.removeAt(x);
|
knowndevices.removeAt(x);
|
||||||
OPHID_DEBUG("[SIGNAL] Device removed on device:" << temp.product << temp.bcdDevice);
|
OPHID_DEBUG("[SIGNAL] Device removed on device: %s %d", qPrintable(temp.product), temp.bcdDevice);
|
||||||
}
|
}
|
||||||
emit deviceRemoved(info);
|
emit deviceRemoved(info);
|
||||||
break;
|
break;
|
||||||
@ -355,7 +355,7 @@ void USBMonitor::enumerateDevicesWin(const GUID & guid)
|
|||||||
}
|
}
|
||||||
SetupDiDestroyDeviceInfoList(devInfo);
|
SetupDiDestroyDeviceInfoList(devInfo);
|
||||||
}
|
}
|
||||||
OPHID_DEBUG("Added %d device(s).", j);
|
OPHID_DEBUG("Added %lu device(s).", j);
|
||||||
OPHID_TRACE("OUT");
|
OPHID_TRACE("OUT");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +422,7 @@ int USBMonitor::infoFromHandle(const GUID & guid, USBPortInfo & info, HDEVINFO &
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
OPHID_DEBUG("Found device with valid PATH: " << qDevicePath);
|
OPHID_DEBUG("Found device with valid PATH: %s", qPrintable(qDevicePath));
|
||||||
h = CreateFile(details->DevicePath,
|
h = CreateFile(details->DevicePath,
|
||||||
GENERIC_READ | GENERIC_WRITE,
|
GENERIC_READ | GENERIC_WRITE,
|
||||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
@ -442,7 +442,7 @@ int USBMonitor::infoFromHandle(const GUID & guid, USBPortInfo & info, HDEVINFO &
|
|||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
|
||||||
OPHID_DEBUG("Problem opening handle, path: " << QString().fromWCharArray(details->DevicePath));
|
OPHID_DEBUG("Problem opening handle, path: %s", qPrintable(QString::fromWCharArray(details->DevicePath)));
|
||||||
|
|
||||||
free(details);
|
free(details);
|
||||||
ret = OPHID_ERROR_RET;
|
ret = OPHID_ERROR_RET;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user