From 33843b093349c93c675545a2acb619d845729fb1 Mon Sep 17 00:00:00 2001 From: Dimitriy Ryazantcev Date: Mon, 11 Dec 2023 15:19:02 +0200 Subject: [PATCH] Use existing XUSB driver software PID 0x02a1 instead of PID 0x02fe 0x02fe is actually PID of Xbox Wireless Adapter for Windows 10 (Model 1790) and creates confusion. Here is USB descriptor dump: https://github.com/DJm00n/ControllersInfo/blob/master/xboxone/DescriptorDump_Adapter%20(Xbox%20Wireless%20Adapter%20for%20Windows).txt (cherry picked from commit c790572674b225de34fe53c0a0188dca8a05c722) --- src/joystick/SDL_joystick.c | 3 --- src/joystick/hidapi/SDL_hidapijoystick.c | 2 +- src/joystick/usb_ids.h | 1 - src/joystick/windows/SDL_xinputjoystick.c | 2 +- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index e5b804415..d32e38310 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -2458,9 +2458,6 @@ SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor } else if (vendor == 0x0001 && product == 0x0001) { type = SDL_CONTROLLER_TYPE_UNKNOWN; - } else if (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { - type = SDL_CONTROLLER_TYPE_XBOXONE; - } else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) || (vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) { type = SDL_CONTROLLER_TYPE_AMAZON_LUNA; diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index cfb25bdd5..2fbce400b 100644 --- a/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/src/joystick/hidapi/SDL_hidapijoystick.c @@ -1171,7 +1171,7 @@ static SDL_bool HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id, } /* If we're looking for an XInput controller, match it against any other Xbox controller */ - if (product_id == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { + if (product_id == USB_PRODUCT_XBOX360_XUSB_CONTROLLER) { if (device->type == SDL_CONTROLLER_TYPE_XBOX360 || device->type == SDL_CONTROLLER_TYPE_XBOXONE) { return SDL_TRUE; } diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h index 37890ee21..58082c59d 100644 --- a/src/joystick/usb_ids.h +++ b/src/joystick/usb_ids.h @@ -136,7 +136,6 @@ #define USB_PRODUCT_XBOX_SERIES_X_POWERA_FUSION_PRO2 0x4001 #define USB_PRODUCT_XBOX_SERIES_X_POWERA_SPECTRA 0x4002 #define USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER 0x02ff /* XBOXGIP driver software PID */ -#define USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER 0x02fe /* Made up product ID for XInput */ #define USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD 0x11ff /* USB usage pages */ diff --git a/src/joystick/windows/SDL_xinputjoystick.c b/src/joystick/windows/SDL_xinputjoystick.c index 4da276f06..050faf60f 100644 --- a/src/joystick/windows/SDL_xinputjoystick.c +++ b/src/joystick/windows/SDL_xinputjoystick.c @@ -303,7 +303,7 @@ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pC #ifdef SDL_JOYSTICK_HIDAPI /* Since we're guessing about the VID/PID, use a hard-coded VID/PID to represent XInput */ - if (HIDAPI_IsDevicePresent(USB_VENDOR_MICROSOFT, USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER, version, pNewJoystick->joystickname)) { + if (HIDAPI_IsDevicePresent(USB_VENDOR_MICROSOFT, USB_PRODUCT_XBOX360_XUSB_CONTROLLER, version, pNewJoystick->joystickname)) { /* The HIDAPI driver is taking care of this device */ SDL_free(pNewJoystick); return;