Commit graph

1618 commits

Author SHA1 Message Date
Peter Hutterer
f159abdc57 quirks: allow for parsing multiple products
This allows for a slight optimization of the quirks parser: where
multiple devices from the same vendor require the same quirk, allow
for multiple product matches in the form:

MatchProduct=0x0001;0x0002;

This is stored as a fixed-sized zero-terminated array - a product ID of
zero isn't something we need to worry about in real situations.

Closes #879

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1038>
2024-09-05 13:54:07 +00:00
Peter Hutterer
ea7ad8d25c util: add a strv_for_each helper function
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1038>
2024-09-05 13:54:07 +00: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
6fee92c959 pad: switch the REL_WHEEL direction to match dials with scroll wheels
REL_WHEEL sends -1 for "down" and +1 for "up", so let's make sure we
keep that correct here too.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1021>
2024-06-21 10:02:07 +10:00
Peter Hutterer
436bb5cc56 test: fix the pad dial test, values need to be equal, not >=
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1021>
2024-06-21 10:00:42 +10:00
Peter Hutterer
978676be1e tablet: allow calibration if libwacom says our tablet is a display tablet
Not all display tablets have INPUT_PROP_DIRECT SET (looking at you,
Huion Kamvas 12) so our calibration went nowhere. Let libwacom override
whatever the kernel says.

This also makes testing without matching hardware a bit easier now since
we only need to override the libwacom file, not the whole device.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1019>
2024-06-19 12:37:44 +10:00
Peter Hutterer
8326f71df5 touchpad: special-case shift as modifier for dwt
We ignore modifiers for disable-while-typing because we don't want to
disable the touchpad for things like shift-click or ctrl-click.

We also do remember the modifier state so that we don't disable the
touchpad for once-offs like ctrl+s.

Shift is however a special case - shift + something else is means the
user is typing and we should disable the touchpad for that.

Closes #1005

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1015>
2024-06-17 08:31:25 +00:00
Peter Hutterer
a2f0cc35c5 quirks: add support for Uniq matching
Same as MatchName but matches on the UNIQ udev property instead. This
is needed for some Huion, Gaomon and other tablet devices that only
differentiate each other through the Uniq string which contains the
firmware version.

Closes #997

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1006>
2024-06-05 11:35:59 +00:00
Martin Rys
a191a46a78 Include COMPOSE and KANA keys in tests
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/990>
2024-04-28 23:59:14 +00: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
74f69dc9a0 test: replace an assert with double_ge
Better test debugging this way.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
2024-03-18 23:02:05 +00:00
Peter Hutterer
4d9b25b234 test: force the apple magicmouse to 1000dpi
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
2024-03-18 23:02:05 +00:00
Peter Hutterer
47f94633fe test: remove some old compat code for kernel<4.5
Kernel 4.5 and libevdev 1.5 were released in 2016, this code is no
longer necessary.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
2024-03-18 23:02:05 +00:00
Peter Hutterer
3d246ef248 test: remove a workaround for libevdev 1.2 and earlier
libevdev 1.3 was released in 2014.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/986>
2024-03-18 23:02:05 +00:00
Peter Hutterer
bb1b1304df test: fix two wrong timeout calls
This are tests with drag lock enabled, so our timeout needs to be
be the tap and drag timeout (which is higher than the normal tap timeout).
Only worked because they're similar enough that if there's a bit of a
delay, the extra ms push us over the line.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
09b59e42fb test: fix some tests that may cause pointer jumps
Increase the number of events to move from one position to the next to
avoid accidental pointer jumps.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
34f86489a8 Revert "test: allow for substring matching in the various --filter- arguments"
Substring matching means it's impossible to select filters that are
substrings of others, making it too painful to test one specific filter.

This reverts commit a524cf9761.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
c775c23121 test: slightly increase the finger switch timeout wait
In touchpad_2fg_scroll_return_to_motion we sometimes fail because the
timeout is too close to the actual timeout expiry, creating a race
condition on whether the scroll stop event (triggered by the gesture
end) is sent before or after the timeout expiry.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
30c6d5983d test: add two more more libinput_dispatch() calls
We're writing a lot of events here, if the system isn't fast enough or
(in the future) if we have a custom socket instead of a kernel device we
might fill up the write buffer, causing the test to fail.

Easy workaround is to dispatch more often to ensure the data is being
read from the fd.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
9c69152428 Move mkdir_p into a utility header
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
Peter Hutterer
3644372696 test: add helpers for checking (negative) errnos
This way we get to see the actual error when it happens.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/984>
2024-03-18 16:25:47 +00:00
José Expósito
a43f1edbfe Add libinput_device_get_id_bustype()
Allow to get the device bus type ID in addition to its vid and pid.

Closes: https://gitlab.freedesktop.org/libinput/libinput/-/issues/975
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/977>
2024-02-28 22:49:29 +00: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
Peter Hutterer
d487ca36a4 test: only expect one button event from the intuos-like test
BTN_0 is the only one guaranteed to exist (otherwise we skip the test)
so let's ensure we have at least one event - all the others will fail if
we don't get the right event sent.

This enables the test to run against devices that only have one button.

Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/967>
2024-02-20 02:49:05 +00:00
Peter Hutterer
4bc27543e9 tablet: add tablet tool pressure range configuration
Add a configuration option to reduce the available hardware range to a
fraction thereof. This is done by copying the absinfo struct for the
pressure value and adjusting that copy's minimum/maximum value for
scaling into the target normalized range.

The 1%/5% tip thresholds are kept but pressure offset detection is
disabled if there is a custom pressure range.

Unlike the pressure curve which is implemented in the compositor, the
pressure min/max range needs to be in libinput, primarily because the
tip threshold needs to adjust to any new minimum, allowing for
light touches with a pen without triggering tip down even at a higher
hardware pressure.
2024-01-30 14:29:25 +10:00
Peter Hutterer
0322403ea4 tablet: fix tilt handling for even-ranged tablets
The tablet tilt range may be set as [-N, M] in which case we assume that
a value of zero is vertical (and thus should result in a libinput tilt
value of zero). Unfortunately some tablets report an even total value
range, e.g. [-64, 63] so zero is not actually the mathematical center of
the axis.

Fix this by bumping the axis maximum so zero becomes the logical center.
All devices we've seen so far have [-A, (A-1)] as range so bumping it by
one makes it symmetric.
2024-01-30 14:29:25 +10:00
Peter Hutterer
72eca2db56 util: add a helper to normalize an axis to [0.0, 1.0]
Like the input axis, a normalized range has min/max inclusive so we
cannot use the absinfo_range() helper which assumes the max is exclusive.

Reverts parts of 4effe6b1b9
2024-01-30 14:29:25 +10:00
Peter Hutterer
8bb53150a9 tablet: handle BTN_STYLUS3
And add a test to make sure the tool we know that has three buttons (Pro
Pen 3) can send all those. Enough to run that test one one compatible
device, no real benefit of running it on all tablet devices.
2024-01-24 12:34:25 +10:00
Peter Hutterer
2218da2f31 test: fix a wrong value for the auto-assigned BTN_TOOL
This was actually passed through:
  litest debug event19 - 0.000 EV_KEY           BTN_TOOL_PEN         -2147483648
2024-01-22 01:21:29 +00:00
Peter Hutterer
8603584e33 test: set pressure to zero on proxout for the tablets with forced prox out
If a test goes past the tip-down threshold, the proximity timeout does
not trigger. And one can spend a long time trying to debug why the test
fails...

As far as I vaguely remember, these devices' pressure values are correct
enough, it's just the lack of BTN_TOOL_PEN that is the issue so instead
of a proper proximity out, we just send enough data to set the pressure
to below the tip threshold.
2024-01-22 01:21:29 +00:00
Peter Hutterer
c5f808ac2e test: debug print the events we're draining 2024-01-22 01:21:29 +00:00
Peter Hutterer
11a7de7640 evdev: default tablets to allow for rotation
If libwacom is disabled or there is no .tablet file in libwacom for this
device yet, default to enabling a left-handed setting. Otherwise the
tablet may not be usable.

See https://github.com/linuxwacom/libwacom/issues/616
2024-01-03 12:20:16 +10:00
Peter Hutterer
fe3ae87b09 touchpad: allow a palm pressure threshold of 0 to disable
Where a more generic match assigns a palm threshold to a device, allow
unsetting this by assigning a threshold of zero.

And remove the bug log for palm size threshold of 0 for the same reason.
2023-10-09 07:03:47 +00:00
Peter Hutterer
ba32f0818f test: group the test devices and sort them
Group the LITEST_FOO enum into sections for touchpads, mice, etc. This
makes it easier to find whether a particular device may have a
representation already.
2023-10-09 07:03:47 +00: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
Bjørn Forsman
3dba00845c tablet: increase pressure offset limit from 20% to 50%
detect_pressure_offset() currently rejects offsets that are greater than
20%. My graphics tablet (Wacom Bamboo Fun) is about 30%. The pen tip is
2 mm. Wacom recommends replacing at 1 mm, which means this isn't worn
out yet and we should instead increase the limit to make these devices
usable.

Without this change a "pen down" event happens simultaneously with the
pen being detected -- about 1 cm above the surface -- and producing
libinput pressure of about 0.30. This means you start drawing "in the
air", without knowing up front where the cursor is going to be.

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
2023-08-24 08:04:03 +02:00
Peter Hutterer
3fb876a49d test: expand the tablet mode switch test to check for fake key releases
If a key is still down when the tablet mode switch goes on, make sure we
release the key before the switch goes in effect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-07-17 09:32:24 +10:00
Peter Hutterer
a244b9e32b tablet: apply pressure offset handling for non-distance tablets
Previously we only applied pressure offset handling for tablets that
supported ABS_DISTANCE. Detecting a pressure offset when the tool
doesn't actually touch the surface is easy after all.

But tablets without distance handling may also have a pressure offset,
so let's try to detect this. This is obviously harder since the pen will
always touch the tablet's surface whenever it is in proximity and thus
will always have *some* pressure applied to it.

The process here is to merely observe the minimum pressure value during
the first two strokes of the pen. On the third prox in, that minimum
pressure value is taken as the offset. If the pressure drops below the
offset, the offset is adjusted downwards [1] so over time we'll
get closer to the pen's real offset.

[1] this is already done for distance tablets too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-23 05:21:51 +00:00
Peter Hutterer
6f10f01af2 test: check that the pressure offset is reduced during motion events too
Ensure that if we do get pressure < offset that that offset is reduced
to the current pressure value.

The implementation for this is arguably buggy, reducing the pressure
means we get a tip up event since we now reach 0% of pressure. Arguably
we should enforce the tip staying down and releasing it later but since
this should typically never happen more than once per tool per context
and working around this is a lot of effort, we live with it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-14 10:46:24 +10:00
Peter Hutterer
24cf215f54 test: check the tablet pressure values with a helper function
Makes the code a bit easier to read. Adds precision to some tests,
slightly loosens precision in some other tests but that shouldn't matter
here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-13 15:24:43 +10:00
Peter Hutterer
684ac6b0c2 test: remove a confusing comment
We don't actually increase the pressure here, so let's not say we do

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-13 13:50:10 +10:00
Peter Hutterer
9a3429f4af test: add a calibrated (swapped) tablet device
Swap any input for both x/y and default to a calibration matrix that
swaps it back. In theory, that device will then behave as every other
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-07 09:23:05 +10:00
Peter Hutterer
bc18b18e32 test: add a pre-calibrated flag and exclude the tests as necessary
Prep work for adding a precalibrated tablet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-07 09:23:05 +10:00
Peter Hutterer
44de3ff367 test: add an extra override hook for tablet motion
Currently unused but it complements the existing override handlers.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-07 09:23:05 +10:00
Peter Hutterer
160b062454 test: change tablet coords to doubles and pass the pointer through
All other motion/touch/... coords are already doubles so let's follow
suite here. And passing a pointer into the custom handlers
means we can modify x/y slightly and return false, leaving the rest up
to the generic event handling code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-06-07 09:23:05 +10:00
Peter Hutterer
d3481c8807 evdev: if a device's rotation is around 180 degrees, flip the wheel
For a device used upside-down, make sure the wheels correspond to the
new physical directions. There's a grace range of 20 degrees either way
since that seems like it makes sense.

For 90 degree rotation (or 270 degree) the wheel is left as-is, the
heuristics to guess what angle we want in this case is not clear enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2023-04-27 13:15:14 +10:00
Robert Glossop
57f0354ee5 Disregard touchless clicks on flaky devices
Some touchpads, notably those on the Dell XPS 15 9500, are prone to registering
touchpad clicks when the case is sufficiently flexed. Ignore these by
disregarding any clicks that are registered without touchpad touch.

Signed-off-by: Rob Glossop <robgssp@gmail.com>
2023-04-11 02:00:52 +00:00
Hector Martin
4a8b5e6ec4 touchpad: Disable edge palm detection Apple touchpads
This hurts more than it helps, and users complain of dead trackpad
edges. Apple touchpads have fairly sophisticated internal palm rejection
algorithms going back many years, so let's just disable this one on
everything Apple.

Related to: #433 (need to figure out what other hardware may need this)

Signed-off-by: Hector Martin <marcan@marcan.st>
2023-04-06 16:34:20 +09:00