diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c index 11e7f574ce..c42c708ba5 100644 --- a/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -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); }