Browse Source

Don't blink the Xbox 360 LED when setting the player slot, it's probably already been set by a driver

Sam Lantinga 4 years ago
parent
commit
fbd7c718b6

+ 2 - 1
src/joystick/hidapi/SDL_hidapi_xbox360.c

@@ -106,7 +106,8 @@ HIDAPI_DriverXbox360_GetDeviceName(Uint16 vendor_id, Uint16 product_id)
 
 
 static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
 static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
 {
 {
-    Uint8 mode = 0x02 + slot;
+    const SDL_bool blink = SDL_FALSE;
+    Uint8 mode = (blink ? 0x02 : 0x06) + slot;
     const Uint8 led_packet[] = { 0x01, 0x03, mode };
     const Uint8 led_packet[] = { 0x01, 0x03, mode };
 
 
     if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {
     if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {

+ 2 - 1
src/joystick/hidapi/SDL_hidapi_xbox360w.c

@@ -64,7 +64,8 @@ HIDAPI_DriverXbox360W_GetDeviceName(Uint16 vendor_id, Uint16 product_id)
 
 
 static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
 static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
 {
 {
-    Uint8 mode = 0x02 + slot;
+    const SDL_bool blink = SDL_FALSE;
+    Uint8 mode = (blink ? 0x02 : 0x06) + slot;
     const Uint8 led_packet[] = { 0x00, 0x00, 0x08, (0x40 + (mode % 0x0e)), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
     const Uint8 led_packet[] = { 0x00, 0x00, 0x08, (0x40 + (mode % 0x0e)), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 
 
     if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {
     if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {