From 1f7ec3fa4e7c713d62494d05618351e709254a07 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 11 Feb 2021 17:27:22 -0800 Subject: [PATCH] Added support for the PowerA Xbox One Series X Wired Controller --- src/hidapi/libusb/hid.c | 2 ++ src/joystick/SDL_joystick.c | 7 +++++++ src/joystick/controller_type.h | 3 ++- src/joystick/usb_ids.h | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/hidapi/libusb/hid.c b/src/hidapi/libusb/hid.c index f3fdfb3c6..68979c299 100644 --- a/src/hidapi/libusb/hid.c +++ b/src/hidapi/libusb/hid.c @@ -507,6 +507,7 @@ static int is_xbox360(unsigned short vendor_id, const struct libusb_interface_de 0x162e, /* Joytech */ 0x1689, /* Razer Onza */ 0x1bad, /* Harmonix */ + 0x20d6, /* PowerA */ 0x24c6, /* PowerA */ }; @@ -534,6 +535,7 @@ static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_de 0x0e6f, /* PDP */ 0x0f0d, /* Hori */ 0x1532, /* Razer Wildcat */ + 0x20d6, /* PowerA */ 0x24c6, /* PowerA */ 0x2e24, /* Hyperkin */ }; diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index d532e5207..5a84b9508 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1813,6 +1813,7 @@ SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 produc 0x162e, /* Joytech */ 0x1689, /* Razer Onza */ 0x1bad, /* Harmonix */ + 0x20d6, /* PowerA */ 0x24c6, /* PowerA */ }; @@ -1836,6 +1837,7 @@ SDL_GetJoystickGameControllerType(const char *name, Uint16 vendor, Uint16 produc 0x0e6f, /* PDP */ 0x0f0d, /* Hori */ 0x1532, /* Razer Wildcat */ + 0x20d6, /* PowerA */ 0x24c6, /* PowerA */ 0x2e24, /* Hyperkin */ }; @@ -1923,6 +1925,11 @@ SDL_IsJoystickXboxOneSeriesX(Uint16 vendor_id, Uint16 product_id) return SDL_TRUE; } } + if (vendor_id == USB_VENDOR_POWERA_ALT) { + if (product_id == USB_PRODUCT_XBOX_ONE_SERIES_X_POWERA) { + return SDL_TRUE; + } + } return SDL_FALSE; } diff --git a/src/joystick/controller_type.h b/src/joystick/controller_type.h index 7fbed2553..6a13ed7fb 100644 --- a/src/joystick/controller_type.h +++ b/src/joystick/controller_type.h @@ -398,9 +398,10 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x1532, 0x0a00 ), k_eControllerType_XBoxOneController, NULL }, // Razer Atrox Arcade Stick { MAKE_CONTROLLER_ID( 0x1532, 0x0a03 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wildcat { MAKE_CONTROLLER_ID( 0x1532, 0x0a14 ), k_eControllerType_XBoxOneController, NULL }, // Razer Wolverine Ultimate + { MAKE_CONTROLLER_ID( 0x20d6, 0x2001 ), k_eControllerType_XBoxOneController, "PowerA Xbox One Series X Controller" }, // PowerA Xbox One Series X Wired Controller { MAKE_CONTROLLER_ID( 0x24c6, 0x541a ), k_eControllerType_XBoxOneController, NULL }, // PowerA Xbox One Mini Wired Controller { MAKE_CONTROLLER_ID( 0x24c6, 0x542a ), k_eControllerType_XBoxOneController, NULL }, // Xbox ONE spectra - { MAKE_CONTROLLER_ID( 0x24c6, 0x543a ), k_eControllerType_XBoxOneController, "PowerA XBox One Controller" }, // PowerA Xbox ONE liquid metal controller + { MAKE_CONTROLLER_ID( 0x24c6, 0x543a ), k_eControllerType_XBoxOneController, "PowerA Xbox One Controller" }, // PowerA Xbox ONE liquid metal controller { MAKE_CONTROLLER_ID( 0x24c6, 0x551a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Pro Controller { MAKE_CONTROLLER_ID( 0x24c6, 0x561a ), k_eControllerType_XBoxOneController, NULL }, // PowerA FUSION Controller { MAKE_CONTROLLER_ID( 0x24c6, 0x581a ), k_eControllerType_XBoxOneController, NULL }, // BDA XB1 Classic Controller diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h index e877988de..db81d123a 100644 --- a/src/joystick/usb_ids.h +++ b/src/joystick/usb_ids.h @@ -31,6 +31,7 @@ #define USB_VENDOR_NINTENDO 0x057e #define USB_VENDOR_NVIDIA 0x0955 #define USB_VENDOR_PDP 0x0e6f +#define USB_VENDOR_POWERA_ALT 0x20d6 #define USB_VENDOR_POWERA 0x24c6 #define USB_VENDOR_RAZER 0x1532 #define USB_VENDOR_SHENZHEN 0x0079 @@ -58,6 +59,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_SERIES_X_POWERA 0x2001 #define USB_PRODUCT_XBOX_ONE_RAW_INPUT_CONTROLLER 0x02ff #define USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER 0x02fe /* Made up product ID for XInput */