Currently this means start with "event" and don't contain /. Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> --- test/path.c | 23 +++++++++++++++++++++++ test/udev.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+)
diff --git a/test/path.c b/test/path.c index 12787f6..875cd88 100644 --- a/test/path.c +++ b/test/path.c @@ -187,6 +187,28 @@ START_TEST(path_added_device) } END_TEST +START_TEST(path_device_sysname) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_event *ev; + struct libinput_device *device; + const char *sysname; + + libinput_dispatch(dev->libinput); + + while ((ev = libinput_get_event(dev->libinput))) { + if (libinput_event_get_type(ev) != LIBINPUT_EVENT_DEVICE_ADDED) + continue; + + device = libinput_event_get_device(ev); + sysname = libinput_device_get_sysname(device); + ck_assert(sysname != NULL && strlen(sysname) > 1); + ck_assert(strchr(sysname, '/') == NULL); + ck_assert_int_eq(strncmp(sysname, "event", 5), 0); + } +} +END_TEST + START_TEST(path_suspend) { struct libinput *li; @@ -304,6 +326,7 @@ int main (int argc, char **argv) { litest_add("path:suspend", path_double_resume, LITEST_ANY, LITEST_ANY); litest_add("path:seat events", path_added_seat, LITEST_ANY, LITEST_ANY); litest_add("path:device events", path_added_device, LITEST_ANY, LITEST_ANY); + litest_add("path:device events", path_device_sysname, LITEST_ANY, LITEST_ANY); return litest_run(argc, argv); } diff --git a/test/udev.c b/test/udev.c index f61dd24..235d10e 100644 --- a/test/udev.c +++ b/test/udev.c @@ -294,6 +294,39 @@ START_TEST(udev_suspend_resume) } END_TEST +START_TEST(udev_device_sysname) +{ + struct libinput *li; + struct libinput_event *ev; + struct libinput_device *device; + const char *sysname; + struct udev *udev; + + udev = udev_new(); + ck_assert(udev != NULL); + + li = libinput_create_from_udev(&simple_interface, NULL, udev, "seat0"); + ck_assert(li != NULL); + + libinput_dispatch(li); + + while ((ev = libinput_get_event(li))) { + if (libinput_event_get_type(ev) != LIBINPUT_EVENT_DEVICE_ADDED) + continue; + + device = libinput_event_get_device(ev); + sysname = libinput_device_get_sysname(device); + ck_assert(sysname != NULL && strlen(sysname) > 1); + ck_assert(strchr(sysname, '/') == NULL); + ck_assert_int_eq(strncmp(sysname, "event", 5), 0); + libinput_event_destroy(ev); + } + + libinput_destroy(li); + udev_unref(udev); +} +END_TEST + int main (int argc, char **argv) { litest_add_no_device("udev:create", udev_create_NULL); @@ -305,6 +338,7 @@ int main (int argc, char **argv) { litest_add("udev:suspend", udev_double_suspend, LITEST_ANY, LITEST_ANY); litest_add("udev:suspend", udev_double_resume, LITEST_ANY, LITEST_ANY); litest_add("udev:suspend", udev_suspend_resume, LITEST_ANY, LITEST_ANY); + litest_add("udev:device events", udev_device_sysname, LITEST_ANY, LITEST_ANY); return litest_run(argc, argv); } -- 1.8.4.2 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel