[PATCH libinput 3/4] Move apple touchpad tagging to the udev rules

Peter Hutterer peter.hutterer at who-t.net
Thu Jun 4 23:41:31 PDT 2015


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad.c             | 4 ++--
 src/evdev.c                         | 1 +
 src/evdev.h                         | 1 +
 udev/90-libinput-model-quirks.hwdb  | 7 +++++++
 udev/90-libinput-model-quirks.rules | 6 ++++--
 5 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 0154e89..f60265d 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -1150,7 +1150,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;
@@ -1405,7 +1405,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;
diff --git a/src/evdev.c b/src/evdev.c
index d6a2fff..c1fe3e5 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -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;
diff --git a/src/evdev.h b/src/evdev.h
index a875663..70a66a2 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -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 {
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index 048e5cc..13ff518 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -16,6 +16,13 @@
 # Sort by brand, model
 
 ##########################################
+# Apple
+##########################################
+libinput:touchpad:input:b0003v05ACp*
+libinput:touchpad:input:b0005v05ACp*
+ LIBINPUT_MODEL_APPLE_TOUCHPAD=1
+
+##########################################
 # Google
 ##########################################
 
diff --git a/udev/90-libinput-model-quirks.rules b/udev/90-libinput-model-quirks.rules
index 4b98874..5f8ba56 100644
--- a/udev/90-libinput-model-quirks.rules
+++ b/udev/90-libinput-model-quirks.rules
@@ -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"
-- 
2.4.1



More information about the wayland-devel mailing list