USB: If a Santroller device is in use elsewhere, don't send it commands (#15655)

This commit is contained in:
Sanjay Govind 2024-06-04 11:17:33 +12:00 committed by GitHub
parent 64127b5c1b
commit d9ec33f51e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -308,13 +308,19 @@ usb_handler_thread::usb_handler_thread()
sys_usbd.success("Found device: Santroller");
// Send the device a specific control transfer so that it jumps to a RPCS3 compatible mode
libusb_device_handle* lusb_handle;
libusb_open(list[index], &lusb_handle);
if (libusb_open(list[index], &lusb_handle) == LIBUSB_SUCCESS)
{
#ifdef __linux__
libusb_set_auto_detach_kernel_driver(lusb_handle, true);
libusb_claim_interface(lusb_handle, 2);
libusb_set_auto_detach_kernel_driver(lusb_handle, true);
libusb_claim_interface(lusb_handle, 2);
#endif
libusb_control_transfer(lusb_handle, +LIBUSB_ENDPOINT_IN | +LIBUSB_REQUEST_TYPE_CLASS | +LIBUSB_RECIPIENT_INTERFACE, 0x01, 0x03f2, 2, nullptr, 0, 5000);
libusb_close(lusb_handle);
libusb_control_transfer(lusb_handle, +LIBUSB_ENDPOINT_IN | +LIBUSB_REQUEST_TYPE_CLASS | +LIBUSB_RECIPIENT_INTERFACE, 0x01, 0x03f2, 2, nullptr, 0, 5000);
libusb_close(lusb_handle);
}
else
{
sys_usbd.error("Unable to open Santroller device, make sure Santroller isn't open in the background.");
}
}
// Top Shot Elite controllers