mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-24 18:10:06 +01:00
evdev: a device without any seat caps is an unhandled device
If we don't have any caps, assume the device is unhandled and ignore it. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
84fda690bd
commit
4058c43579
2 changed files with 26 additions and 5 deletions
|
|
@ -2234,11 +2234,8 @@ evdev_device_create(struct libinput_seat *seat,
|
|||
evdev_pre_configure_model_quirks(device);
|
||||
|
||||
device->dispatch = evdev_configure_device(device);
|
||||
if (device->dispatch == NULL) {
|
||||
if (device->seat_caps == 0)
|
||||
unhandled_device = 1;
|
||||
if (device->dispatch == NULL || device->seat_caps == 0)
|
||||
goto err;
|
||||
}
|
||||
|
||||
device->source =
|
||||
libinput_add_fd(libinput, fd, evdev_device_dispatch, device);
|
||||
|
|
@ -2256,8 +2253,10 @@ evdev_device_create(struct libinput_seat *seat,
|
|||
|
||||
err:
|
||||
close_restricted(libinput, fd);
|
||||
if (device)
|
||||
if (device) {
|
||||
unhandled_device = device->seat_caps == 0;
|
||||
evdev_device_destroy(device);
|
||||
}
|
||||
|
||||
return unhandled_device ? EVDEV_UNHANDLED_DEVICE : NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1472,6 +1472,27 @@ START_TEST(device_capability_check_invalid)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(device_capability_nocaps_ignored)
|
||||
{
|
||||
struct libevdev_uinput *uinput;
|
||||
struct libinput *li;
|
||||
struct libinput_device *device;
|
||||
|
||||
/* SW_MAX isn't handled in libinput so the device is processed but
|
||||
* ends up without seat capabilities and is ignored. */
|
||||
uinput = litest_create_uinput_device("test device", NULL,
|
||||
EV_SW, SW_MAX,
|
||||
-1);
|
||||
li = litest_create_context();
|
||||
device = libinput_path_add_device(li,
|
||||
libevdev_uinput_get_devnode(uinput));
|
||||
litest_assert_ptr_null(device);
|
||||
|
||||
libinput_unref(li);
|
||||
libevdev_uinput_destroy(uinput);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(device_has_size)
|
||||
{
|
||||
struct litest_device *dev = litest_current_device();
|
||||
|
|
@ -1667,6 +1688,7 @@ TEST_COLLECTION(device)
|
|||
|
||||
litest_add("device:capability", device_capability_at_least_one, LITEST_ANY, LITEST_ANY);
|
||||
litest_add("device:capability", device_capability_check_invalid, LITEST_ANY, LITEST_ANY);
|
||||
litest_add_no_device("device:capability", device_capability_nocaps_ignored);
|
||||
|
||||
litest_add("device:size", device_has_size, LITEST_TOUCHPAD, LITEST_ANY);
|
||||
litest_add("device:size", device_has_size, LITEST_TABLET, LITEST_ANY);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue