<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 1, 2016 at 6:19 PM, Peter Hutterer <span dir="ltr"><<a href="mailto:peter.hutterer@who-t.net" target="_blank">peter.hutterer@who-t.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">A joystick has ID_INPUT_JOYSTICK *and* ID_INPUT set, so we need to check for<br>
both.<br>
<br>
<a href="https://bugs.freedesktop.org/show_bug.cgi?id=98009" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=98009</a><br>
<br>
Signed-off-by: Peter Hutterer <<a href="mailto:peter.hutterer@who-t.net">peter.hutterer@who-t.net</a>><br>
---<br>
src/evdev.c | 2 +-<br>
test/device.c | 34 ++++++++++++++++++++++++++++++<wbr>++++<br>
2 files changed, 35 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/evdev.c b/src/evdev.c<br>
index d49b391..b7396f3 100644<br>
--- a/src/evdev.c<br>
+++ b/src/evdev.c<br>
@@ -2468,7 +2468,7 @@ evdev_configure_device(struct evdev_device *device)<br>
<br>
/* libwacom *adds* TABLET, TOUCHPAD but leaves JOYSTICK in place, so<br>
make sure we only ignore real joystick devices */<br>
- if ((udev_tags & EVDEV_UDEV_TAG_JOYSTICK) == udev_tags) {<br>
+ if ((udev_tags & (EVDEV_UDEV_TAG_INPUT|EVDEV_<wbr>UDEV_TAG_JOYSTICK)) == udev_tags) {<br></blockquote><div><br></div><div>Shouldn't this just be "udev_tags == EVDEV_UDEV_TAG_INPUT|EVDEV_<wbr>UDEV_TAG_JOYSTICK"?</div><div><br></div><div>Otherwise, the check will succeed even if udev_tags is just EVDEV_UDEV_TAG_INPUT. (Assuming such devices exist, that is.)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
log_info(libinput,<br>
"input device '%s', %s is a joystick, ignoring\n",<br>
device->devname, devnode);<br>
diff --git a/test/device.c b/test/device.c<br>
index 4ed12d9..f44a988 100644<br>
--- a/test/device.c<br>
+++ b/test/device.c<br>
@@ -1058,6 +1058,39 @@ START_TEST(abs_mt_device_<wbr>missing_res)<br>
}<br>
END_TEST<br>
<br>
+START_TEST(ignore_joystick)<br>
+{<br>
+ struct libinput *li;<br>
+ struct libevdev_uinput *uinput;<br>
+ struct libinput_device *device;<br>
+ struct input_absinfo absinfo[] = {<br>
+ { ABS_X, 0, 10, 0, 0, 10 },<br>
+ { ABS_Y, 0, 10, 0, 0, 10 },<br>
+ { ABS_RX, 0, 10, 0, 0, 10 },<br>
+ { ABS_RY, 0, 10, 0, 0, 10 },<br>
+ { ABS_THROTTLE, 0, 2, 0, 0, 0 },<br>
+ { ABS_RUDDER, 0, 255, 0, 0, 0 },<br>
+ { -1, -1, -1, -1, -1, -1 }<br>
+ };<br>
+<br>
+ li = litest_create_context();<br>
+ litest_disable_log_handler(li)<wbr>;<br>
+ litest_drain_events(li);<br>
+<br>
+ uinput = litest_create_uinput_abs_<wbr>device("joystick test device", NULL,<br>
+ absinfo,<br>
+ EV_KEY, BTN_TRIGGER,<br>
+ EV_KEY, BTN_A,<br>
+ -1);<br>
+ device = libinput_path_add_device(li,<br>
+ libevdev_uinput_get_devnode(<wbr>uinput));<br>
+ litest_assert_ptr_null(device)<wbr>;<br>
+ libevdev_uinput_destroy(<wbr>uinput);<br>
+ litest_restore_log_handler(li)<wbr>;<br>
+ libinput_unref(li);<br>
+}<br>
+END_TEST<br>
+<br>
START_TEST(device_wheel_only)<br>
{<br>
struct litest_device *dev = litest_current_device();<br>
@@ -1464,6 +1497,7 @@ litest_setup_tests_device(<wbr>void)<br>
litest_add_ranged_no_device("<wbr>device:invalid devices", abs_mt_device_no_range, &abs_mt_range);<br>
litest_add_no_device("device:<wbr>invalid devices", abs_device_missing_res);<br>
litest_add_no_device("device:<wbr>invalid devices", abs_mt_device_missing_res);<br>
+ litest_add_no_device("device:<wbr>invalid devices", ignore_joystick);<br>
<br>
litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_<wbr>ABSOLUTE|LITEST_TABLET);<br>
litest_add_no_device("device:<wbr>accelerometer", device_accelerometer);<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/wayland-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div></div>