diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index a9ad61a45..9aaf4c31a 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -902,7 +902,8 @@ HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id, SDL_HIDAPI_Devi } /* If we're looking for the raw input Xbox One controller, match it against any other Xbox One controller */ - if (product_id == 0x02ff && + if (vendor_id == USB_VENDOR_MICROSOFT && + product_id == USB_PRODUCT_XBOX_ONE_RAW_INPUT_CONTROLLER && SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol) == SDL_CONTROLLER_TYPE_XBOXONE) { return SDL_TRUE; } diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h index 3b37a77af..32e736234 100644 --- a/src/joystick/usb_ids.h +++ b/src/joystick/usb_ids.h @@ -52,6 +52,7 @@ #define USB_PRODUCT_XBOX_ONE_S_REV2_BLUETOOTH 0x02fd #define USB_PRODUCT_XBOX_ONE_SERIES_X 0x0b12 #define USB_PRODUCT_XBOX_ONE_SERIES_X_BLUETOOTH 0x0b13 +#define USB_PRODUCT_XBOX_ONE_RAW_INPUT_CONTROLLER 0x02ff /* USB usage pages */ #define USB_USAGEPAGE_GENERIC_DESKTOP 0x0001 diff --git a/src/joystick/windows/SDL_rawinputjoystick.c b/src/joystick/windows/SDL_rawinputjoystick.c index 77a1f3d58..9d63487a3 100644 --- a/src/joystick/windows/SDL_rawinputjoystick.c +++ b/src/joystick/windows/SDL_rawinputjoystick.c @@ -942,6 +942,13 @@ RAWINPUT_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version, co return SDL_TRUE; } + /* The Xbox One controller shows up as a hardcoded raw input VID/PID */ + if (name && SDL_strcmp(name, "Xbox One Game Controller") == 0 && + device->vendor_id == USB_VENDOR_MICROSOFT && + device->product_id == USB_PRODUCT_XBOX_ONE_RAW_INPUT_CONTROLLER) { + return SDL_TRUE; + } + device = device->next; } return SDL_FALSE;