Fixed detecting the NVIDIA controller which shows up as both a mouse and a game controller
authorSam Lantinga <slouken@libsdl.org>
Wed, 01 Apr 2015 19:18:56 -0700
changeset 9454bdc0c1dda0a4
parent 9453 49a34578d9e7
child 9455 b452e37e26d9
Fixed detecting the NVIDIA controller which shows up as both a mouse and a game controller
src/core/linux/SDL_udev.c
     1.1 --- a/src/core/linux/SDL_udev.c	Thu Apr 02 00:55:45 2015 +0200
     1.2 +++ b/src/core/linux/SDL_udev.c	Wed Apr 01 19:18:56 2015 -0700
     1.3 @@ -350,17 +350,19 @@
     1.4              devclass |= SDL_UDEV_DEVICE_MOUSE; /* ID_INPUT_MOUSE */
     1.5          } else if (test_bit(BTN_TOUCH, bitmask_key)) {
     1.6              ; /* ID_INPUT_TOUCHSCREEN */
     1.7 -        } else if (test_bit(BTN_TRIGGER, bitmask_key) ||
     1.8 -                 test_bit(BTN_A, bitmask_key) ||
     1.9 -                 test_bit(BTN_1, bitmask_key) ||
    1.10 -                 test_bit(ABS_RX, bitmask_abs) ||
    1.11 -                 test_bit(ABS_RY, bitmask_abs) ||
    1.12 -                 test_bit(ABS_RZ, bitmask_abs) ||
    1.13 -                 test_bit(ABS_THROTTLE, bitmask_abs) ||
    1.14 -                 test_bit(ABS_RUDDER, bitmask_abs) ||
    1.15 -                 test_bit(ABS_WHEEL, bitmask_abs) ||
    1.16 -                 test_bit(ABS_GAS, bitmask_abs) ||
    1.17 -                 test_bit(ABS_BRAKE, bitmask_abs)) {
    1.18 +        }
    1.19 +
    1.20 +        if (test_bit(BTN_TRIGGER, bitmask_key) ||
    1.21 +            test_bit(BTN_A, bitmask_key) ||
    1.22 +            test_bit(BTN_1, bitmask_key) ||
    1.23 +            test_bit(ABS_RX, bitmask_abs) ||
    1.24 +            test_bit(ABS_RY, bitmask_abs) ||
    1.25 +            test_bit(ABS_RZ, bitmask_abs) ||
    1.26 +            test_bit(ABS_THROTTLE, bitmask_abs) ||
    1.27 +            test_bit(ABS_RUDDER, bitmask_abs) ||
    1.28 +            test_bit(ABS_WHEEL, bitmask_abs) ||
    1.29 +            test_bit(ABS_GAS, bitmask_abs) ||
    1.30 +            test_bit(ABS_BRAKE, bitmask_abs)) {
    1.31              devclass |= SDL_UDEV_DEVICE_JOYSTICK; /* ID_INPUT_JOYSTICK */
    1.32          }
    1.33      }