summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2021-02-19 13:31:56 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2021-02-23 10:43:52 +1000
commitf30342644aea46deffe9373796a9c25fa521bc48 (patch)
treee823eeaa54e7274ac01591e41d770aec04ea8247
parent59ca9718987d831ffc17ecf0a7df3817727f928a (diff)
downloadlibinput-f30342644aea46deffe9373796a9c25fa521bc48.tar.gz
tools/replay: search for the first event with a timestamp
When running with --with-libinput, the first event is the DEVICE_ADDED event for our device. Those events do not have a timestamp. We have to find the first event in the recording with a timestamp instead. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rwxr-xr-xtools/libinput-replay23
1 files changed, 10 insertions, 13 deletions
diff --git a/tools/libinput-replay b/tools/libinput-replay
index b3710c9e..3ecb77a7 100755
--- a/tools/libinput-replay
+++ b/tools/libinput-replay
@@ -209,20 +209,17 @@ def replay(device, verbose):
def first_timestamp(device):
- try:
- events = fetch(device, "events")
- if events is None:
- raise YamlException("No events from this device")
-
- evdev = fetch(events[0], "evdev")
- (sec, usec, *_) = evdev[0]
-
- return sec + usec / 1.0e6
-
- except YamlException:
- import math
+ events = fetch(device, "events")
+ for e in events or []:
+ try:
+ evdev = fetch(e, "evdev")
+ (sec, usec, *_) = evdev[0]
+ return sec + usec / 1.0e6
+ except YamlException:
+ pass
- return math.inf
+ import math
+ return math.inf
def wrap(func, *args):