summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOzkan Sezer <sezeroz@gmail.com>2021-02-08 00:20:56 +0300
committerOzkan Sezer <sezeroz@gmail.com>2021-02-08 00:20:56 +0300
commit8e15287c317857aea28f46fa98b3cc39c4e49c07 (patch)
treef445f6c03622e598343afe814a405ab8795cce47
parent476ae52b27255f8c558220bf5d7739585a0f5e86 (diff)
downloadsdl-8e15287c317857aea28f46fa98b3cc39c4e49c07.tar.gz
avoid some pedantic warnings in array initializers
-rw-r--r--src/joystick/hidapi/SDL_hidapi_xbox360.c3
-rw-r--r--src/joystick/hidapi/SDL_hidapi_xbox360w.c3
-rw-r--r--src/joystick/hidapi/SDL_hidapi_xboxone.c6
3 files changed, 9 insertions, 3 deletions
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360.c b/src/joystick/hidapi/SDL_hidapi_xbox360.c
index 08f23eb73..f6c5cbe26 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360.c
@@ -92,8 +92,9 @@ static SDL_bool SetSlotLED(hid_device *dev, Uint8 slot)
{
const SDL_bool blink = SDL_FALSE;
Uint8 mode = (blink ? 0x02 : 0x06) + slot;
- const Uint8 led_packet[] = { 0x01, 0x03, mode };
+ Uint8 led_packet[] = { 0x01, 0x03, 0x00 };
+ led_packet[2] = mode;
if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {
return SDL_FALSE;
}
diff --git a/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/src/joystick/hidapi/SDL_hidapi_xbox360w.c
index e6bc21050..c69727e7a 100644
--- a/src/joystick/hidapi/SDL_hidapi_xbox360w.c
+++ b/src/joystick/hidapi/SDL_hidapi_xbox360w.c
@@ -66,8 +66,9 @@ static SDL_bool SetSlotLED(hid_device *dev, Uint8 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 };
+ Uint8 led_packet[] = { 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ led_packet[3] = 0x40 + (mode % 0x0e);
if (hid_write(dev, led_packet, sizeof(led_packet)) != sizeof(led_packet)) {
return SDL_FALSE;
}
diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c
index bcc05d783..563a0fab6 100644
--- a/src/joystick/hidapi/SDL_hidapi_xboxone.c
+++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c
@@ -163,7 +163,11 @@ SendAckIfNeeded(SDL_HIDAPI_Device *device, Uint8 *data, int size)
/* The Windows driver is taking care of acks */
#else
if ((data[1] & 0x30) == 0x30) {
- Uint8 ack_packet[] = { 0x01, 0x20, data[2], 0x09, 0x00, data[0], 0x20, data[3], 0x00, 0x00, 0x00, 0x00, 0x00 };
+ Uint8 ack_packet[] = { 0x01, 0x20, 0x00, 0x09, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ ack_packet[2] = data[2];
+ ack_packet[5] = data[0];
+ ack_packet[7] = data[3];
/* The initial ack needs 0x80 added to the response, for some reason */
if (data[0] == 0x04 && data[1] == 0xF0) {