summaryrefslogtreecommitdiff
path: root/libevdev
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2014-03-05 13:15:20 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2014-03-06 14:30:03 +1000
commit12ff51b8710aca9640caacf02a941ec8ff234348 (patch)
tree981c4b4cdf7e8ea505eb117165b9eff2bb6f2975 /libevdev
parent68a297577aed60bb81afc5e8bcfe0e3d2e95185f (diff)
downloadlibevdev-12ff51b8710aca9640caacf02a941ec8ff234348.tar.gz
Don't sync the MT state for fake MT devices
Devices with ABS_MT_SLOT-1 are fake MT devices, they merely overlap the axis range but don't actually provide slots. The EVIOCGABS ioctl won't work to retrieve the current value - the kernel does not store values for those axes and the return value is always 0. Thus, simply ignore those axes for fake MT devices and instead rely on the next event to update the caller with the correct state for each axis. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Diffstat (limited to 'libevdev')
-rw-r--r--libevdev/libevdev.c5
-rw-r--r--libevdev/libevdev.h6
2 files changed, 9 insertions, 2 deletions
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index d9e2517..7ba4629 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -662,8 +662,9 @@ sync_state(struct libevdev *dev)
rc = sync_sw_state(dev);
if (rc == 0 && libevdev_has_event_type(dev, EV_ABS))
rc = sync_abs_state(dev);
- if (rc == 0 && libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT))
- rc = sync_mt_state(dev, 1);
+ if (rc == 0 && dev->num_slots > -1 &&
+ libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT))
+ rc = sync_mt_state(dev, 1);
dev->queue_nsync = queue_num_elements(dev);
diff --git a/libevdev/libevdev.h b/libevdev/libevdev.h
index 1855cd3..6920a76 100644
--- a/libevdev/libevdev.h
+++ b/libevdev/libevdev.h
@@ -377,6 +377,12 @@ extern "C" {
* device is not treated as multitouch device. No slot information is
* available and the ABS_MT axis range for these devices is treated as all
* other EV_ABS axes.
+ *
+ * Note that because of limitations in the kernel API, such fake multitouch
+ * devices can not be reliably synched after a SYN_DROPPED event. libevdev
+ * ignores all ABS_MT axis values during the sync process and instead
+ * relies on the device to send the current axis value with the first event
+ * after SYN_DROPPED.
*/
/**