Commit graph

12 commits

Author SHA1 Message Date
Peter Hutterer
44988f411b tools: replay: mkdir /etc/libinput if it doesn't exist yet
Where we're replaying a device with quirks, those quirks will be placed into
/etc/libinput/local-overrides.quirks. For that to work, /etc/libinput needs to
exist so let's make it where required.

https://bugzilla.redhat.com/show_bug.cgi?id=1806322

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 09:59:31 +10:00
Peter Hutterer
8e35a2f949 tools: refuse to replay recordings with timestamps from the future
This indicates a bug in libinput record, might as well complain about it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-30 02:10:33 +00:00
Peter Hutterer
765f7917bb tools: replay: fix wrong timestamps for multiple device replay
When multiple devices are recorded, the event times are offset from a global
baseline. Each device thus has a different offset for the first event. To
replay correctly, we must figure out the offset of the first event (across all
devices) and use that for all of them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-25 23:06:09 +00:00
Peter Hutterer
27632555e1 tools: flake8 fixes for the various python files
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:02:58 +10:00
Peter Hutterer
bd8123e459 tools: install local quirks during libinput replay
The quirks for each device are listed in the recording but they may not apply
during libinput replay (e.g. for DMI matches). Work around this by writing out
the local-overrides.quirks file before initializing the devices. This way
we're guaranteed that the device is identical as on the reporter's machine.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 09:41:46 +10:00
Peter Hutterer
93e91536db tools: make an infinite loop more obvious in the code
Nothing sets "stop", so we might as well make it a while True

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 09:13:36 +10:00
Peter Hutterer
73849515ef tools: factor out a sanity check in libinput-replay
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 09:13:36 +10:00
Peter Hutterer
c20d50eb6f tools: libinput-replay: set INPUT_PROP_* properties on the device
Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/60

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-21 15:02:20 +10:00
Peter Hutterer
c819b4f956 tools: libinput-replay: handle a nonzero offset for the first event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-19 16:04:41 +10:00
Peter Hutterer
6e4c83636a tools: libinput-record: add support for printing libinput events
Collect libinput events together with the evdev events and print them to the
log. This makes it possible to debug the full behavior of a user's machine
rather than having to replay it with potential different race conditions/side
effects.

Example event output:
  - evdev:
    - [  2, 314443,   4,   4,    57] # EV_MSC / MSC_SCAN               57
    - [  2, 314443,   1,  57,     1] # EV_KEY / KEY_SPACE               1
    - [  2, 314443,   0,   0,     0] # ------------ SYN_REPORT (0) ---------- +87ms
    libinput:
    - {time: 2.314443, type: KEYBOARD_KEY, key: 57, state: pressed}
  - evdev:
    - [  2, 377203,   4,   4,    57] # EV_MSC / MSC_SCAN               57
    - [  2, 377203,   1,  57,     0] # EV_KEY / KEY_SPACE               0
    - [  2, 377203,   0,   0,     0] # ------------ SYN_REPORT (0) ---------- +63ms
    libinput:
    - {time: 2.377203, type: KEYBOARD_KEY, key: 57, state: released}

Note that the only way to know that events are within the same frame is to
check the timestamp. libinput keeps those intact which means we can tell that
if we just had an evdev frame with timestamp T and get a pointer motion with
timestamp T, that frame caused the motion event.

So far, only key, pointer and touch events are printed. We also
hardcode-enable tapping where available until we have options to enable this
on the commandline just because that's useful to have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-19 14:24:15 +10:00
Peter Hutterer
e4ce6dfb0a tools: libinput-replay: only print the events in verbose mode
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-13 10:57:57 +10:00
Peter Hutterer
578151da61 tools: add a libinput-replay tool
Similar in style to evemu-play but parses the YAML printed by
libinput-record. Note that this tool requires python-libevdev which is a new
package and may not be packaged by your distribution. Install with pip3 or
alternatively, just ignore libinput-replay, it's a developer tool only anyway.

User-visible differences to evemu-play:
* supports replaying multiple devices at the same time.
* no replaying on a specific device, we can add this if we ever need it
* --verbose prints the event to stdout as we are replaying them. This is
  particularly useful on long recordings - once the bug occurs we can ctrl+c
  and match up the last few lines with the recordings file. This allows us to
  e.g. drop the rest of the file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 11:50:46 +10:00