MCPcopy Create free account
hub / github.com/cathery/sys-con / UsbSonyEventThreadFunc

Function UsbSonyEventThreadFunc

source/Sysmodule/source/usb_module.cpp:77–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 5

WriteToLogFunction · 0.85
IsAtControllerLimitFunction · 0.85
QueryVendorProductFunction · 0.85
QueryInterfacesFunction · 0.85
InsertFunction · 0.85

Tested by

no test coverage detected