mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-02 07:30:11 +01:00
evdev: ignore accelerometer devices
https://bugs.freedesktop.org/show_bug.cgi?id=91563 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
6a0f9411f2
commit
f0fa590394
2 changed files with 36 additions and 0 deletions
|
|
@ -1917,6 +1917,13 @@ evdev_configure_device(struct evdev_device *device)
|
|||
udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER ? " Accelerometer" : "",
|
||||
udev_tags & EVDEV_UDEV_TAG_BUTTONSET ? " Buttonset" : "");
|
||||
|
||||
if (udev_tags & EVDEV_UDEV_TAG_ACCELEROMETER) {
|
||||
log_info(libinput,
|
||||
"input device '%s', %s is an accelerometer, ignoring\n",
|
||||
device->devname, devnode);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
|
|
|
|||
|
|
@ -949,6 +949,34 @@ START_TEST(device_wheel_only)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(device_accelerometer)
|
||||
{
|
||||
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_Z, 0, 10, 0, 0, 10 },
|
||||
{ -1, -1, -1, -1, -1, -1 }
|
||||
};
|
||||
|
||||
li = litest_create_context();
|
||||
litest_disable_log_handler(li);
|
||||
|
||||
uinput = litest_create_uinput_abs_device("test device", NULL,
|
||||
absinfo,
|
||||
-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_udev_tag_alps)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -1222,6 +1250,7 @@ litest_setup_tests(void)
|
|||
litest_add_no_device("device:invalid devices", abs_mt_device_missing_res);
|
||||
|
||||
litest_add("device:wheel", device_wheel_only, LITEST_WHEEL, LITEST_RELATIVE|LITEST_ABSOLUTE);
|
||||
litest_add_no_device("device:accelerometer", device_accelerometer);
|
||||
|
||||
litest_add("device:udev tags", device_udev_tag_alps, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("device:udev tags", device_udev_tag_wacom, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue