#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? // usbDeviceType, manufacturer, product, usage, usagePage, buttons, columns, knobs, leds, maxPayload, iconSize knownDevices.append(USBTYPE(shuttleXpress,0x0b33,0x0020,0x0000,0x0000,15,0,2,0,5,0)); knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0030,0x0000,0x0000,15,0,2,0,5,0)); knownDevices.append(USBTYPE(shuttlePro2,0x0b33,0x0011,0x0000,0x0000,15,0,2,0,5,0)); // Actually a ShuttlePro but hopefully will work? knownDevices.append(USBTYPE(RC28,0x0c26,0x001e,0x0000,0x0000,3,0,1,3,64,0)); knownDevices.append(USBTYPE(eCoderPlus, 0x1fc9, 0x0003,0x0000,0x0000,22,0,4,0,32,0)); // Actually 20 but some bit0 and bit15 aren't used knownDevices.append(USBTYPE(QuickKeys, 0x28bd, 0x5202,0x0001,0xff0a,10,0,1,0,32,0)); knownDevices.append(USBTYPE(StreamDeckMini, 0x0fd9, 0x0063, 0x0000, 0x0000,6,0,0,0,1024,80)); knownDevices.append(USBTYPE(StreamDeckMiniV2, 0x0fd9, 0x0090, 0x0000, 0x0000,6,0,0,0,1024,80)); knownDevices.append(USBTYPE(StreamDeckOriginal, 0x0fd9, 0x0060, 0x0000, 0x0000,15,5,0,0,8191,72)); knownDevices.append(USBTYPE(StreamDeckOriginalV2, 0x0fd9, 0x006d, 0x0000, 0x0000,15,5,0,0,1024,72)); knownDevices.append(USBTYPE(StreamDeckOriginalMK2, 0x0fd9, 0x0080, 0x0000, 0x0000,15,5,0,0,1024,72)); knownDevices.append(USBTYPE(StreamDeckXL, 0x0fd9, 0x006c, 0x0000, 0x0000,32,8,0,0,1024,96)); knownDevices.append(USBTYPE(StreamDeckXLV2, 0x0fd9, 0x008f, 0x0000, 0x0000,32,8,0,0,1024,96)); knownDevices.append(USBTYPE(StreamDeckPedal, 0x0fd9, 0x0086, 0x0000, 0x0000,3,0,0,0,1024,0)); knownDevices.append(USBTYPE(StreamDeckPlus, 0x0fd9, 0x0084, 0x0000, 0x0000,12,0,4,0,1024,120)); knownDevices.append(USBTYPE(XKeysXK3, 0x05f3, 0x04c5, 0x0001, 0x000c,3,0,0,2,32,0)); // So-called "splat" interface? } usbController::~usbController() { qInfo(logUsbControl) << "Ending usbController()"; auto devIt = devices->begin(); while (devIt != devices->end()) { auto dev = &devIt.value(); if (dev->handle) { sendRequest(dev,usbFeatureType::featureOverlay,60,"Goodbye from wfview"); if (dev->type.model == RC28) { sendRequest(dev,usbFeatureType::featureLEDControl,4,"0"); } hid_close(dev->handle); dev->handle = NULL; dev->connected = false; dev->detected = false; dev->uiCreated = false; devicesConnected--; } ++devIt; } 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,usbDevMap* devs ,QVector