| 75 | } |
| 76 | |
| 77 | void UsbSonyEventThreadFunc(void* arg) |
| 78 | { |
| 79 | do |
| 80 | { |
| 81 | if (R_SUCCEEDED(eventWait(&g_usbSonyEvent, UINT64_MAX))) |
| 82 | { |
| 83 | WriteToLog("Sony event went off"); |
| 84 | |
| 85 | SwitchUtils::ScopedLock usbLock(usbMutex); |
| 86 | if (!controllers::IsAtControllerLimit()) |
| 87 | { |
| 88 | s32 total_entries; |
| 89 | if ((QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK3) != 0) && (total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0) |
| 90 | WriteToLog("Initializing Dualshock 3 controller: 0x%x", controllers::Insert(std::make_unique<Dualshock3Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)))); |
| 91 | |
| 92 | else if ((QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK4_1X) != 0 || QueryVendorProduct(VENDOR_SONY, PRODUCT_DUALSHOCK4_2X) != 0) && (total_entries = QueryInterfaces(USB_CLASS_HID, 0, 0)) != 0) |
| 93 | WriteToLog("Initializing Dualshock 4 controller: 0x%x", controllers::Insert(std::make_unique<Dualshock4Controller>(std::make_unique<SwitchUSBDevice>(interfaces, total_entries)))); |
| 94 | } |
| 95 | } |
| 96 | } while (is_usb_event_thread_running); |
| 97 | } |
| 98 | |
| 99 | void UsbInterfaceChangeThreadFunc(void* arg) |
| 100 | { |
nothing calls this directly
no test coverage detected