From 07860e5db680cf570c4bdb2985d8e210841bb9e2 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 9 Feb 2017 09:43:54 +1000 Subject: [PATCH] path: parse the WL_OUTPUT property for patch devices too Signed-off-by: Peter Hutterer --- src/path-seat.c | 5 +++- test/litest-device-calibrated-touchscreen.c | 3 ++- test/test-device.c | 26 +++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/path-seat.c b/src/path-seat.c index 9102d306..274f3a6b 100644 --- a/src/path-seat.c +++ b/src/path-seat.c @@ -116,7 +116,7 @@ path_device_enable(struct path_input *input, struct path_seat *seat; struct evdev_device *device = NULL; char *seat_name = NULL, *seat_logical_name = NULL; - const char *seat_prop; + const char *seat_prop, *output_name; const char *devnode; devnode = udev_device_get_devnode(udev_device); @@ -169,6 +169,9 @@ path_device_enable(struct path_input *input, } evdev_read_calibration_prop(device); + output_name = udev_device_get_property_value(udev_device, "WL_OUTPUT"); + if (output_name) + device->output_name = strdup(output_name); out: free(seat_name); diff --git a/test/litest-device-calibrated-touchscreen.c b/test/litest-device-calibrated-touchscreen.c index db62d8b9..c750e86d 100644 --- a/test/litest-device-calibrated-touchscreen.c +++ b/test/litest-device-calibrated-touchscreen.c @@ -82,7 +82,8 @@ static const char udev_rule[] = "KERNEL!=\"event*\", GOTO=\"calibrated_touchscreen_end\"\n" "\n" "ATTRS{name}==\"litest Calibrated Touchscreen*\",\\\n" -" ENV{LIBINPUT_CALIBRATION_MATRIX}=\"1.2 3.4 5.6 7.8 9.10 11.12\"\n" +" ENV{LIBINPUT_CALIBRATION_MATRIX}=\"1.2 3.4 5.6 7.8 9.10 11.12\",\\\n" +" ENV{WL_OUTPUT}=\"myOutput\"\n" "\n" "LABEL=\"calibrated_touchscreen_end\""; diff --git a/test/test-device.c b/test/test-device.c index 8f06f7e4..d17dd37e 100644 --- a/test/test-device.c +++ b/test/test-device.c @@ -1549,6 +1549,28 @@ START_TEST(device_has_no_size) } END_TEST +START_TEST(device_get_output) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + const char *output_name; + + output_name = libinput_device_get_output_name(device); + ck_assert_str_eq(output_name, "myOutput"); +} +END_TEST + +START_TEST(device_no_output) +{ + struct litest_device *dev = litest_current_device(); + struct libinput_device *device = dev->libinput_device; + const char *output_name; + + output_name = libinput_device_get_output_name(device); + ck_assert(output_name == NULL); +} +END_TEST + void litest_setup_tests_device(void) { @@ -1622,4 +1644,8 @@ litest_setup_tests_device(void) litest_add("device:size", device_has_size, LITEST_TABLET, LITEST_ANY); litest_add("device:size", device_has_no_size, LITEST_ANY, LITEST_TOUCHPAD|LITEST_TABLET|LITEST_TOUCH|LITEST_ABSOLUTE|LITEST_SINGLE_TOUCH); + + litest_add_for_device("device:output", device_get_output, LITEST_CALIBRATED_TOUCHSCREEN); + litest_add("device:output", device_no_output, LITEST_RELATIVE, LITEST_ANY); + litest_add("device:output", device_no_output, LITEST_KEYS, LITEST_ANY); }