mirror of https://github.com/encounter/SDL.git
Added identifiers for the Xbox One Elite Series 2 controller
This commit is contained in:
parent
df728f8591
commit
144956442d
|
@ -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, 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, 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, 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( 0x045e, 0x0719 ), k_eControllerType_XBox360Controller }, // Xbox 360 Wireless Receiver
|
||||||
{ MAKE_CONTROLLER_ID( 0x046d, 0xc21d ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F310
|
{ MAKE_CONTROLLER_ID( 0x046d, 0xc21d ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F310
|
||||||
{ MAKE_CONTROLLER_ID( 0x046d, 0xc21e ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F510
|
{ MAKE_CONTROLLER_ID( 0x046d, 0xc21e ), k_eControllerType_XBox360Controller }, // Logitech Gamepad F510
|
||||||
|
|
|
@ -130,12 +130,25 @@ typedef struct {
|
||||||
} SDL_DriverXboxOne_Context;
|
} SDL_DriverXboxOne_Context;
|
||||||
|
|
||||||
|
|
||||||
|
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
|
static SDL_bool
|
||||||
HIDAPI_DriverXboxOne_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, const char *name)
|
HIDAPI_DriverXboxOne_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, const char *name)
|
||||||
{
|
{
|
||||||
#ifdef __LINUX__
|
#ifdef __LINUX__
|
||||||
/* Check to see if it's the Xbox One S in Bluetooth mode */
|
if (IsBluetoothXboxOneController(vendor_id, product_id)) {
|
||||||
if (vendor_id == 0x045e && product_id == 0x02fd) {
|
|
||||||
/* We can't do rumble on this device, hid_write() fails, so don't try to open it here */
|
/* We can't do rumble on this device, hid_write() fails, so don't try to open it here */
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +168,6 @@ HIDAPI_DriverXboxOne_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor
|
||||||
SDL_DriverXboxOne_Context *ctx;
|
SDL_DriverXboxOne_Context *ctx;
|
||||||
int i;
|
int i;
|
||||||
Uint8 init_packet[USB_PACKET_LENGTH];
|
Uint8 init_packet[USB_PACKET_LENGTH];
|
||||||
SDL_bool is_bluetooth = SDL_FALSE;
|
|
||||||
|
|
||||||
ctx = (SDL_DriverXboxOne_Context *)SDL_calloc(1, sizeof(*ctx));
|
ctx = (SDL_DriverXboxOne_Context *)SDL_calloc(1, sizeof(*ctx));
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
|
@ -164,10 +176,7 @@ HIDAPI_DriverXboxOne_Init(SDL_Joystick *joystick, hid_device *dev, Uint16 vendor
|
||||||
}
|
}
|
||||||
*context = ctx;
|
*context = ctx;
|
||||||
|
|
||||||
if (vendor_id == 0x045e && product_id == 0x02fd) {
|
if (!IsBluetoothXboxOneController(vendor_id, product_id)) {
|
||||||
is_bluetooth = SDL_TRUE;
|
|
||||||
}
|
|
||||||
if (!is_bluetooth) {
|
|
||||||
/* Send the controller init data */
|
/* Send the controller init data */
|
||||||
for (i = 0; i < SDL_arraysize(xboxone_init_packets); ++i) {
|
for (i = 0; i < SDL_arraysize(xboxone_init_packets); ++i) {
|
||||||
const SDL_DriverXboxOne_InitPacket *packet = &xboxone_init_packets[i];
|
const SDL_DriverXboxOne_InitPacket *packet = &xboxone_init_packets[i];
|
||||||
|
|
Loading…
Reference in New Issue