Commit graph

598 commits

Author SHA1 Message Date
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
Peter Hutterer
da9eace8db tools: record: fix broken event time stamp recording
event->time ended up being an uninitialized field. Introduced in 5dc1a7e, the
event here isn't a struct input event but rather our internal event struct.
Fix this and reshuffle the time handling a bit so it's a bit more obvious
here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-30 02:10:33 +00:00
Peter Hutterer
fb1f0a6886 tools: record: wrap the time offset handling into a helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-30 02:10:33 +00: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
acfec31103 tools: align the tool type names on proximity nicely
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-30 02:10:33 +00:00
Peter Hutterer
ce8b256f91 tools: fix abort caused by the pointing stick integration quirk
See #400

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-15 14:12:12 +10:00
Peter Hutterer
2d1bcf982a pad: add LIBINPUT_EVENT_TABLET_PAD_KEY for pad keys
The Wacom Cintiq 24HD and later tablets send specific key events for
hardware/soft buttons. KEY_PROG1..KEY_PROG3 on earlier tablets,
KEY_CONTROLPANEL, KEY_ONSCREEN_DISPLAY, and KEY_BUTTONCONFIG on later tablets.
We ignore KEY_PROG1-3 because starting with kernel 5.4 older tablets will too
use the better-named #defines.

These differ from pad buttons as the key code in itself carries semantic
information, so we should pass them on as-is instead of mapping them to
meaningless 0-indexed buttons like we do on the other buttons.

So let's add a new event, LIBINPUT_EVENT_TABLET_PAD_KEY and the associated
functions to handle that case.

Pad keys have a fixed hw-defined semantic meaning and are thus not part of
a tablet mode group.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-04 15:38:39 +10:00
Peter Hutterer
9696f37393 tools: debug-events: don't overrun the device array with too many arguments
Only the --device option was checked for argument count, not the rest so it's
easy to overrun the array by specifying too many devices.

Except: this was a theoretical bug only, more than 64 arguments trigger
an assertion in the argv processing in tools/shared.c anyway. Let's drop the
debug-events limit to 60 devices so we can at least have a test for this.

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-04 12:50:11 +10:00
Peter Hutterer
47767290a7 tools: print the libinput version in debug-events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 15:16:30 +10:00
Peter Hutterer
eb16ce2520 tools: libinput-record: drop the explicit --multiple argument
If we want to record multiple events, let's just specify multiple event nodes.
No need for a specific extra argument here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 10:34:18 +10:00
Peter Hutterer
5a275ef171 tools: libinput-record: return the correct exit value on invalid usage
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 10:34:18 +10:00
Peter Hutterer
1457ac8446 tools: libinput-record: bail out on invalid commandline arguments
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 10:34:18 +10:00
Peter Hutterer
03bc7121eb tools: print stderr/stdout when a option test fails
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-27 10:34:18 +10:00
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
490131ff61 tools: make debug-events accept multiple device nodes
For interaction between devices it's necessary to look at more than one device
at a time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-26 00:34:08 +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
f87a6203ee tools: print the tip state in the tablet debugging tool 2019-11-19 09:56:14 +10:00
Peter Hutterer
c9e9ea3840 tools: add stylus button support
For the evdev events only a few hand-selected ones, all other ones are ignored
for now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-19 09:56:14 +10:00
Peter Hutterer
733eb07eda tools: add a tablet debugging tool
Nothing sophisticated but easier to debug certain tablet oddities.
It shows a bar for each axis on the tablet (and the evdev axis) and prints
that relative to the axis range. This makes it easy to check if we do hit the
full range (especially for distance/pressure/tilt) and whether that matches
with what the device gives us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-19 09:56:14 +10:00
Peter Hutterer
2c613feb0c tools: debug-events: expand timestamp prints to full millis
Tens of millis is not quite enough in some cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 22:43:48 +00:00
Peter Hutterer
558cc3f11c tools: debug-events: offset timestamps by the first normal event
Start counting the timestamps from the first time we get something off the
actual fd. This makes it easier to match up timestamps with the output from
libinput record.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-18 22:43:48 +00: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
12021c860e tools: debug-gui: show pressure/distance as vertical bar
Both of these are normalized so let's draw a bar that shows the values
accordingly. This makes it a lot easier to check whether pressure values go to
the maximum, etc.

A little extra square is shown whenever the tip is logically down.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-01 08:38:59 +10:00
Peter Hutterer
883e0a1eea tools: drop the specific libinput measure tools from the libinput man page
libinput measure lists them all anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-29 11:08:19 +10:00
Peter Hutterer
31dd2ba2f1 tools: correct libinput measure reference to the tap man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-29 11:08:19 +10:00
Konstantin Kharlamov
f3c132042e libinput-list-devices: make paragraph about different settings terser
Changes are:

1. "configuration options" is same as "options"
2. The clarification "e.g. scrolling" doesn't clarify anything because a
user don't necessarily knows there're "2-finger scroll" and
"edge-scroll"; and even if they do, they can imagine the settings to be
represented by "0" and "1" values, which then begs a question: why
aren't all "Enabled/Disabled" settings are prefixed with "*" too.
   Instead, replace the vague `multiple different settings` with more
specific `more settings than "enabled/disabled"`.
3. "ones" is shorter than "settings" and makes sure a user haven't lost
context.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-10-28 05:40:02 +00:00
Konstantin Kharlamov
404e69e93b libinput-list-devices: be more explicit about only listing defaults
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-10-28 05:40:02 +00:00
Peter Hutterer
63f9923013 Add a scroll button lock feature
Scroll button locking is an accessibility feature. When enabled, the scroll
button does not need to be held down, the first click holds it logically down,
to be released on the second click of that same button.

This is implemented as simple event filter, so we still get the same behavior
from the emulated logical button, i.e. a physical double click results in a
single logical click of that button provided no scrolling was triggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-17 12:21:41 +10:00
Konstantin Kharlamov
0fa8d0d983 libinput-tool.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
29de440b15 libinput-measure.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03:00
Konstantin Kharlamov
476da352c0 libinput-debug-events.c: remove unused includes
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-09-13 00:07:39 +03: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
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
975ff2fb6e tools: change python invocations to use /usr/bin/env python3
Let's be consistent here

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