summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-03-24 15:41:39 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-03-25 07:29:00 +1000
commitfc9f490a2c87e6f87b0f483cd6bf5f526dddbb8d (patch)
treeeb86a36271d9b6a400227fcc8ff4593e21fc5219
parent30866b97be6939b895327b930154ef758eed7ff8 (diff)
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> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/eventcomm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c
index cddf7fc..3a9d45d 100644
--- a/src/eventcomm.c
+++ b/src/eventcomm.c
@@ -325,6 +325,15 @@ event_query_is_touchpad(struct libevdev *evdev)
libevdev_has_event_code(evdev, EV_ABS, BTN_TOOL_PEN)) /* Don't match wacom tablets */
return FALSE;
+ if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT)) {
+ if (libevdev_get_num_slots(evdev) == -1)
+ return FALSE; /* 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))
+ return FALSE;
+ }
+
return TRUE;
}