[PATCH libinput 5/6] touchpad: elantech touchpads can use a 2mm gesture motion threshold

Peter Hutterer peter.hutterer at who-t.net
Wed Jul 29 23:11:56 PDT 2015


Unlike ALPS and Synaptics semi-mt touchpads, the Elantech touchpads appear to
be precise enough to allow a smaller motion threshold before we decide on the
type of gesture (pinch vs scroll).

https://bugs.freedesktop.org/show_bug.cgi?id=91475

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

diff --git a/src/evdev-mt-touchpad-gestures.c b/src/evdev-mt-touchpad-gestures.c
index 1482136..6017416 100644
--- a/src/evdev-mt-touchpad-gestures.c
+++ b/src/evdev-mt-touchpad-gestures.c
@@ -189,8 +189,10 @@ tp_gesture_get_direction(struct tp_dispatch *tp, struct tp_touch *touch)
 	/*
 	 * Semi-mt touchpads have somewhat inaccurate coordinates when
 	 * 2 fingers are down, so use a slightly larger threshold.
+	 * Elantech semi-mt touchpads are accurate enough though.
 	 */
-	if (tp->semi_mt)
+	if (tp->semi_mt &&
+	    (tp->device->model_flags & EVDEV_MODEL_ELANTECH_TOUCHPAD) == 0)
 		move_threshold = TP_MM_TO_DPI_NORMALIZED(4);
 	else
 		move_threshold = TP_MM_TO_DPI_NORMALIZED(2);
diff --git a/src/evdev.c b/src/evdev.c
index aba124b..17c2604 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1543,6 +1543,7 @@ evdev_read_model_flags(struct evdev_device *device)
 		{ "LIBINPUT_MODEL_ALPS_TOUCHPAD", EVDEV_MODEL_ALPS_TOUCHPAD },
 		{ "LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD", EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD },
 		{ "LIBINPUT_MODEL_JUMPING_SEMI_MT", EVDEV_MODEL_JUMPING_SEMI_MT },
+		{ "LIBINPUT_MODEL_ELANTECH_TOUCHPAD", EVDEV_MODEL_ELANTECH_TOUCHPAD },
 		{ NULL, EVDEV_MODEL_DEFAULT },
 	};
 	const struct model_map *m = model_map;
diff --git a/src/evdev.h b/src/evdev.h
index c7017ba..be5df0d 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -106,6 +106,7 @@ enum evdev_device_model {
 	EVDEV_MODEL_ALPS_TOUCHPAD = (1 << 8),
 	EVDEV_MODEL_SYNAPTICS_SERIAL_TOUCHPAD = (1 << 9),
 	EVDEV_MODEL_JUMPING_SEMI_MT = (1 << 10),
+	EVDEV_MODEL_ELANTECH_TOUCHPAD = (1 << 11),
 };
 
 struct mt_slot {
diff --git a/udev/90-libinput-model-quirks.hwdb b/udev/90-libinput-model-quirks.hwdb
index a34b8f1..cf4fbfa 100644
--- a/udev/90-libinput-model-quirks.hwdb
+++ b/udev/90-libinput-model-quirks.hwdb
@@ -39,6 +39,7 @@ libinput:touchpad:input:b0005v05ACp*
 ##########################################
 libinput:name:*ETPS/2 Elantech Touchpad*:dmi:*
  LIBINPUT_ATTR_RESOLUTION_HINT=31x31
+ LIBINPUT_MODEL_ELANTECH_TOUCHPAD=1
 
 ##########################################
 # Google
-- 
2.4.3



More information about the wayland-devel mailing list