mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 14:24:54 +00:00
LibusbDevice: Send wakeup command to Santroller devices
This commit is contained in:
parent
afee9a56e9
commit
8bb07bf3c4
2 changed files with 28 additions and 0 deletions
|
@ -150,6 +150,10 @@ bool USBScanner::AddNewDevices(DeviceMap* new_devices) const
|
|||
const int ret = m_context.GetDeviceList([&](libusb_device* device) {
|
||||
libusb_device_descriptor descriptor;
|
||||
libusb_get_device_descriptor(device, &descriptor);
|
||||
if (descriptor.idVendor == 0x1209 && descriptor.idProduct == 0x2882)
|
||||
{
|
||||
WakeupSantrollerDevice(device);
|
||||
}
|
||||
if (!whitelist.contains({descriptor.idVendor, descriptor.idProduct}))
|
||||
return true;
|
||||
|
||||
|
@ -179,6 +183,29 @@ void USBScanner::AddEmulatedDevices(DeviceMap* new_devices)
|
|||
}
|
||||
}
|
||||
|
||||
void USBScanner::WakeupSantrollerDevice(libusb_device* device)
|
||||
{
|
||||
#ifdef __LIBUSB__
|
||||
// Santroller devices emulate various instruments for multiple consoles.
|
||||
// On an actual console, santroller detects the console based on how it communicates
|
||||
// with usb devices. Since the underlying operating system is doing that here, the
|
||||
// check doesn't work, so we need to send a special command to make the device
|
||||
// jump to wii emulation mode.
|
||||
libusb_device_handle* lusb_handle;
|
||||
if (libusb_open(device, &lusb_handle) == LIBUSB_SUCCESS)
|
||||
{
|
||||
#ifdef __linux__
|
||||
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, 0x11, 5000);
|
||||
libusb_close(lusb_handle);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void USBScanner::AddDevice(std::unique_ptr<USB::Device> device, DeviceMap* new_devices)
|
||||
{
|
||||
(*new_devices)[device->GetId()] = std::move(device);
|
||||
|
|
|
@ -41,6 +41,7 @@ private:
|
|||
|
||||
bool UpdateDevices();
|
||||
bool AddNewDevices(DeviceMap* new_devices) const;
|
||||
static void WakeupSantrollerDevice(libusb_device* device);
|
||||
static void AddEmulatedDevices(DeviceMap* new_devices);
|
||||
static void AddDevice(std::unique_ptr<USB::Device> device, DeviceMap* new_devices);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue