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 8c28ff7..5143ab1 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 d6a2fff..c1fe3e5 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 a875663..70a66a2 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 048e5cc..13ff518 100644 (file)
 # Sort by brand, model
 
 ##########################################
+# Apple
+##########################################
+libinput:touchpad:input:b0003v05ACp*
+libinput:touchpad:input:b0005v05ACp*
+ LIBINPUT_MODEL_APPLE_TOUCHPAD=1
+
+##########################################
 # Google
 ##########################################
 
index 4b98874..79b9b36 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"