Commit graph

740 commits

Author SHA1 Message Date
Peter Hutterer
1d9e307e2b touchpad: implement support for three-finger drag
Exposed via new configuration option this enables 3 and 4 finger
dragging on touchpads. When enabled a 3/4 finger swipe
gesture is actually a button down + motion + button up sequence.

If tapping is disabled the drag starts immediately, if tapping is
enabled the drag starts after the tap timeout/motion so we can distinguish
between a tap and a drag.

When fingers are released:
- if two fingers remain -> keep dragging
- if one finger remains -> release drag, switch to pointer motion

When 3/4 fingers are set down immediately after releasing all fingers
the drag continues, similar to the tap drag lock feature. This drag lock
is not currently configurable.

This matches the macos behavior for the same feature.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1042>
2025-02-18 06:44:01 +00:00
Peter Hutterer
9d214e1c19 tools/list-devices: add missing config options to the output
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
d33c83b1b1 tools/list-devices: add helper to print aligned values
This makes it easier to re-align all columns.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
c8ee24ce17 tools/list-devices: reword the man page a bit
Hopefully a slightly better explanation that what we had before.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
dbe8f7fede tools/list-devices: allow listing some devices only
$ libinput list-devices /dev/input/envent0

Now does what one would expect.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1140>
2025-02-17 07:59:05 +00:00
Peter Hutterer
74617de48d tools/record: record HID_BPF properties too
If this property is set we likely have a udev-hid-bpf property
loaded into the device. Knowing this is going to be important for
debugging why a device may or may not work so let's record this.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1121>
2025-01-20 10:29:47 +00:00
Peter Hutterer
2c0c4a6516 Replace strneq() with hardcoded lengths with strstartswith()
Slightly less efficient but easier to read and it's not possible to
accidentally provide the wrong length. Plus it handles null pointers
correctly so get to skip the checks (which weren't needed for strneq()
either, but still).

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1121>
2025-01-20 10:29:47 +00:00
Peter Hutterer
c3bf478d41 util: add truefalse and yesno macros for easy string conversion
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1118>
2025-01-20 09:54:32 +00:00
Peter Hutterer
d52bb9ed4d tools/per-slot-delta: optionally show the distance to the original point
This makes it easier to quickly gather how far a touch has moved since
it started, compared to the initial starting position. This again makes
it easier to determine if a threshold required for e.g. scrolling has
been met.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
5f8f715017 tools/per-slot-delta: refactor the printing of a slot
This makes it easier to optionally print extra components of that slot.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
5df1d26aa2 tools/per-slot-delta: use a Point class for slot position/delta
Better abstraction, especially when we introduce more than just those
two.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
a7ff3e0508 tools/per-slot-delta: remove some duplication for axis handling
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
01f133fbc4 tools/per-slot-delta: use dataclasses and enums
Slight modernization of the code

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1101>
2025-01-09 02:12:10 +00:00
Peter Hutterer
117d91b93f tools/libinput-replay: use list comprehension instead of append
And remove the unnecessary del processes, we're in a block so processes
ceases to exist there anyway.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1102>
2024-12-22 23:59:22 +00:00
Peter Hutterer
193aacf61a tools/libinput-replay: interrupt only the ongoing event sequence with ctrl+c
If libinput replay is currently replaying events, stop that sequence and
go back to the start if the user presses Ctrl+C. Only on the second
Ctrl+C do we fully exit.

This helps debugging long recordings where we don't want to keep
producing events after some initial event sequence.

Closes #1064

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1102>
2024-12-22 23:59:22 +00:00
Peter Hutterer
2e9d8df74e tools/debug-gui: color the fingers with different colors
Follow-up to commit 713892c162 ("Number the fingers by slot in debug-gui")
this changes the colors slightly for each finger, making it easier to
track visually.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1103>
2024-12-20 01:15:11 +00:00
Peter Hutterer
d63689003f tools: only warn once about our lack of support for multiple fingers
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1096>
2024-12-18 08:49:34 +00:00
Peter Hutterer
52679e1296 tools/libinput-replay: print a separator line for EV_SYN events
If running with --verbose having that line makes it a lot easier to
look at the event sequence.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1094>
2024-12-18 08:07:18 +00:00
Peter Hutterer
9988f4242e tools/measure-touchpad-pressure: require max > min for a range
Otherwise a resulting quirk will fail when parsed by libinput which
enforces this too.

Closes #1060

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1089>
2024-12-10 10:00:39 +00:00
Peter Hutterer
cf5b7bee01 Add tablet area configuration
This adds the configuration option to define a rectangle that serves as
an input area on external tablets such as an Intuos.

The intention behind this is to make this input area behave as if it was
the only physical input area on this tablet with libinput emulating
proximity events as required for where the tools moves in and out
of this area.

This could also be achieved with the existing calibration setting but
area configuration is not calibration and we don't want to expose other
side-effects of the matrix (e.g. scaling and rotation) for these
devices.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:10:48 +10:00
Peter Hutterer
49bbef6468 tools/debug-events: print bugs in bold red
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1013>
2024-11-05 12:05:05 +10:00
Peter Hutterer
86915213c8 tools: sort the options in debug-events match page
We now have enough config options that having them unsorted makes it
hard to find the right option.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1075>
2024-11-04 15:48:49 +10:00
Peter Hutterer
a61c876412 pre-commit: drop black, use ruff-format instead
And switch to the current-ish version of the ruff pre-commit hook,
including updating the repo.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1072>
2024-10-29 13:48:31 +10:00
Peter Hutterer
15af1c0017 tools: change direct type check to isinstance
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1072>
2024-10-29 13:27:35 +10:00
Peter Hutterer
54f3733b76 tools: print full pad mode group info in libinput-list-devices
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1068>
2024-10-22 15:46:57 +10:00
Peter Hutterer
f5cc45e409 tools: add rel dial support to libinput-list-devices
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1068>
2024-10-22 11:54:45 +10:00
Peter Hutterer
54dccd66d1 Fix a few potential NULL dereferences
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1052>
2024-09-30 15:35:36 +00:00
Peter Hutterer
a4ff6d5d0b tools: add --set-calibration to the debug-events man page
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1051>
2024-09-20 21:06:15 +10:00
Peter Hutterer
33612fb37c tools/debug-events: move the event type str to a helper function
This isn't really necessary for the code as-is it makes debugging things
easier.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1044>
2024-09-12 00:59:13 +00:00
Peter Hutterer
dc249b0ffe tools/debug-events: add ability to compress motion events
If --compress-motion-events is given (and stdout is a tty) reduce
the output printed to one line per repeated motion/axis/scroll sequence
(with a count). Example output:
 event6   POINTER_MOTION          108 +1.912s	 1.00/ -1.00 ( +1.00/ -1.00))
 event6   POINTER_BUTTON              +2.008s	BTN_LEFT (272) pressed, seat count: 1
 event6   POINTER_BUTTON              +2.074s	BTN_LEFT (272) released, seat count: 0
 event6   POINTER_MOTION           39 +5.249s	 0.00/  0.99 ( +0.00/ +1.00)
 event6   POINTER_BUTTON              +5.385s	BTN_LEFT (272) pressed, seat count: 1
 event6   POINTER_MOTION           66 +6.031s	-1.00/  0.00 ( -1.00/ +0.00)
 event6   POINTER_BUTTON              +6.401s	BTN_LEFT (272) released, seat count: 0

The event count (108, 39 and 66) is only printed for more than one event
in sequence so the output is otherwise identical (but 4 spaces wider
now)

If stdout is not a tty the event count is printed but no compression
happens since we rely on a ansi escape sequence for that. Could be fixed
by changing the current print statements to print a \n before the
current event instead of at the end of the current line.

This makes debugging events easier as button events and similar are no
longer obscured by pages of motion events in between.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1041>
2024-09-11 12:49:28 +10:00
Peter Hutterer
09fd1cdd98 tools/debug-events: ignore old-style pointer axis events completely
Since they're interleaved with the more modern finger/wheel/continuous
events they mess up our repeate count, preventing compression for those
events.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1041>
2024-09-09 15:41:45 +10:00
satrmb
910d59e836 touchpad: add sticky mode to drag-lock
Sticky mode removes the timeout from drag-lock, only a tap ends a drag.
Timeout mode remains available without changes.

Sticky mode is exposed as a new value for the existing drag-lock setting.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1037>
2024-09-05 00:47:47 +00:00
José Expósito
7d849623d5 Fix pre-commit errors
Some files had pre-commit style issues. Fix them.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1036>
2024-09-03 09:51:41 +02:00
Peter Hutterer
1b7992c31a tools: add support for setting the calibration matrix
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1018>
2024-06-20 09:32:19 +10:00
Peter Hutterer
99647b71d3 tools: add libinput analyze buttons for button state analysis
This tool helps with tracking button states and time deltas
between button events. Example output for a mouse with LMR buttons
recorded (the mouse also has BTN_SIDE and BTN_EXTRA):

  Timestamp   │  Delta   │ L │ R │ M │ S │ E
     0.596112 │      0ms │ ┬ │   │   │   │
     0.689096 │     92ms │ ┴ │   │   │   │
     1.129056 │    439ms │ ┬ │   │   │   │
     1.308178 │    179ms │ ┴ │   │   │   │
     1.469149 │      0ms │ ┬ │   │   │   │
     1.598096 │    128ms │ ┴ │   │   │   │
     1.862125 │    264ms │ ┬ │   │   │   │
     2.084234 │    222ms │ │ │ ┬ │   │   │
     2.415224 │    330ms │ │ │ ┴ │   │   │
     2.831227 │    416ms │ │ │ ┬ │   │   │
     3.215067 │    383ms │ ┴ │ │ │   │   │
     3.525230 │    310ms │ ┬ │ │ │   │   │
     3.629006 │    103ms │ ┴ │ │ │   │   │
     3.813078 │    184ms │ ┬ │ │ │   │   │
     3.909170 │     96ms │ ┴ │ │ │   │   │
     4.093180 │    184ms │ ┬ │ │ │   │   │
     4.317036 │    223ms │ ┴ │ │ │   │   │
     4.507175 │    190ms │ ┬ │ │ │   │   │
     4.587105 │     79ms │ │ │ ┴ │   │   │
     4.779211 │    192ms │ ┴ │   │   │   │
     5.075239 │    296ms │   │   │ ┬ │   │
     5.259097 │    183ms │   │   │ ┴ │   │
     5.379082 │    119ms │   │   │ ┬ │   │
     5.483044 │    103ms │   │   │ ┴ │   │

The default behavior is to highlight time deltas below 25ms
in red. 25ms is our higher debounce timeout.

Note that the delta time is the one between button events, ignoring any
e.g. motion events in between.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1010>
2024-06-18 07:43:02 +00:00
Peter Hutterer
4333845e4c tools/debug-gui: draw the evdev x/y axis with the right color
We were drawing an arc but apparently in white which made it a tad hard
to see on a white background. Draw this with the same color as the
touchpoints so we can debug single-touch and tablet devices too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1011>
2024-06-13 05:45:19 +00:00
Peter Hutterer
4548a37511 tools: actually parse options in libinput-debug-tablets
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1009>
2024-06-10 15:09:19 +00:00
Peter Hutterer
1725b7d606 Add support for --set-pressure-range to the debugging tools
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1009>
2024-06-10 15:09:19 +00:00
Peter Hutterer
fdb693a6ee tools/record: record the DRIVER property in the recording
So we know which kernel driver is handling the device. Quite useful,
sometimes, without having to ask for extra logs.

This of course requires that we ignore said property in libinput replay
since no uinput device will have that driver property set.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1007>
2024-06-04 16:54:28 +10:00
Tarcísio Eduardo Moreira Crocomo
46d1fff0b0 touchpad: add clickfinger button map
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/988>
2024-04-09 19:08:17 -03:00
José Expósito
f6a1f264df sparse: make some variables static
Fix warnings about variables that should be made static when compiling
with Sparse enabled:

        $ CC=cgcc meson builddir

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/987>
2024-03-18 23:35:34 +00:00
Peter Hutterer
301895685e tools: fix two black warnings
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/985>
2024-03-18 12:29:57 +10:00
Joshua Goins
beca998122 tablet: add API for relative dials
Some tablets such as those in the XP-PEN PRO series use "dials" which
are actually scrollwheels and emit EV_REL events. These should not be
emulated as rings (which are absolute) so we must expose them as a new
tablet event.

Adds LIBINPUT_EVENT_TABLET_PAD_DIAL that work largely identical as our
high-resolution wheel events (i.e. the values are in multiples or
fractions of of 120). Currently supports two dials.

This is a lot of copy/paste from the ring axes because the interface is
virtually identical. The main difference is that dials give us a v120
value in the same manner as our scroll axes.

Notes:
- REL_DIAL is mutually exclusive with REL_WHEEL, we assume the kernel
  doesn't (at this point) give us devices with both. If this changes for
  devices with three dials (wheel + hwheel + dial) we need to add code
  for that.
- REL_DIAL does not have a high-resolution axis and we assume that any
  device with REL_WHEEL_HI_RES will also have REL_HWHEEL_HI_RES (if the
  second wheel exists).
- With dials being REL_DIAL or REL_WHEEL there is no possibility of
  detecting a finger release (the kernel does not route EV_RELs with a
  value of zero). Unless this is implemented via a side-channel - and it
  doesn't look like any hardware that supports dials does that - we
  cannot forward any information here. So unlike absolute rings we
  cannot provide a source information here.

Closes #600

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/967>
2024-02-20 02:49:05 +00:00
Czcibor Bohusz-Dobosz
713892c162 Number the fingers by slot in debug-gui 2023-10-16 04:31:17 +00:00
José Expósito
973c461d4b tools/record: print bus name
A follow up on commit 65eaabf91f ("tools/record: print the vid/pid
with proper 4 hex digits").

Print the bus name in addition to the bus ID. Only the busses available
in quirks are printed.

Example:

    $ sudo libinput record
    [...]
    # ID: bus 0x0003 (usb) vendor 0x046d product 0x406d version 0x0111
    [...]

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
2023-09-01 16:21:15 +02:00
Peter Hutterer
17e556503d tools: rename an enum value to fix a FreeBSD 14 name clash
Fixes #931
2023-08-31 12:21:00 +10:00
Peter Hutterer
4effe6b1b9 evdev: add a helper macro for the absinfo range
The range is (max - min + 1) because the kernel range is inclusive min
and max. Let's fix that once and for all with a helper function.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-29 17:07:38 +00:00
Peter Hutterer
65eaabf91f tools/record: print the vid/pid with proper 4 hex digits
The field with includes the 0x if printing with "0x04d". And because
that format prints zero as just 0000, let's move the 0x prefix out and
let printf only handle the actual number.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-08-29 05:35:15 +10:00
Peter Hutterer
83144a0edc man: hide debug-gui from the libinput.man page if disabled
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-09 13:00:08 +10:00
Peter Hutterer
bee70901ec tools: add rotation support to debug-events and debug-gui
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-27 13:15:14 +10:00