[PATCH libinput 3/4] test: use the udev property to check for external/internal touchpads

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 20 02:51:03 UTC 2016


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/device.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/test/device.c b/test/device.c
index f44a988..af39508 100644
--- a/test/device.c
+++ b/test/device.c
@@ -61,6 +61,22 @@ START_TEST(device_sendevents_config_invalid)
 }
 END_TEST
 
+static inline bool
+touchpad_is_external(struct litest_device *dev)
+{
+	struct udev_device *udev_device;
+	const char *prop;
+	bool is_external;
+
+	udev_device = libinput_device_get_udev_device(dev->libinput_device);
+	prop = udev_device_get_property_value(udev_device,
+					      "ID_INPUT_TOUCHPAD_INTEGRATION");
+	is_external = prop && streq(prop, "external");
+	udev_device_unref(udev_device);
+
+	return is_external;
+}
+
 START_TEST(device_sendevents_config_touchpad)
 {
 	struct litest_device *dev = litest_current_device();
@@ -71,7 +87,7 @@ START_TEST(device_sendevents_config_touchpad)
 
 	/* The wacom devices in the test suite are external */
 	if (libevdev_get_id_vendor(dev->evdev) != VENDOR_ID_WACOM &&
-	    libevdev_get_id_bustype(dev->evdev) != BUS_BLUETOOTH)
+	    !touchpad_is_external(dev))
 		expected |=
 			LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE;
 
@@ -91,7 +107,7 @@ START_TEST(device_sendevents_config_touchpad_superset)
 
 	/* The wacom devices in the test suite are external */
 	if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_WACOM ||
-	    libevdev_get_id_bustype(dev->evdev) == BUS_BLUETOOTH)
+	    touchpad_is_external(dev))
 		return;
 
 	device = dev->libinput_device;
-- 
2.9.3



More information about the wayland-devel mailing list