Added identifiers for the Xbox One Elite Series 2 controller
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
diff --git a/src/joystick/controller_type.h b/src/joystick/controller_type.h
index 2411b73..8ae5085 100644
--- a/src/joystick/controller_type.h
+++ b/src/joystick/controller_type.h
@@ -83,6 +83,8 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x045e, 0x02ea ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One S pad
{ MAKE_CONTROLLER_ID( 0x045e, 0x02fd ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One S pad (Bluetooth)
{ MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One Elite pad
+ { MAKE_CONTROLLER_ID( 0x045e, 0x0b00 ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One Elite Series 2 pad
+ { MAKE_CONTROLLER_ID( 0x045e, 0x0b05 ), k_eControllerType_XBoxOneController }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth)
{ MAKE_CONTROLLER_ID( 0x045e, 0x0719 ), k_eControllerType_XBox360Controller }, // Xbox 360 Wireless Receiver
{ MAKE_CONTROLLER_ID( 0x046d, 0xc21d ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F310
{ MAKE_CONTROLLER_ID( 0x046d, 0xc21e ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F510
diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c
index 0e97fe9..d636762 100644
--- a/src/joystick/hidapi/SDL_hidapi_xboxone.c
+++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c
@@ -131,11 +131,24 @@ typedef struct {
static SDL_bool
+IsBluetoothXboxOneController(Uint16 vendor_id, Uint16 product_id)
+{
+ /* Check to see if it's the Xbox One S or Xbox One Elite Series 2 in Bluetooth mode */
+ const Uint16 USB_VENDOR_MICROSOFT = 0x045e;
+ const Uint16 USB_PRODUCT_XBOX_ONE_S = 0x02fd;
+ const Uint16 USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2 = 0x0b05;
+
+ if (vendor_id == USB_VENDOR_MICROSOFT && (product_id == USB_PRODUCT_XBOX_ONE_S || product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2)) {
+ return SDL_TRUE;
+ }
+ return SDL_FALSE;
+}
+
+static SDL_bool
HIDAPI_DriverXboxOne_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, const char *name)
{
#ifdef __LINUX__
- /* Check to see if it's the Xbox One S in Bluetooth mode */
- if (vendor_id == 0x045e && product_id == 0x02fd) {
+ if (IsBluetoothXboxOneController(vendor_id, product_id)) {
/* We can't do rumble on this device, hid_write() fails, so don't try to open it here */
return SDL_FALSE;
}
@@ -155,7 +168,6 @@ HIDAPI_DriverXboxOne_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor
SDL_DriverXboxOne_Context *ctx;
int i;
Uint8 init_packet[USB_PACKET_LENGTH];
- SDL_bool is_bluetooth = SDL_FALSE;
ctx = (SDL_DriverXboxOne_Context *)SDL_calloc(1, sizeof(*ctx));
if (!ctx) {
@@ -164,10 +176,7 @@ HIDAPI_DriverXboxOne_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor
}
*context = ctx;
- if (vendor_id == 0x045e && product_id == 0x02fd) {
- is_bluetooth = SDL_TRUE;
- }
- if (!is_bluetooth) {
+ if (!IsBluetoothXboxOneController(vendor_id, product_id)) {
/* Send the controller init data */
for (i = 0; i < SDL_arraysize(xboxone_init_packets); ++i) {
const SDL_DriverXboxOne_InitPacket *packet = &xboxone_init_packets[i];