Only sync the initial MT state for Protocol B devices
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 1 Apr 2014 05:12:56 +0000 (15:12 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 3 Apr 2014 02:08:54 +0000 (12:08 +1000)
For protocol A devices we won't get the information from the kernel anyway and
we expect all axes to be updated in the next event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
libevdev/libevdev.c

index 99e86a042ac3efc45d00ae0e1995bc394fbcd709..e2070d423e1e72842e352fe55f676f0ca93adbd6 100644 (file)
@@ -395,7 +395,9 @@ libevdev_set_fd(struct libevdev* dev, int fd)
        }
 
        dev->fd = fd;
-       sync_mt_state(dev, 0);
+       if (!libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT - 1) &&
+           libevdev_has_event_code(dev, EV_ABS, ABS_MT_SLOT))
+           sync_mt_state(dev, 0);
 
        rc = init_event_queue(dev);
        if (rc < 0) {