Ignore devices that have joystick buttons
authorKrzysztof A. Sobiecki <sobkas@gmail.com>
Tue, 25 Nov 2014 01:33:53 +0000 (02:33 +0100)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 25 Nov 2014 21:57:36 +0000 (07:57 +1000)
This patch allows libinput to ignore devices that have joystick buttons.

Signed-off-by: Krzysztof Sobiecki <sobkas@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev.c

index 908a8badd639994833a5075f4414e333ef78a303..baa1c5144e001b9e868a6e46e5a2a71c840952ec 100644 (file)
@@ -1266,6 +1266,15 @@ evdev_configure_device(struct evdev_device *device)
        has_keyboard = 0;
        has_touch = 0;
 
+        for (i = BTN_JOYSTICK; i < BTN_DIGI; i++) {
+                if (libevdev_has_event_code(evdev, EV_KEY, i)) {
+                        log_info(libinput,
+                                 "input device '%s', %s is a joystick, ignoring\n",
+                                 device->devname, devnode);
+                        return -1;
+                }
+        }
+
        if (libevdev_has_event_type(evdev, EV_ABS)) {
 
                if ((absinfo = libevdev_get_abs_info(evdev, ABS_X))) {