Commit 976eee77cc380364534e73fcda8167a7c8f00492

Sjoerd Simons 2020-02-04T07:23:44

Correct joystick hat indexes on linux The index and indices were swapped; Which is fine as long as there are no gaps in the ABS_HAT* event availability but otherwise things do get confused. Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c
index 690e8d1..2b86bff 100644
--- a/src/joystick/linux/SDL_sysjoystick.c
+++ b/src/joystick/linux/SDL_sysjoystick.c
@@ -727,7 +727,7 @@ ConfigJoystick(SDL_Joystick * joystick, int fd)
                        absinfo.value, absinfo.minimum, absinfo.maximum,
                        absinfo.fuzz, absinfo.flat);
 #endif /* DEBUG_INPUT_EVENTS */
-                joystick->hwdata->hats_indices[joystick->nhats++] = hat_index;
+                joystick->hwdata->hats_indices[hat_index] = joystick->nhats++;
             }
         }
         if (test_bit(REL_X, relbit) || test_bit(REL_Y, relbit)) {