Tag synaptics serial touchpads with a LIBINPUT_MODEL tag
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 16 Jul 2015 06:05:48 +0000 (16:05 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 22 Jul 2015 03:53:09 +0000 (13:53 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hallelujah-expressed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev.c
src/evdev.h
src/libinput-util.h
test/device.c
udev/90-libinput-model-quirks.hwdb

index 1d328b4..78d1f5d 100644 (file)
@@ -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;
index 363f93b..6a71232 100644 (file)
@@ -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 {
index b18aece..e12374d 100644 (file)
@@ -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
index f43228c..59939d6 100644 (file)
@@ -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);
 }
index eec00b6..a34b8f1 100644 (file)
@@ -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
 ##########################################