From 6b767872090cb3c087b7a6056c82a2d682cbe36e Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 19 Dec 2019 21:45:44 -0800 Subject: [PATCH] Make sure the Xbox 360 driver doesn't try to talk to the wireless controllers --- Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj | 0 Xcode/SDL/SDL.xcodeproj/project.pbxproj | 0 src/joystick/hidapi/SDL_hidapi_xbox360.c | 13 +++++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) mode change 100644 => 100755 Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj mode change 100644 => 100755 Xcode/SDL/SDL.xcodeproj/project.pbxproj diff --git a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj old mode 100644 new mode 100755 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj old mode 100644 new mode 100755 diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360.c b/src/joystick/hidapi/SDL_hidapi_xbox360.c index 56c1e6f7f4108..2fb565877db2a 100644 --- a/src/joystick/hidapi/SDL_hidapi_xbox360.c +++ b/src/joystick/hidapi/SDL_hidapi_xbox360.c @@ -250,11 +250,19 @@ static SDL_bool HIDAPI_DriverXbox360_IsSupportedDevice(Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, const char *name) { SDL_GameControllerType type = SDL_GetJoystickGameControllerType(vendor_id, product_id, name); + const Uint16 MICROSOFT_USB_VID = 0x045e; + const Uint16 NVIDIA_USB_VID = 0x0955; - if (vendor_id == 0x0955) { + if (vendor_id == NVIDIA_USB_VID) { /* This is the NVIDIA Shield controller which doesn't talk Xbox controller protocol */ return SDL_FALSE; } + if (vendor_id == MICROSOFT_USB_VID) { + if (product_id == 0x0291 || product_id == 0x0719) { + /* This is the wireless dongle, which talks a different protocol */ + return SDL_FALSE; + } + } if (interface_number > 0) { /* This is the chatpad or other input interface, not the Xbox 360 interface */ return SDL_FALSE; @@ -282,7 +290,8 @@ HIDAPI_DriverXbox360_GetDeviceName(Uint16 vendor_id, Uint16 product_id) static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot) { - const Uint8 led_packet[] = { 0x01, 0x03, (2 + slot) }; + Uint8 mode = 0x02 + slot; + const Uint8 led_packet[] = { 0x01, 0x03, mode }; if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) { return SDL_FALSE;