summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-04-19 14:29:07 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-04-19 16:04:41 +1000
commitc819b4f956646ed2e1f2abb6dac92ddf5316bd06 (patch)
tree3cca80e23875da0731b995e6802afc5c5746ed1e /tools
parentaca0e3729a42b76e06c78621163bb0ba9d23193c (diff)
tools: libinput-replay: handle a nonzero offset for the first event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/libinput-replay7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/libinput-replay b/tools/libinput-replay
index df0bb0d3..6f1be9ac 100755
--- a/tools/libinput-replay
+++ b/tools/libinput-replay
@@ -107,6 +107,7 @@ def replay(device, verbose):
uinput = device['__uinput']
offset = time.time()
+ handled_first_event = False
# each 'evdev' set contains one SYN_REPORT so we only need to check for
# the time offset once per event
@@ -118,6 +119,12 @@ def replay(device, verbose):
(sec, usec, evtype, evcode, value) = evdev[0]
+ # The first event may have a nonzero offset but we want to replay
+ # immediately regardless.
+ if not handled_first_event:
+ offset -= sec + usec/1.e6
+ handled_first_event = True
+
evtime = sec + usec/1e6 + offset
now = time.time()