Added support for the Xbox One Elite 2 Controller with 5.x series firmware
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 1bab305..7e58357 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -1989,6 +1989,7 @@ SDL_IsJoystickBluetoothXboxOne(Uint16 vendor_id, Uint16 product_id)
if (product_id == USB_PRODUCT_XBOX_ONE_S_REV1_BLUETOOTH ||
product_id == USB_PRODUCT_XBOX_ONE_S_REV2_BLUETOOTH ||
product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH ||
+ product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_REV2_BLUETOOTH ||
product_id == USB_PRODUCT_XBOX_SERIES_X_BLUETOOTH) {
return SDL_TRUE;
}
diff --git a/src/joystick/controller_type.h b/src/joystick/controller_type.h
index 7476740..0488cfc 100644
--- a/src/joystick/controller_type.h
+++ b/src/joystick/controller_type.h
@@ -328,6 +328,7 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x045e, 0x0b05 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth)
{ MAKE_CONTROLLER_ID( 0x045e, 0x0b12 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad
{ MAKE_CONTROLLER_ID( 0x045e, 0x0b13 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad (Bluetooth)
+ { MAKE_CONTROLLER_ID( 0x045e, 0x0b22 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth) with 5.x firmware
{ MAKE_CONTROLLER_ID( 0x0738, 0x4a01 ), k_eControllerType_XBoxOneController, NULL }, // Mad Catz FightStick TE 2
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0139 ), k_eControllerType_XBoxOneController, "PDP Xbox One Afterglow" }, // PDP Afterglow Wired Controller for Xbox One
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x013B ), k_eControllerType_XBoxOneController, "PDP Xbox One Face-Off Controller" }, // PDP Face-Off Gamepad for Xbox One
@@ -579,7 +580,7 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0181 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Deluxe Wired Pro Controller for Nintendo Switch
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0184 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Faceoff Wired Deluxe+ Audio Controller
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0185 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Wired Fight Pad Pro for Nintendo Switch
- { MAKE_CONTROLLER_ID( 0x0e6f, 0x0186 ), k_eControllerType_SwitchProController, NULL }, // PDP Afterglow Wireless Switch Controller - working gyro. USB is for charging only. Many later "Wireless" line devices w/ gyro also use this vid/pid
+ { MAKE_CONTROLLER_ID( 0x0e6f, 0x0186 ), k_eControllerType_SwitchProController, NULL }, // PDP Afterglow Wireless Switch Controller - working gyro. USB is for charging only. Many later "Wireless" line devices w/ gyro also use this vid/pid
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0187 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Rockcandy Wired Controller
{ MAKE_CONTROLLER_ID( 0x0e6f, 0x0188 ), k_eControllerType_SwitchInputOnlyController, NULL }, // PDP Afterglow Wired Deluxe+ Audio Controller
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00aa ), k_eControllerType_SwitchInputOnlyController, NULL }, // HORI Real Arcade Pro V Hayabusa in Switch Mode
diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c
index ffec1c9..1c297f8 100644
--- a/src/joystick/hidapi/SDL_hidapi_xboxone.c
+++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c
@@ -508,12 +508,16 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne
Paddle bits:
P3: 0x01 (A) P1: 0x02 (B)
P4: 0x04 (X) P2: 0x08 (Y)
- Xbox One Elite Series 2 report is 38 bytes, paddles in data[18], mode in data[19], mode 0 has no mapped paddles by default
+ Xbox One Elite Series 2 4.x firmware report is 38 bytes, paddles in data[18], mode in data[19], mode 0 has no mapped paddles by default
+ Paddle bits:
+ P3: 0x04 (A) P1: 0x01 (B)
+ P4: 0x08 (X) P2: 0x02 (Y)
+ Xbox One Elite Series 2 5.x firmware report is 50 bytes, paddles in data[22], mode in data[23], mode 0 has no mapped paddles by default
Paddle bits:
P3: 0x04 (A) P1: 0x01 (B)
P4: 0x08 (X) P2: 0x02 (Y)
*/
- if (ctx->has_paddles && (size == 33 || size == 38)) {
+ if (ctx->has_paddles && (size == 33 || size == 38 || size == 50)) {
int paddle_index;
int button1_bit;
int button2_bit;
@@ -532,7 +536,7 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne
/* The mapped controller state is at offset 4, the raw state is at offset 18, compare them to see if the paddles are mapped */
paddles_mapped = (SDL_memcmp(&data[4], &data[18], 2) != 0);
- } else /* if (size == 38) */ {
+ } else if (size == 38) {
/* XBox One Elite Series 2 */
paddle_index = 18;
button1_bit = 0x01;
@@ -540,6 +544,15 @@ HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_DriverXboxOne
button3_bit = 0x04;
button4_bit = 0x08;
paddles_mapped = (data[19] != 0);
+
+ } else if (size == 50) {
+ /* XBox One Elite Series 2 */
+ paddle_index = 22;
+ button1_bit = 0x01;
+ button2_bit = 0x02;
+ button3_bit = 0x04;
+ button4_bit = 0x08;
+ paddles_mapped = (data[23] != 0);
}
#ifdef DEBUG_XBOX_PROTOCOL
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n",
@@ -629,6 +642,7 @@ HIDAPI_DriverXboxOneBluetooth_HandleButtons16(SDL_Joystick *joystick, SDL_Driver
* Xbox One S with firmware 4.8.1923 uses a 17 byte packet with BACK button in byte 16 and the GUIDE button in a separate packet (on Windows), or in byte 15 (on Linux)
* Xbox One Elite Series 2 with firmware 4.7.1872 uses a 55 byte packet with BACK button in byte 16, paddles starting at byte 33, and the GUIDE button in a separate packet
* Xbox One Elite Series 2 with firmware 4.8.1908 uses a 33 byte packet with BACK button in byte 16, paddles starting at byte 17, and the GUIDE button in a separate packet
+ * Xbox One Elite Series 2 with firmware 5.11.3112 uses a 19 byte packet with BACK and GUIDE buttons in byte 15
* Xbox Series X with firmware 5.5.2641 uses a 17 byte packet with BACK and GUIDE buttons in byte 15, and SHARE button in byte 17
*/
static void
@@ -644,7 +658,7 @@ HIDAPI_DriverXboxOneBluetooth_HandleButtons(SDL_Joystick *joystick, SDL_DriverXb
}
if (ctx->last_state[15] != data[15]) {
- if (ctx->has_share_button) {
+ if (ctx->has_share_button || size == 19) {
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, (data[15] & 0x04) ? SDL_PRESSED : SDL_RELEASED);
SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[15] & 0x10) ? SDL_PRESSED : SDL_RELEASED);
} else if (!ctx->has_guide_packet) {
diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h
index e3160c7..8e363a6 100644
--- a/src/joystick/usb_ids.h
+++ b/src/joystick/usb_ids.h
@@ -39,40 +39,41 @@
#define USB_VENDOR_SONY 0x054c
#define USB_VENDOR_VALVE 0x28de
-#define USB_PRODUCT_AMAZON_LUNA_CONTROLLER 0x0419
-#define USB_PRODUCT_GOOGLE_STADIA_CONTROLLER 0x9400
-#define USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER 0x1846
-#define USB_PRODUCT_NINTENDO_GAMECUBE_ADAPTER 0x0337
-#define USB_PRODUCT_NINTENDO_SWITCH_PRO 0x2009
-#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_LEFT 0x2006
-#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_RIGHT 0x2007
-#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP 0x200e
-#define USB_PRODUCT_RAZER_PANTHERA 0x0401
-#define USB_PRODUCT_RAZER_PANTHERA_EVO 0x1008
-#define USB_PRODUCT_RAZER_ATROX 0x0a00
-#define USB_PRODUCT_SONY_DS4 0x05c4
-#define USB_PRODUCT_SONY_DS4_DONGLE 0x0ba0
-#define USB_PRODUCT_SONY_DS4_SLIM 0x09cc
-#define USB_PRODUCT_SONY_DS5 0x0ce6
-#define USB_PRODUCT_XBOX360_XUSB_CONTROLLER 0x02a1 /* XUSB driver software PID */
-#define USB_PRODUCT_XBOX360_WIRED_CONTROLLER 0x028e
-#define USB_PRODUCT_XBOX360_WIRELESS_RECEIVER 0x0719
-#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_1 0x02e3
-#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2 0x0b00
-#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH 0x0b05
-#define USB_PRODUCT_XBOX_ONE_S 0x02ea
-#define USB_PRODUCT_XBOX_ONE_S_REV1_BLUETOOTH 0x02e0
-#define USB_PRODUCT_XBOX_ONE_S_REV2_BLUETOOTH 0x02fd
-#define USB_PRODUCT_XBOX_SERIES_X 0x0b12
-#define USB_PRODUCT_XBOX_SERIES_X_BLUETOOTH 0x0b13
-#define USB_PRODUCT_XBOX_SERIES_X_VICTRIX_GAMBIT 0x02d6
-#define USB_PRODUCT_XBOX_SERIES_X_PDP_BLUE 0x02d9
-#define USB_PRODUCT_XBOX_SERIES_X_PDP_AFTERGLOW 0x02da
-#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
+#define USB_PRODUCT_AMAZON_LUNA_CONTROLLER 0x0419
+#define USB_PRODUCT_GOOGLE_STADIA_CONTROLLER 0x9400
+#define USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER 0x1846
+#define USB_PRODUCT_NINTENDO_GAMECUBE_ADAPTER 0x0337
+#define USB_PRODUCT_NINTENDO_SWITCH_PRO 0x2009
+#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_LEFT 0x2006
+#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_RIGHT 0x2007
+#define USB_PRODUCT_NINTENDO_SWITCH_JOY_CON_GRIP 0x200e
+#define USB_PRODUCT_RAZER_PANTHERA 0x0401
+#define USB_PRODUCT_RAZER_PANTHERA_EVO 0x1008
+#define USB_PRODUCT_RAZER_ATROX 0x0a00
+#define USB_PRODUCT_SONY_DS4 0x05c4
+#define USB_PRODUCT_SONY_DS4_DONGLE 0x0ba0
+#define USB_PRODUCT_SONY_DS4_SLIM 0x09cc
+#define USB_PRODUCT_SONY_DS5 0x0ce6
+#define USB_PRODUCT_XBOX360_XUSB_CONTROLLER 0x02a1 /* XUSB driver software PID */
+#define USB_PRODUCT_XBOX360_WIRED_CONTROLLER 0x028e
+#define USB_PRODUCT_XBOX360_WIRELESS_RECEIVER 0x0719
+#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_1 0x02e3
+#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2 0x0b00
+#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH 0x0b05
+#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_REV2_BLUETOOTH 0x0b22
+#define USB_PRODUCT_XBOX_ONE_S 0x02ea
+#define USB_PRODUCT_XBOX_ONE_S_REV1_BLUETOOTH 0x02e0
+#define USB_PRODUCT_XBOX_ONE_S_REV2_BLUETOOTH 0x02fd
+#define USB_PRODUCT_XBOX_SERIES_X 0x0b12
+#define USB_PRODUCT_XBOX_SERIES_X_BLUETOOTH 0x0b13
+#define USB_PRODUCT_XBOX_SERIES_X_VICTRIX_GAMBIT 0x02d6
+#define USB_PRODUCT_XBOX_SERIES_X_PDP_BLUE 0x02d9
+#define USB_PRODUCT_XBOX_SERIES_X_PDP_AFTERGLOW 0x02da
+#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 */
#define USB_USAGEPAGE_GENERIC_DESKTOP 0x0001