Skip to content

Commit

Permalink
Make sure the Xbox 360 driver doesn't try to talk to the wireless con…
Browse files Browse the repository at this point in the history
…trollers
  • Loading branch information
slouken committed Dec 20, 2019
1 parent 1db5661 commit 6b76787
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Empty file modified Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj 100644 → 100755
Empty file.
Empty file modified Xcode/SDL/SDL.xcodeproj/project.pbxproj 100644 → 100755
Empty file.
13 changes: 11 additions & 2 deletions src/joystick/hidapi/SDL_hidapi_xbox360.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6b76787

Please sign in to comment.