src/joystick/linux/SDL_sysjoystick.c
changeset 10641 ae818421bb1f
parent 10617 346c02ff71b6
child 10737 3406a0f8b041
     1.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Tue Nov 22 04:42:07 2016 -0800
     1.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Tue Nov 22 22:14:28 2016 -0800
     1.3 @@ -449,16 +449,16 @@
     1.4  #ifdef DEBUG_INPUT_EVENTS
     1.5                  printf("Joystick has button: 0x%x\n", i);
     1.6  #endif
     1.7 -                joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons;
     1.8 +                joystick->hwdata->key_map[i] = joystick->nbuttons;
     1.9                  ++joystick->nbuttons;
    1.10              }
    1.11          }
    1.12 -        for (i = BTN_MISC; i < BTN_JOYSTICK; ++i) {
    1.13 +        for (i = 0; i < BTN_JOYSTICK; ++i) {
    1.14              if (test_bit(i, keybit)) {
    1.15  #ifdef DEBUG_INPUT_EVENTS
    1.16                  printf("Joystick has button: 0x%x\n", i);
    1.17  #endif
    1.18 -                joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons;
    1.19 +                joystick->hwdata->key_map[i] = joystick->nbuttons;
    1.20                  ++joystick->nbuttons;
    1.21              }
    1.22          }
    1.23 @@ -715,12 +715,9 @@
    1.24              code = events[i].code;
    1.25              switch (events[i].type) {
    1.26              case EV_KEY:
    1.27 -                if (code >= BTN_MISC) {
    1.28 -                    code -= BTN_MISC;
    1.29 -                    SDL_PrivateJoystickButton(joystick,
    1.30 -                                              joystick->hwdata->key_map[code],
    1.31 -                                              events[i].value);
    1.32 -                }
    1.33 +                SDL_PrivateJoystickButton(joystick,
    1.34 +                                          joystick->hwdata->key_map[code],
    1.35 +                                          events[i].value);
    1.36                  break;
    1.37              case EV_ABS:
    1.38                  switch (code) {