Move apple touchpad tagging to the udev rules
authorPeter Hutterer <peter.hutterer@who-t.net>
Fri, 5 Jun 2015 00:13:56 +0000 (10:13 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 11 Jun 2015 22:53:57 +0000 (08:53 +1000)
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev-mt-touchpad.c
src/evdev.c
src/evdev.h
udev/90-libinput-model-quirks.hwdb
udev/90-libinput-model-quirks.rules

index 8c28ff79a79bb867e70c719522c920726ea430cd..5143ab16f9d42bac6bfaa327c9f9197b7f01a204 100644 (file)
@@ -1157,7 +1157,7 @@ evdev_tag_touchpad(struct evdev_device *device,
         */
        bustype = libevdev_get_id_bustype(device->evdev);
        if (bustype == BUS_USB) {
-               if (libevdev_get_id_vendor(device->evdev) == VENDOR_ID_APPLE)
+               if (device->model == EVDEV_MODEL_APPLE_TOUCHPAD)
                         device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
        } else if (bustype != BUS_BLUETOOTH)
                device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
@@ -1412,7 +1412,7 @@ tp_init_palmdetect(struct tp_dispatch *tp,
         * Apple touchpads are always big enough to warrant palm detection */
        if (vendor_id == VENDOR_ID_WACOM) {
                return 0;
-       } else if (vendor_id != VENDOR_ID_APPLE) {
+       } else if (device->model != EVDEV_MODEL_APPLE_TOUCHPAD) {
                /* We don't know how big the touchpad is */
                if (device->abs.absinfo_x->resolution == 1)
                        return 0;
index d6a2fff5067307d484af0b195d8279207e9d9c94..c1fe3e53a468678a5ddabe2b8297e2336e7660dd 100644 (file)
@@ -1513,6 +1513,7 @@ evdev_read_model(struct evdev_device *device)
                { "LIBINPUT_MODEL_SYSTEM76_GALAGO", EVDEV_MODEL_SYSTEM76_GALAGO },
                { "LIBINPUT_MODEL_SYSTEM76_KUDU", EVDEV_MODEL_SYSTEM76_KUDU },
                { "LIBINPUT_MODEL_CLEVO_W740SU", EVDEV_MODEL_CLEVO_W740SU },
+               { "LIBINPUT_MODEL_APPLE_TOUCHPAD", EVDEV_MODEL_APPLE_TOUCHPAD },
                { NULL, EVDEV_MODEL_DEFAULT },
        };
        const struct model_map *m = model_map;
index a8756635396cbd5078153da291e5decac1a61874..70a66a285e805b207c44c15c3f7443eb9f456aef 100644 (file)
@@ -103,6 +103,7 @@ enum evdev_device_model {
        EVDEV_MODEL_SYSTEM76_GALAGO,
        EVDEV_MODEL_SYSTEM76_KUDU,
        EVDEV_MODEL_CLEVO_W740SU,
+       EVDEV_MODEL_APPLE_TOUCHPAD,
 };
 
 struct mt_slot {
index 048e5cc6073c983a46a568dc742643ad632fa458..13ff51803649654c9aa4cc6124a8bb0688d444c7 100644 (file)
 #
 # Sort by brand, model
 
+##########################################
+# Apple
+##########################################
+libinput:touchpad:input:b0003v05ACp*
+libinput:touchpad:input:b0005v05ACp*
+ LIBINPUT_MODEL_APPLE_TOUCHPAD=1
+
 ##########################################
 # Google
 ##########################################
index 4b9887489bb2e59dbf447ba5e5d48c9664c2bcd3..79b9b36fd851a6af1d142799a4791d49bcfe080c 100644 (file)
@@ -13,8 +13,9 @@ KERNEL!="event*", GOTO="libinput_model_quirks_end"
 
 # hwdb matches:
 # 
-# libinput:<modalias>
-IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:", \
+# libinput:touchpad:<modalias>
+ENV{ID_INPUT_TOUCHPAD}=="1", \
+  IMPORT{builtin}="hwdb --subsystem=input --lookup-prefix=libinput:touchpad:", \
   GOTO="libinput_model_quirks_end"
 
 # libinput:name:<name>:dmi:<dmi string>
@@ -22,4 +23,5 @@ KERNELS=="input*", \
   IMPORT{builtin}="hwdb 'libinput:name:$attr{name}:$attr{[dmi/id]modalias}'", \
   GOTO="libinput_model_quirks_end"
 
+
 LABEL="libinput_model_quirks_end"