summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-10-31 10:53:53 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-12-03 09:09:39 +1000
commit8b7ef91c1a190fcd8363b0e128520f8d24de4bde (patch)
treebaaa38d28c623df80f301bcac04ba2844cbe1531 /test
parent3c7e3a19735b64eaa7937035d026b62c5fccbf5c (diff)
downloadlibinput-8b7ef91c1a190fcd8363b0e128520f8d24de4bde.tar.gz
Add a function to retrieve the udev_device handle from a libinput device
The libinput device abstracts a number of things but sometimes the underlying device is important. The udev device provides the necessary handle to access that underlying device and various sysfs properties that may be necessary. A function returning the device node would've done the same thing but is more prone to race conditions than the udev_device. https://bugs.freedesktop.org/show_bug.cgi?id=85573 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/device.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/device.c b/test/device.c
index 6843824a..84984f4c 100644
--- a/test/device.c
+++ b/test/device.c
@@ -618,6 +618,17 @@ START_TEST(device_ids)
}
END_TEST
+START_TEST(device_get_udev_handle)
+{
+ struct litest_device *dev = litest_current_device();
+ struct udev_device *udev_device;
+
+ udev_device = libinput_device_get_udev_device(dev->libinput_device);
+ ck_assert_notnull(udev_device);
+ udev_device_unref(udev_device);
+}
+END_TEST
+
int main (int argc, char **argv)
{
litest_add("device:sendevents", device_sendevents_config, LITEST_ANY, LITEST_TOUCHPAD);
@@ -640,5 +651,7 @@ int main (int argc, char **argv)
litest_add("device:sendevents", device_disable_topsoftbutton, LITEST_TOPBUTTONPAD, LITEST_ANY);
litest_add("device:id", device_ids, LITEST_ANY, LITEST_ANY);
+ litest_add("device:udev", device_get_udev_handle, LITEST_ANY, LITEST_ANY);
+
return litest_run(argc, argv);
}