mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
OP-1798 replaced qDebug() with OPHID_DEBUG()
This commit is contained in:
parent
b11bec1b5b
commit
a1a225f592
@ -27,7 +27,8 @@
|
||||
|
||||
#ifndef OPHID_CONST_H
|
||||
#define OPHID_CONST_H
|
||||
#include "QtDebug"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
// #define OPHID_DEBUG_ON 1
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <QDebug>
|
||||
#include <QString>
|
||||
#include <QMutex>
|
||||
#include "../hidapi/hidapi.h"
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "ophid_hidapi.h"
|
||||
#include "ophid_const.h"
|
||||
|
||||
|
||||
/**
|
||||
* \brief Constructor
|
||||
*
|
||||
@ -95,7 +94,7 @@ void RawHIDConnection::onDeviceConnected()
|
||||
*/
|
||||
void RawHIDConnection::onDeviceDisconnected()
|
||||
{
|
||||
// qDebug() << "onDeviceDisconnected()";
|
||||
OPHID_DEBUG("onDeviceDisconnected()");
|
||||
if (enablePolling) {
|
||||
emit availableDevChanged(this);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
*/
|
||||
|
||||
#include "ophid_usbmon.h"
|
||||
#include <QDebug>
|
||||
#include "ophid_const.h"
|
||||
|
||||
|
||||
@ -75,7 +74,7 @@ void USBMonitor::deviceEventReceived()
|
||||
// this->monitorNotifier->setEnabled(0);
|
||||
QString action = QString(udev_device_get_action(dev));
|
||||
QString devtype = QString(udev_device_get_devtype(dev));
|
||||
// qDebug() << "[DEBUG] Action: " << action << " device: " << devtype;
|
||||
OPHID_DEBUG("[DEBUG] Action: " << action << " device: " << devtype);
|
||||
if (action == "add" && devtype == "usb_device") {
|
||||
printPortInfo(dev);
|
||||
emit deviceDiscovered(makePortInfo(dev));
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include <CoreFoundation/CFString.h>
|
||||
#include <CoreFoundation/CFArray.h>
|
||||
#include <QMutexLocker>
|
||||
#include <QDebug>
|
||||
#include "ophid_const.h"
|
||||
|
||||
// Local helper functions
|
||||
@ -72,7 +71,7 @@ USBMonitor::~USBMonitor()
|
||||
*/
|
||||
void USBMonitor::deviceEventReceived()
|
||||
{
|
||||
// qDebug() << "Device event";
|
||||
OPHID_DEBUG("Device event");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,7 +118,7 @@ void USBMonitor::detach_callback(void *context, IOReturn r, void *hid_mgr, IOHID
|
||||
Q_UNUSED(r);
|
||||
Q_UNUSED(hid_mgr);
|
||||
|
||||
// qDebug() << "USBMonitor: Device detached event";
|
||||
OPHID_DEBUG("USBMonitor: Device detached event");
|
||||
instance()->removeDevice(dev);
|
||||
}
|
||||
|
||||
@ -156,7 +155,7 @@ void USBMonitor::attach_callback(void *context, IOReturn r, void *hid_mgr, IOHID
|
||||
|
||||
deviceInfo.dev_handle = dev;
|
||||
|
||||
// qDebug() << "USBMonitor: Device attached event";
|
||||
OPHID_DEBUG("USBMonitor: Device attached event");
|
||||
|
||||
// Populate the device info structure
|
||||
got_properties &= HID_GetIntProperty(dev, CFSTR(kIOHIDVendorIDKey), &deviceInfo.vendorID);
|
||||
@ -171,7 +170,7 @@ void USBMonitor::attach_callback(void *context, IOReturn r, void *hid_mgr, IOHID
|
||||
|
||||
// Currently only enumerating objects that have the complete list of properties
|
||||
if (got_properties) {
|
||||
// qDebug() << "USBMonitor: Adding device";
|
||||
OPHID_DEBUG("USBMonitor: Adding device");
|
||||
instance()->addDevice(deviceInfo);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <QEventLoop>
|
||||
#include <QTimer>
|
||||
#include "ophid_usbmon.h"
|
||||
#include <QDebug>
|
||||
#include "ophid_const.h"
|
||||
|
||||
/* Gordon Schumacher's macros for TCHAR -> QString conversions and vice versa */
|
||||
@ -122,9 +121,9 @@ QList<USBPortInfo> USBMonitor::availableDevices(int vid, int pid, int bcdDeviceM
|
||||
OPHID_TRACE("IN");
|
||||
|
||||
// Print the list
|
||||
// qDebug() << "List off (" << knowndevices.length() << ") devices that are tracked:";
|
||||
OPHID_DEBUG("List off (" << knowndevices.length() << ") devices that are tracked:");
|
||||
foreach(USBPortInfo info, knowndevices /*thePortsWeWant*/) {
|
||||
// qDebug() << "product:" << info.product << " bcdDevice:" << info.bcdDevice << " devicePath:" << info.devicePath;
|
||||
OPHID_DEBUG("product:" << info.product << " bcdDevice:" << info.bcdDevice << " devicePath:" << info.devicePath);
|
||||
|
||||
// Filter to return only the one request (if exists)
|
||||
if ((info.vendorID == vid || vid == -1) &&
|
||||
@ -247,7 +246,7 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
||||
{
|
||||
OPHID_TRACE("IN");
|
||||
|
||||
// qDebug() << "[STATUS CHANGE] from device ID: " << deviceID;
|
||||
OPHID_DEBUG("[STATUS CHANGE] from device ID: " << deviceID);
|
||||
bool rc;
|
||||
SP_DEVINFO_DATA spDevInfoData;
|
||||
DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : 0 /*DIGCF_ALLCLASSES*/;
|
||||
@ -261,13 +260,13 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
||||
DWORD nSize = 0;
|
||||
TCHAR buf[MAX_PATH];
|
||||
rc = SetupDiGetDeviceInstanceId(devInfo, &spDevInfoData, buf, MAX_PATH, &nSize);
|
||||
// qDebug() << "Found:" << TCHARToQString(buf);
|
||||
OPHID_DEBUG("Found:" << TCHARToQString(buf));
|
||||
if (rc && deviceID.contains(TCHARToQString(buf))) {
|
||||
// qDebug() << "[MATCH] " << TCHARToQString(buf);
|
||||
OPHID_DEBUG("[MATCH] " << TCHARToQString(buf));
|
||||
USBPortInfo info;
|
||||
info.devicePath = deviceID;
|
||||
if (wParam == DBT_DEVICEARRIVAL) {
|
||||
// qDebug() << "[INSERTED]";
|
||||
OPHID_DEBUG("[INSERTED]");
|
||||
if (infoFromHandle(guid, info, devInfo, i) != OPHID_NO_ERROR) {
|
||||
OPHID_ERROR("Not found");
|
||||
break;
|
||||
@ -288,14 +287,14 @@ bool USBMonitor::matchAndDispatchChangedDevice(const QString & deviceID, const G
|
||||
break;
|
||||
}
|
||||
knowndevices.append(info);
|
||||
// qDebug() << "[SIGNAL] Device discovered on device:" << info.product << info.bcdDevice;
|
||||
OPHID_DEBUG("[SIGNAL] Device discovered on device:" << info.product << info.bcdDevice);
|
||||
emit deviceDiscovered(info);
|
||||
break;
|
||||
} else if (wParam == DBT_DEVICEREMOVECOMPLETE) {
|
||||
for (int x = 0; x < knowndevices.count(); ++x) {
|
||||
USBPortInfo temp = knowndevices.at(x);
|
||||
knowndevices.removeAt(x);
|
||||
// qDebug() << "[SIGNAL] Device removed on device:" << temp.product << temp.bcdDevice;
|
||||
OPHID_DEBUG("[SIGNAL] Device removed on device:" << temp.product << temp.bcdDevice);
|
||||
}
|
||||
emit deviceRemoved(info);
|
||||
break;
|
||||
@ -423,7 +422,7 @@ int USBMonitor::infoFromHandle(const GUID & guid, USBPortInfo & info, HDEVINFO &
|
||||
goto leave;
|
||||
}
|
||||
|
||||
// qDebug() << "Found device with valid PATH: " << qDevicePath;
|
||||
OPHID_DEBUG("Found device with valid PATH: " << qDevicePath);
|
||||
h = CreateFile(details->DevicePath,
|
||||
GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
@ -443,7 +442,7 @@ int USBMonitor::infoFromHandle(const GUID & guid, USBPortInfo & info, HDEVINFO &
|
||||
goto leave;
|
||||
}
|
||||
|
||||
// qDebug() << "Problem opening handle, path: " << QString().fromWCharArray(details->DevicePath);
|
||||
OPHID_DEBUG("Problem opening handle, path: " << QString().fromWCharArray(details->DevicePath));
|
||||
|
||||
free(details);
|
||||
ret = OPHID_ERROR_RET;
|
||||
|
@ -26,8 +26,7 @@
|
||||
*/
|
||||
|
||||
#include "ophid_usbsignal.h"
|
||||
#include <QDebug>
|
||||
|
||||
#include "ophid_const.h"
|
||||
|
||||
/**
|
||||
* \brief trigger device discovered signal
|
||||
@ -42,7 +41,7 @@ void USBSignalFilter::m_deviceDiscovered(USBPortInfo port)
|
||||
(port.productID == m_pid || m_pid == -1) &&
|
||||
((port.bcdDevice >> 8) == m_boardModel || m_boardModel == -1) &&
|
||||
((port.bcdDevice & 0x00ff) == m_runState || m_runState == -1)) {
|
||||
// qDebug() << "USBSignalFilter emit device discovered";
|
||||
OPHID_DEBUG("USBSignalFilter emit device discovered");
|
||||
emit deviceDiscovered();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user