Commit graph

784 commits

Author SHA1 Message Date
Peter Hutterer
1303adbf1b tools/record: compress a set of printfs into one
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-17 12:38:53 +10:00
Peter Hutterer
6e8aba9354 tools/record: prefix the device list with a # character
Too many recordings end up with the device list at the top when users redirect
stderr and stdout to the recordings file. This breaks yaml parsing and
requires manual removal of the first few lines.

Avoid this by prefixing the lines with a command character, this way the yaml
stays correct.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-17 12:38:53 +10:00
Peter Hutterer
2d641e6b7b tools/record: add --grab option
Useful to record devices like power buttons, lid switches, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-16 23:59:57 +00:00
weizhixiang
bb84fcc738 check return value for udev_new()
Signed-off-by: weizhixiang <1138871845@qq.com>
2020-09-15 10:42:47 +08:00
Peter Hutterer
5ebd7bd1f0 tools/replay: check the recorded udev properties against the local properties
Where a device is replayed locally for testing, its udev properties should
match the recorded properties. Otherwise the testing results will not be
reliable.

The exception here is the device group which we currently don't set for
emulated devices and even if we did, it may intentionally differ anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-09-11 04:36:03 +00:00
weizhixiang
6e03da6344 remove extra paramenter in libinput-debug-events
Signed-off-by: weizhixiang <1138871845@qq.com>
2020-09-07 09:50:07 +00:00
Rosen Penev
467752047e
[clang-tidy] do not use else after return
Found with readability-else-after-return

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-08-27 01:17:24 -07:00
Peter Hutterer
e926d3d919 tools: fix a replay exception when a recording has an empty quirks list
Fixes https://gitlab.freedesktop.org/libinput/libinput/-/issues/520

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-08-24 08:35:12 +10:00
Peter Hutterer
912a457f18 tools: add missing linebreak in error message
Missing from a0643a9c98

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-08 13:25:12 +10:00
Peter Hutterer
3403692ff0 tools: when running the test suite, start the debug-gui minimized
This allows us to run the option parsing test without getting interrupted by a
million debug-gui windows popping up for half a second.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-07 18:51:33 +10:00
Peter Hutterer
a0643a9c98 tools: change the error message for missing tools
Given that some people appear to not read until the "is not installed" part of
the error message, let's reduce the error message to just that part. This may
be confusing where a user mistypes the actual command but that happens rarely
compared to those that can't run libinput record because it's in a different
package.

Fixes #500

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-07-01 01:21:21 +00:00
Peter Hutterer
d724dc060b Replace strneq() with strstartswith() for variable prefixes
Leaving in-place all those where we know the length of the prefix, but
replacing all those where we were calling strlen on the prefix.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-17 07:52:00 +00:00
Peter Hutterer
9b3e0e8043 tools: per-slot-delta: if a NONE touch gets data, assume it's starting
If we have a recording that started after the touch down, let's start that
touch on the first x/y position update.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-04 10:43:33 +10:00
Peter Hutterer
9ecac89bab tools: per-slot-delta: construct the right InputEvent
d107d5 broke this tool because the InputEvent was our local datastructure,
which needed the evbit redirect.

Fixes d107d58cd2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-04 10:43:33 +10:00
Peter Hutterer
ba68cdf67e tools: replay: allow for missing quirks entry in libinput recordings
Older recordings don't have that field so we should just ignore that
case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-22 03:41:05 +00:00
Peter Hutterer
975d036713 tools: measure-fuzz: sleep for 2 seconds to give the hwdb time
one second isn't always enough here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-19 16:04:58 +10:00
Peter Hutterer
28e7f62302 tools: measure-fuzz: fix the tool to work again
Where libinput is installed, checking whether the fuzz is applied to the
device will always fail with an error - the udev rules will remove the
fuzz and copy its value to the LIBINPUT_FUZZ properties instead.

So let's fix this: where the fuzz shows up on the device print a warning
because libinput's udev rule isn't working. And where it's missing check
the udev properties and compare those to the settings instead.

Fixes #472

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-19 16:04:58 +10:00
Peter Hutterer
a22137e7fd tools: measure-fuzz: run systemd-hwdb update, not udevadm hwdb
For backwards compatibility reasons, the hwdb.bin created udevadm hwdb
does not actually apply matches in the way you'd expect. systemd-hwdb
creates the newer format and is preferred.

Related: #472

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-19 15:23:23 +10:00
Peter Hutterer
3ec74cfc35 tools: measure-fuzz: handle a None return correctly
Fixes #472

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-19 15:18:42 +10:00
Peter Hutterer
d107d58cd2 tools: per-slot-delta: skip the extra evbit indirection
e.code is the evbit anyway, we don't have to convert it

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-16 06:10:25 +00:00
Peter Hutterer
78dcbec7a4 tools: per-slot-delta: drop an unused variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 15:32:22 +10:00
Peter Hutterer
f5ab18ab8f tools: per-slot-delta: always mark slot 0 as used
If a device never sends ABS_MT_SLOT, our output was emtpy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 15:32:17 +10:00
Peter Hutterer
d88ad293d2 tools: per-slot-delta: add arguments to set a threshold and ignore-below
The threshold colors events above a certain value in red, ignore-below skips
any line below that threshold.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 14:35:27 +10:00
Peter Hutterer
61296feaee tools: per-slot-delta: init the slots with the right index
The index is unused, but useful during debugging

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 13:50:53 +10:00
Peter Hutterer
4e03175307 tools: per-slot-delta: move printing the slot data into a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 13:50:53 +10:00
Peter Hutterer
5a9fb539d9 tools: per-slot-delta: print the BTN_TOUCH etc. bits in-line
New output example:

 9.408899    +5ms DBL: ↑↗    1/  -9 | →→    0/   0 |

where DBL stands for BTN_DOUBLE.

This also widens the relative time by one so we don't lose formatting for >1s
delta time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 13:38:48 +10:00
Peter Hutterer
c23484a9ec tools: per-slot-delta: only render the slots that have been seen
Makes the output easier to understand given that most touchpads have 5+ slots
but don't actually use them (or the users don't).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-11 13:38:48 +10:00
Loïc Yhuel
dd0370f73c quirks: correctly print boolean values
When a boolean quirk is set to "0", it is correctly disabled, but "libinput quirks list" and
"libinput record" showed it as "1".

This happens for example if ModelXXXX=0 is set in /etc/libinput/local-overrides.quirks, to
override a default quirk.

Signed-off-by: Loïc Yhuel <loic.yhuel@softathome.com>
2020-04-06 23:51:01 +02:00
Peter Hutterer
4a9d3e8796 tools: add a measure touchpad-size tool
Replacement for the touchpad-edge-detector tool with a slightly more
expressive design, hopefully cutting down on some of the bug reports.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 15:14:45 +10:00
Peter Hutterer
101cbe16c3 tools: make the thumb threshold configurable while measuring pressure
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 14:45:19 +10:00
Peter Hutterer
ef5204fda7 tools: revamp the touchpad-pressure measuring tool
Let's hope this one is more obvious to use for users.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 14:44:47 +10:00
Peter Hutterer
1f5a27bf3d tools: add libinput analyze to the libinput tool help output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-29 15:33:24 +10:00
Peter Hutterer
d80bbcb028 tools: record: drop quotes from os-release information
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-21 11:02:48 +10:00
Peter Hutterer
4d92ea116c tools: if pytest fails to import, skip the tool option parsing test
It's not the most important test outside of my machine and CI, so let's just
skip over it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Michel Dänzer <mdaenzer@redhat.com>
2020-03-20 20:42:51 +10:00
Peter Hutterer
b35a32dd9d man: install the analyze per-slot-delta man page
And add libinput analyze to the main libinput man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-20 16:10:11 +10:00
Peter Hutterer
d0eb8d58a3 tools: switch tool option parsing test to use pytest
pytest is more powerful than unittest, so let's switch to that instead. And in
the process fix a few tests that for some reason succeeded even though they
shouldn't have (e.g. the autorestart test).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-17 10:08:48 +10:00
Peter Hutterer
2b3fd5aa30 tools: record: use the right exit code when the output file is missing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-16 16:21:04 +10:00
Peter Hutterer
6ed3a0b079 tools: record: allow for an output file without --o
libinput record touchpad.yml /dev/input/eventX
or just
  libinput record touchpad.yml
are simpler invocations and since we're quite limited in what we can record
(i.e. only device files) we can just check the argument list to figure out
whether there is something to record to.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-16 13:04:50 +10:00
Peter Hutterer
e11bad41f5 tools: add a libinput analyze command with the per-slot-delta subcommand
I've been using this script ever since libinput record was available, might as
well ship it with libinput so I don't have to remember where it lives.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-16 08:35:43 +10:00
Peter Hutterer
927a7c0745 tools: fix a typo in a man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-12 11:02:57 +10:00
Peter Hutterer
850925910f tools: record: fix dmi recording
Processing os-release in the same buffer that the dmi modalias used caused the
dmi to be recorded as 'dmi: "VERSION_ID=31"'. The cause for that was simply
that the dmi modalias was read but not printed until after the os-release
information was processed.

Fix this two-fold: rearrange that each part now reads and prints in
one go, and rename the buffers so we don't re-use them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-09 10:20:49 +10:00
Peter Hutterer
c7f06b0bdd quirks: rename the alps touchpad quirk to note it's a serial TP quirk
This quirk only applies to serial ALPS touchpads, so let's name it
accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-05 16:35:53 +10:00
Peter Hutterer
20cf83789d tools: constify the optarg handling of seats
This shuts up scan-build complaining about memory leaks in libinput
debug-events (needs the right combination of --device option and eventually
triggering usage()) and saves us a bunch of unnecessary allocations.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 01:53:21 +00:00
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
294298880d tools: record: fix fallback os-release file handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-21 11:42:01 +10:00
Peter Hutterer
428acee867 tools: record: record basic os-release information as well
Because sometimes it's useful to know what distro a recording was made on, and
the kernel version doesn't always reveal that.

Fixes #428

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-19 08:31:18 +00:00
Peter Hutterer
7198e33ecf tools: record: rename a variable to just buf
Better name for re-use

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-19 08:31:17 +00:00
Peter Hutterer
ed1d181cf6 tools: record: record the EVDEV_ABS properties correctly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-07 16:18:27 +10:00
Peter Hutterer
0a2bbdf6e7 tools: record: record the EV_ABS deltas along with the absolute value
It's useful to have this in the immediate recording. Example output now:

 - evdev:
    - [  2, 300309,   3,  47,       0] # EV_ABS / ABS_MT_SLOT               0
    - [  2, 300309,   3,  54,    3547] # EV_ABS / ABS_MT_POSITION_Y      3547 (+8)
    - [  2, 300309,   3,  58,      70] # EV_ABS / ABS_MT_PRESSURE          70 (-14)
    - [  2, 300309,   3,  47,       1] # EV_ABS / ABS_MT_SLOT               1
    - [  2, 300309,   3,  54,    3112] # EV_ABS / ABS_MT_POSITION_Y      3112 (+4)
    - [  2, 300309,   3,  58,      68] # EV_ABS / ABS_MT_PRESSURE          68 (-4)
    - [  2, 300309,   3,   1,    3547] # EV_ABS / ABS_Y                  3547 (+8)
    - [  2, 300309,   3,  24,      70] # EV_ABS / ABS_PRESSURE             70 (-14)
    - [  2, 300309,   0,   0,       0] # ------------ SYN_REPORT (0) ---------- +49ms

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-31 10:40:49 +00:00
Peter Hutterer
2059a015ae tools: fix typo in debug-events man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-31 17:28:15 +10:00