From 441fbcaa3df0d1edd25a36fff6ceb53a6a0f52c7 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 13 Aug 2021 20:48:54 -0700 Subject: [PATCH] Added HIDAPI support for the Xbox Adaptive Controller --- src/joystick/SDL_joystick.c | 12 +++++++----- src/joystick/controller_type.h | 10 +++++++--- src/joystick/usb_ids.h | 9 ++++++--- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c index baa511b18..04c99b9ca 100644 --- a/src/joystick/SDL_joystick.c +++ b/src/joystick/SDL_joystick.c @@ -1961,7 +1961,7 @@ SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id) { if (vendor_id == USB_VENDOR_MICROSOFT) { if (product_id == USB_PRODUCT_XBOX_SERIES_X || - product_id == USB_PRODUCT_XBOX_SERIES_X_BLUETOOTH) { + product_id == USB_PRODUCT_XBOX_SERIES_X_BLE) { return SDL_TRUE; } } @@ -1986,12 +1986,14 @@ SDL_bool SDL_IsJoystickBluetoothXboxOne(Uint16 vendor_id, Uint16 product_id) { if (vendor_id == USB_VENDOR_MICROSOFT) { - if (product_id == USB_PRODUCT_XBOX_ONE_S_REV1_BLUETOOTH || + if (product_id == USB_PRODUCT_XBOX_ONE_ADAPTIVE_BLUETOOTH || + product_id == USB_PRODUCT_XBOX_ONE_ADAPTIVE_BLE || + product_id == USB_PRODUCT_XBOX_ONE_S_REV1_BLUETOOTH || product_id == USB_PRODUCT_XBOX_ONE_S_REV2_BLUETOOTH || - product_id == USB_PRODUCT_XBOX_ONE_S_REV2_BLUETOOTH_V5 || + product_id == USB_PRODUCT_XBOX_ONE_S_REV2_BLE || product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH || - product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH_V5 || - product_id == USB_PRODUCT_XBOX_SERIES_X_BLUETOOTH) { + product_id == USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLE || + product_id == USB_PRODUCT_XBOX_SERIES_X_BLE) { return SDL_TRUE; } } diff --git a/src/joystick/controller_type.h b/src/joystick/controller_type.h index 64d925d9b..3d1fcf059 100644 --- a/src/joystick/controller_type.h +++ b/src/joystick/controller_type.h @@ -325,11 +325,15 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x045e, 0x02fd ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) { MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController, NULL }, // Microsoft X-Box One controller with XBOXGIP driver on Windows { MAKE_CONTROLLER_ID( 0x045e, 0x0b00 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad + { MAKE_CONTROLLER_ID( 0x045e, 0x0b02 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad { 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, 0x0b0a ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad + { MAKE_CONTROLLER_ID( 0x045e, 0x0b0c ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive 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, 0x0b20 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) with 5.x firmware - { 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( 0x045e, 0x0b13 ), k_eControllerType_XBoxOneController, "Xbox Series X Controller" }, // Microsoft X-Box Series X pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b20 ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b21 ), k_eControllerType_XBoxOneController, "Xbox Adaptive Controller" }, // Microsoft X-Box Adaptive pad (BLE) + { MAKE_CONTROLLER_ID( 0x045e, 0x0b22 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (BLE) { 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 diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h index 6a4b26e39..ea36d515e 100644 --- a/src/joystick/usb_ids.h +++ b/src/joystick/usb_ids.h @@ -57,16 +57,19 @@ #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_ADAPTIVE 0x0b0a +#define USB_PRODUCT_XBOX_ONE_ADAPTIVE_BLUETOOTH 0x0b0c +#define USB_PRODUCT_XBOX_ONE_ADAPTIVE_BLE 0x0b21 #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_BLUETOOTH_V5 0x0b22 +#define USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLE 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_ONE_S_REV2_BLUETOOTH_V5 0x0b20 +#define USB_PRODUCT_XBOX_ONE_S_REV2_BLE 0x0b20 #define USB_PRODUCT_XBOX_SERIES_X 0x0b12 -#define USB_PRODUCT_XBOX_SERIES_X_BLUETOOTH 0x0b13 +#define USB_PRODUCT_XBOX_SERIES_X_BLE 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