Commit graph

85 commits

Author SHA1 Message Date
Peter Hutterer
5dc1a7ebd3 Adjust for 64bit time_t for 32bit architectures
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-26 15:11:44 +10:00
Peter Hutterer
eef00ff3c6 tools: libinput-record: expand the evdev event value to 7 digits
MSC_TIMESTAMPS need 7 digits so let's make sure everything is nicely aligned

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 05:34:56 +00:00
Peter Hutterer
1e6802b91b Remove some usage of libinput-util.h
Positive side-effect - this exposed a bunch of missing #includes that got
pulled in by other headers before.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-11 12:23:06 +10:00
Peter Hutterer
4ab8a51b68 tools: record: fix two memory leaks
Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-01 08:41:01 +10:00
Peter Hutterer
803519ae59 tools: record: fix segfault on exit
If we don't supply --with-libinput, the device is NULL so we can't unref it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-01 08:40:58 +10:00
Peter Hutterer
9c2ac8f9ee tools: record: when running from the builddir, load the quirks correctly
Fixes #324

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-24 14:57:56 +10:00
Peter Hutterer
247b2344a5 tools: record: increase value size to 6 digits
Tablets commonly have higher axis ranges, might as well make sure they line
up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-01 09:45:29 +10:00
Peter Hutterer
26702e4d73 Fix three coverity complaints
Two resource leaks, one uninitialized variable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-25 15:15:13 +10:00
Peter Hutterer
1272db297a tools: record: print a helpful error message when we don't have devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-04 04:54:27 +00:00
Peter Hutterer
b8a04553de tools: libinput-record: record the hid report descriptor where available
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-02 15:24:04 +00:00
Peter Hutterer
d616218c9a tools: fix a bunch of format conversion complaints
Fixes #137

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-12 13:28:16 +10:00
Peter Hutterer
e33fd7157f tools: record: don't bother setting last_ms to 0 on the first event
The first event we receive is set to a 0ms offset anyway. Setting last_ms to 0
on the first event means the first two events have +0ms offset printed to the
log. Skip it, so the second event has the right offset.

This is human-readable data only, no effect on the recording file itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-06 14:06:48 +10:00
Greg V
f8b412052e Import versionsort implementation from musl for systems without versionsort
versionsort is a GNU extension, not available on *BSD systems.
2018-07-16 13:44:11 +03:00
Peter Hutterer
e6cad92005 Rename data/ to quirks/
A better, less ambiguous name than just "datadir"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-13 13:30:54 +10:00
Peter Hutterer
ea5edf09c4 tools: libinput-record: print the list of quirks
Now that all device quirks are in the quirks subsystem we have to print those
instead of just the udev devices.

Since libinput-record is there to record system devices, the system-installed
quirk list is used (without any commandline overrides right now). This is
useful to capture misconfigurations or missing quirks on the host system.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/58

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-26 13:59:30 +10:00
Peter Hutterer
b4ff592a5a tools: libinput-record: put extra guard in to protect from OOB access
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-06-11 13:43:40 +10:00
Peter Hutterer
7ad3dcf939 tools: libinput-record: fix leaking memory in the error cases
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-16 14:23:12 +10:00
Peter Hutterer
b476345959 tools: libinput-record: print switch events in --with-libinput
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-03 14:03:30 +10:00
Peter Hutterer
8bf2c5ae16 tools: libinput-record: print tablet events in --with-libinput
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-03 13:39:44 +10:00
Peter Hutterer
d140bb7c2d tools: libinput-record: move the event time offset to the first place we get it
Leftover from a previous version where printing and handling an event was
identical. Now we may handle events but not actually print them until a bit
later, so other events may have a (wrong) zero timestamp.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-03 12:20:03 +10:00
Peter Hutterer
aca0e3729a tools: libinput-record: add gesture support
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-19 16:04:41 +10:00
Peter Hutterer
b2fb2adefa Remove some duplicate empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-16 15:14:23 +10:00
Peter Hutterer
8b6d799510 tools: libinput-record: print the mouse and pointingstick udev properties
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-20 13:51:31 +10:00
Peter Hutterer
a1ba6186e7 tools: libinput-record: print a progress bar when recording to a file
To let users know something is happening.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-19 14:24:15 +10:00
Peter Hutterer
056a5eb64a tools: libinput-record: print a comment when the device is in a neutral state
Common problem: some touch sequence does something to confuse libinput but it
cannot easily be captureed. The result is a long sequence of touche that need
to be picked apart and isolated.

Print an easy-to-search  for message in the evdev output that signals that the
device touch state is now neutral (i.e. no finger down). Same can be achieved
by searching for BTN_TOOL_FINGER but that provides false positives for
switching between one and two fingers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-19 14:24:15 +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
3b20f3d02b tools: libinput-record: add separate variable for the first device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-09 15:08:42 +10:00
Peter Hutterer
7dc52459b3 tools: libinput-record: drop unused 'print' argument
And rename the function for more clarity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-09 15:08:42 +10:00
Peter Hutterer
12410dfba4 tools: libinput-record: fix frame printing for multiple devices
The evdev events were just dumped into one big list instead of being split up
by frame.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-09 14:56:02 +10:00
Peter Hutterer
e9e134a18d tools: record udev properties in libinput-record
Only the ones we care about in libinput but for those it's handy to know which
ones are set (especially the LIBINPUT_MODEL ones).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-08 09:42:44 +10:00
Peter Hutterer
cd63ba2cc0 tools: add the git version in the libinput-record output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-06 14:22:30 +10:00
Peter Hutterer
223c914847 tools: remove a stray perror() in libinput-record
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 12:51:27 +10:00
Peter Hutterer
f1c0f28bca tools: fix two scan-build errors in libinput-record
division by 0 and an unused variable

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 12:48:48 +10:00
Peter Hutterer
b02579121b tools: add --all to libinput-record
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 11:50:46 +10:00
Peter Hutterer
576f2ed2a7 tools: add a libinput-record tool
This is a tool that does effectively the same job as evemu-record.
evemu has two disadvantages: its API is clunky and hard to extend even for
simple features. And it has a custom file format that requires special
processing but is difficult to extend and hard to write manually. e.g. the
bitmasks require keeping a line number state to know which bit an entry refers
to.

libinput-record records the same data but the output is YAML. That can be
processed easier and extended in the future without breaking the parsing. We
can (in the future) also interleave the evemu output with libinput's debug
output, thus having a single file where the events can be compared and
analysed without the need for replaying.  Likewise, we can easily annotate the
file with parsable bits of information without having to shove all that into a
comment (like version numbers of libinput, kernel, etc).

User-visible differences to evemu-record:
* the output file requires an explicit -o or --output-file argument
* no evemu-describe equivalent, if you just want the description simply cancel
  before any events are sent
* to see key codes, a --show-keycodes flag must be supplied, otherwise all
  'normal' keys end up as KEY_A. This protects against inadvertent information
  leakage
* supports a --multiple option to record multiple devices simultaneously. All
  recordings have the same time offset, it is thus possible to reproduce bugs
  that depend on the interaction of more than one device.

And to answer the question of: why a printf-approach to writing out yaml
instead of a library, it's simply that we want to be able to have real-time
output of the recording.

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