[PATCH libinput 2/4] Tag synaptics serial touchpads with a LIBINPUT_MODEL tag

Peter Hutterer peter.hutterer at who-t.net
Mon Jul 20 22:51:02 PDT 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.c                        |  1 +
 src/evdev.h                        |  1 +
 src/libinput-util.h                |  2 ++
 test/device.c                      | 23 +++++++++++++++++++++++
 udev/90-libinput-model-quirks.hwdb |  6 ++++++
 5 files changed, 33 insertions(+)

diff --git a/src/evdev.c b/src/evdev.c
index 1d328b4..78d1f5d 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1541,6 +1541,7 @@ evdev_read_model_flags(struct evdev_device *device)
 		{ "LIBINPUT_MODEL_APPLE_TOUCHPAD", EVDEV_MODEL_APPLE_TOUCHPAD },
 		{ "LIBINPUT_MODEL_WACOM_TOUCHPAD", EVDEV_MODEL_WACOM_TOUCHPAD },
 		{ "LIBINPUT_MODEL_ALPS_TOUCHPAD", EVDEV_MODEL_ALPS_TOUCHPAD },
+		{ "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD", EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD },
 		{ NULL, EVDEV_MODEL_DEFAULT },
 	};
 	const struct model_map *m = model_map;
diff --git a/src/evdev.h b/src/evdev.h
index 363f93b..6a71232 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -105,6 +105,7 @@ enum evdev_device_model {
 	EVDEV_MODEL_APPLE_TOUCHPAD = (1 << 6),
 	EVDEV_MODEL_WACOM_TOUCHPAD = (1 << 7),
 	EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8),
+	EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD = (1 << 9),
 };
 
 struct mt_slot {
diff --git a/src/libinput-util.h b/src/libinput-util.h
index b18aece..e12374d 100644
--- a/src/libinput-util.h
+++ b/src/libinput-util.h
@@ -37,6 +37,8 @@
 
 #define VENDOR_ID_APPLE 0x5ac
 #define VENDOR_ID_WACOM 0x56a
+#define VENDOR_ID_SYNAPTICS_SERIAL 0x002
+#define PRODUCT_ID_SYNAPTICS_SERIAL 0x007
 
 /* The HW DPI rate we normalize to before calculating pointer acceleration */
 #define DEFAULT_MOUSE_DPI 1000
diff --git a/test/device.c b/test/device.c
index f43228c..59939d6 100644
--- a/test/device.c
+++ b/test/device.c
@@ -1008,6 +1008,28 @@ START_TEST(device_udev_tag_apple)
 	udev_device_unref(d);
 }
 END_TEST
+
+START_TEST(device_udev_tag_synaptics_serial)
+{
+	struct litest_device *dev = litest_current_device();
+	struct libinput_device *device = dev->libinput_device;
+	struct udev_device *d;
+	const char *prop;
+
+	d = libinput_device_get_udev_device(device);
+	prop = udev_device_get_property_value(d,
+					      "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD");
+
+	if (libevdev_get_id_vendor(dev->evdev) == VENDOR_ID_SYNAPTICS_SERIAL &&
+	    libevdev_get_id_product(dev->evdev) == PRODUCT_ID_SYNAPTICS_SERIAL)
+		ck_assert_notnull(prop);
+	else
+		ck_assert(prop == NULL);
+
+	udev_device_unref(d);
+}
+END_TEST
+
 void
 litest_setup_tests(void)
 {
@@ -1054,4 +1076,5 @@ litest_setup_tests(void)
 	litest_add("device:udev tags", device_udev_tag_alps, LITEST_TOUCHPAD, LITEST_ANY);
 	litest_add("device:udev tags", device_udev_tag_wacom, LITEST_TOUCHPAD, LITEST_ANY);
 	litest_add("device:udev tags", device_udev_tag_apple, LITEST_TOUCHPAD, LITEST_ANY);
+	litest_add("device:udev tags", device_udev_tag_synaptics_serial, LITEST_TOUCHPAD, LITEST_ANY);
 }
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index eec00b6..a34b8f1 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -71,6 +71,12 @@ libinput:name:SynPS/2 Synaptics TouchPad:dmi:*svnLENOVO:*:pvrThinkPadX230*
  LIBINPUT_MODEL_LENOVO_X230=1
 
 ##########################################
+# Synaptics
+##########################################
+libinput:touchpad:input:b0011v0002p0007*
+ LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD=1
+
+##########################################
 # System76
 ##########################################
 
-- 
2.4.3



More information about the wayland-devel mailing list