#if defined(USB_CONTROLLER) #include "usbcontroller.h" #ifdef Q_OS_WIN #pragma comment (lib, "Setupapi.lib") #endif #include #include "logcategories.h" usbController::usbController() { // As this is run in it's own thread, don't do anything important in the constructor. qInfo(logUsbControl()) << "Starting usbController()"; loadCommands(); loadButtons(); loadKnobs(); // This is a the "master" list of supported devices. Maybe move to settings at some point? knownDevices.append(USBTYPE(shuttleXpress,0x0b33,0x0020,0x0000,0x0000,15,2,5,0)); knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0030,0x0000,0x0000,15,2,5,0)); knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0011,0x0000,0x0000,15,2,5,0)); // Actually a ShuttlePro but hopefully will work? knownDevices.append(USBTYPE(RC28,0x0c26,0x001e,0x0000,0x0000,3,1,64,0)); knownDevices.append(USBTYPE(eCoderPlus, 0x1fc9, 0x0003,0x0000,0x0000,16,4,32,0)); knownDevices.append(USBTYPE(QuickKeys, 0x28bd, 0x5202,0x0001,0xff0a,10,1,32,0)); knownDevices.append(USBTYPE(StreamDeckMini, 0x0fd9, 0x0063, 0x0000, 0x0000,6,0,1024,80)); knownDevices.append(USBTYPE(StreamDeckMiniV2, 0x0fd9, 0x0090, 0x0000, 0x0000,6,0,1024,80)); knownDevices.append(USBTYPE(StreamDeckOriginal, 0x0fd9, 0x0060, 0x0000, 0x0000,15,0,8191,72)); knownDevices.append(USBTYPE(StreamDeckOriginalV2, 0x0fd9, 0x006d, 0x0000, 0x0000,15,0,1024,72)); knownDevices.append(USBTYPE(StreamDeckOriginalMK2, 0x0fd9, 0x0080, 0x0000, 0x0000,15,0,1024,72)); knownDevices.append(USBTYPE(StreamDeckXL, 0x0fd9, 0x006c, 0x0000, 0x0000,32,0,1024,96)); knownDevices.append(USBTYPE(StreamDeckXLV2, 0x0fd9, 0x008f, 0x0000, 0x0000,32,0,1024,96)); knownDevices.append(USBTYPE(StreamDeckPedal, 0x0fd9, 0x0086, 0x0000, 0x0000,3,0,1024,0)); knownDevices.append(USBTYPE(StreamDeckPlus, 0x0fd9, 0x0084, 0x0000, 0x0000,12,4,1024,120)); } usbController::~usbController() { qInfo(logUsbControl) << "Ending usbController()"; for (USBDEVICE &dev: usbDevices) { if (dev.handle) { sendRequest(&dev,usbFeatureType::featureOverlay,60,"Goodbye from wfview"); if (dev.type.model == RC28) { ledControl(false, 3); } emit removeDevice(&dev); hid_close(dev.handle); } } hid_exit(); #if (QT_VERSION < QT_VERSION_CHECK(6,0,0)) if (gamepad != Q_NULLPTR) { delete gamepad; gamepad = Q_NULLPTR; } #endif } void usbController::init(QMutex* mut,usbMap* prefs ,QVector