A joystick has ID_INPUT_JOYSTICK *and* ID_INPUT set, so we need to check for both.
https://bugs.freedesktop.org/show_bug.cgi?id=98009 Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> --- Changes to v1: - fix bug with previous version where a device with just ID_INPUT set would be detected as joystick (though in hindsight this wouldn't have been an issue as we filter those out early anyway) src/evdev.c | 2 +- test/device.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/evdev.c b/src/evdev.c index d49b391..f423251 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -2468,7 +2468,7 @@ evdev_configure_device(struct evdev_device *device) /* libwacom *adds* TABLET, TOUCHPAD but leaves JOYSTICK in place, so make sure we only ignore real joystick devices */ - if ((udev_tags & EVDEV_UDEV_TAG_JOYSTICK) == udev_tags) { + if (udev_tags == (EVDEV_UDEV_TAG_INPUT|EVDEV_UDEV_TAG_JOYSTICK)) { log_info(libinput, "input device '%s', %s is a joystick, ignoring\n", device->devname, devnode); diff --git a/test/device.c b/test/device.c index 4ed12d9..f44a988 100644 --- a/test/device.c +++ b/test/device.c @@ -1058,6 +1058,39 @@ START_TEST(abs_mt_device_missing_res) } END_TEST +START_TEST(ignore_joystick) +{ + struct libinput *li; + struct libevdev_uinput *uinput; + struct libinput_device *device; + struct input_absinfo absinfo[] = { + { ABS_X, 0, 10, 0, 0, 10 }, + { ABS_Y, 0, 10, 0, 0, 10 }, + { ABS_RX, 0, 10, 0, 0, 10 }, + { ABS_RY, 0, 10, 0, 0, 10 }, + { ABS_THROTTLE, 0, 2, 0, 0, 0 }, + { ABS_RUDDER, 0, 255, 0, 0, 0 }, + { -1, -1, -1, -1, -1, -1 } + }; + + li = litest_create_context(); + litest_disable_log_handler(li); + litest_drain_events(li); + + uinput = litest_create_uinput_abs_device("joystick test device", NULL, + absinfo, + EV_KEY, BTN_TRIGGER, + EV_KEY, BTN_A, + -1); + device = libinput_path_add_device(li, + libevdev_uinput_get_devnode(uinput)); + litest_assert_ptr_null(device); + libevdev_uinput_destroy(uinput); + litest_restore_log_handler(li); + libinput_unref(li); +} +END_TEST + START_TEST(device_wheel_only) { struct litest_device *dev = litest_current_device(); @@ -1464,6 +1497,7 @@ litest_setup_tests_device(void) litest_add_ranged_no_device("device:invalid devices", abs_mt_device_no_range, &abs_mt_range); litest_add_no_device("device:invalid devices", abs_device_missing_res); litest_add_no_device("device:invalid devices", abs_mt_device_missing_res); + litest_add_no_device("device:invalid devices", ignore_joystick); litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_ABSOLUTE|LITEST_TABLET); litest_add_no_device("device:accelerometer", device_accelerometer); -- 2.9.3 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel