evdev: set CLOCK_MONOTONIC as the time source
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 18 Feb 2014 22:45:57 +0000 (08:45 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Tue, 25 Feb 2014 04:31:22 +0000 (14:31 +1000)
Avoids erroneous timestamps when the system time is reset. This used to a be a
problem with the X.Org synaptics driver where taps, scrolling and a couple of
other things would potentially lock up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev.c

index 88254cc646beddf9ba1f2cef06d1f4bafc1ccf63..cb49f22e788b4566b70a90cae51028da8c00d462 100644 (file)
@@ -31,6 +31,7 @@
 #include <fcntl.h>
 #include <mtdev-plumbing.h>
 #include <assert.h>
+#include <time.h>
 
 #include "libinput.h"
 #include "evdev.h"
@@ -640,6 +641,8 @@ evdev_device_create(struct libinput_seat *seat,
        if (rc != 0)
                return NULL;
 
+       libevdev_set_clock_id(device->evdev, CLOCK_MONOTONIC);
+
        device->seat_caps = 0;
        device->is_mt = 0;
        device->mtdev = NULL;