From 277151f3b57aebe23e8c5cedb5aec2fceceb9c31 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue, 24 Mar 2015 15:41:39 +1000
Subject: [PATCH synaptics] eventcomm: ignore fake and broken MT devices
An MT device without X/Y is not a touchpad. And neither are fake MT devices.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/eventcomm.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/eventcomm.c b/src/eventcomm.c
index 9e81b86..516dab3 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -320,6 +320,15 @@ event_query_is_touchpad(struct libevdev *evdev, BOOL test_grab)
libevdev_has_event_code(evdev, EV_ABS, BTN_TOOL_PEN)) /* Don't match wacom tablets */
goto unwind;
+ if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT)) {
+ if (libevdev_get_num_slots(evdev) == -1)
+ goto unwind; /* Ignore fake MT devices */
+
+ if (!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) ||
+ !libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y))
+ goto unwind;
+ }
+
ret = TRUE;
unwind:
--
2.3.2