mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-23 18:53:08 +08:00
Fix the 8BitDo Ultimate 2D Wireless Controller showing up multiple times
This controller has 3 interfaces, one for the Xbox gamepad protocol, and two HID interfaces. We should only handle the Xbox interface in the Xbox driver.
This commit is contained in:
@@ -357,6 +357,10 @@ static bool HIDAPI_DriverXboxOne_IsEnabled(void)
|
||||
|
||||
static bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||
{
|
||||
static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF;
|
||||
static const int XBONE_IFACE_SUBCLASS = 71;
|
||||
static const int XBONE_IFACE_PROTOCOL = 208;
|
||||
|
||||
#if defined(SDL_PLATFORM_MACOS) && defined(SDL_JOYSTICK_MFI)
|
||||
if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
|
||||
// On macOS we get a shortened version of the real report and
|
||||
@@ -365,6 +369,13 @@ static bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, co
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
if (interface_class &&
|
||||
(interface_class != LIBUSB_CLASS_VENDOR_SPEC ||
|
||||
interface_subclass != XBONE_IFACE_SUBCLASS ||
|
||||
interface_protocol != XBONE_IFACE_PROTOCOL)) {
|
||||
// This isn't the Xbox gamepad interface
|
||||
return false;
|
||||
}
|
||||
return (type == SDL_GAMEPAD_TYPE_XBOXONE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user