summaryrefslogtreecommitdiff
path: root/libevdev/libevdev.c
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/libevdev.c
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/libevdev.c')
-rw-r--r--libevdev/libevdev.c5
1 files changed, 3 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);