mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-04 22:30:13 +01:00
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>
This commit is contained in:
parent
59ca971898
commit
f30342644a
1 changed files with 10 additions and 13 deletions
|
|
@ -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")
|
||||
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
|
||||
|
||||
evdev = fetch(events[0], "evdev")
|
||||
(sec, usec, *_) = evdev[0]
|
||||
|
||||
return sec + usec / 1.0e6
|
||||
|
||||
except YamlException:
|
||||
import math
|
||||
|
||||
return math.inf
|
||||
import math
|
||||
return math.inf
|
||||
|
||||
|
||||
def wrap(func, *args):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue