Make sure the Xbox 360 driver doesn't try to talk to the wireless controllers

This commit is contained in:
Sam Lantinga 2019-12-19 21:45:44 -08:00
parent 1db56619de
commit 6b76787209
3 changed files with 11 additions and 2 deletions

0
Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj Normal file → Executable file
View File

0
Xcode/SDL/SDL.xcodeproj/project.pbxproj Normal file → Executable file
View File

View File

@ -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;