Commit graph

4369 commits

Author SHA1 Message Date
Peter Hutterer
bd1fcb9c6e utils: add strstartswith() and strendswith() utility functions
Modeled after Python's str.startswith() and str.endswith()

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-17 07:52:00 +00:00
Yariv Barkan
84b3b1731a quirks: fix Apple external trackpad v2 thresholds
The external Apple "Magic" trackpads, both the first and the second
generations, have pretty good built-in spurious touch filtering. For
these device models libinput's own filtering is not required. Using low
enough values such as 20:10 effectively disables libinput's filtering.

Signed-off-by: Yariv Barkan <oigevald+libinput@gmail.com>
2020-06-17 09:46:59 +03:00
Peter Hutterer
600a0334a7 gitlab CI: check merge requests for the allow collaboration checkbox
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-15 20:50:37 +10:00
Peter Hutterer
425950d3bc gitlab CI: use ci-fairy for commit message checks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-15 20:14:39 +10: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
4cf4aba3fb evdev: filter unreliable tablet mode switch events
If we know that the tablet mode switch is bogus anyway, filter the event and
don't pass it to the caller. They won't know whether it's bogus so the only
result we get here is buggy behaviour.

This is the simplest solution here, it filters the mode switch at the lowest
level and thus the caller won't know that the tablet even has a mode switch at
all. Where the device doesn't have any other switches it'll also lose the
switch capability.

This may cause issues in some niche cases where the event node only has
that one bit and we now disabled it leaving us with a zero-event bit device.
Shouldn't matter to callers, but let's see.

Fixes #491

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 22:32:56 +00:00
Peter Hutterer
8ee3b7a7f2 test: fix a bunch of checks for a given switch
The has_switch() function returns -1 if the device doesn't have the switch
capability - which is the same as "true" and how we used this so far. Fix the
checks.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 22:32:56 +00:00
Peter Hutterer
4058c43579 evdev: a device without any seat caps is an unhandled device
If we don't have any caps, assume the device is unhandled and ignore it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 22:32:56 +00:00
Peter Hutterer
84fda690bd fallback: add missing curly braces to match the coding style
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 22:32:56 +00:00
Peter Hutterer
fc7b8d7948 touchpad: correct the tap state transitions for a palm on TOUCH_BEGIN
Where a touch is labelled as palm on TOUCH_BEGIN (edge palms) we would still
feed the touch through the tap state machine. This would trigger the PALM
transition for each state, usually reducing the touch count.

When the touches were later released, the touch count was out of sync,
resulting in an error message. In the case of #488, the trigger was
a single evdev frame with three fingers down, the third of which was an edge
palm:
- touch 1 transitions from IDLE to TOUCH
- touch 2 transitions from TOUCH to TOUCH_2
- touch 3 (the palm) transitioned from TOUCH_2 back to TOUCH

That third transition is invalid, the palm hasn't been seen by the tap state
machine so it should just be ignored.

Fix this by moving making the tap state processing conditional on a touch
state other than TOUCH_BEGIN.

Fixes #488

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 21:50:44 +00:00
Peter Hutterer
6e9477a86d test: move the check for edge palms on devices to litest proper
We'll need this in other files soon

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 21:50:44 +00:00
Peter Hutterer
120d42812e touchpad: add touch state debugging to the palm and tap state debug logs
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 21:50:44 +00:00
Peter Hutterer
75ca6dcfa3 gitlab CI: alpine needs pip explicitly installed now
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-03 21:22:56 +10:00
Peter Hutterer
2a7ea444e3 Ignore key repeat in all backends
Since we don't really care about keys in any of these backends and buttons
shouldn't autorepeat anyway, this should have no effect on functionality. But
it does guard us against potential kernel bugs like  this one:
https://www.spinics.net/lists/linux-input/msg67653.html

See https://gitlab.freedesktop.org/libinput/libinput/-/issues/447#note_468971

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-06-02 01:07:01 +00:00
Evan Goode
034226d904 Allow the flat acceleration profile for touchpads
Signed-off-by: Evan Goode <mail@evangoo.de>
2020-05-27 06:21:00 +00:00
Peter Hutterer
0d06bfc4e2 tablet: add support for sendevents on tablets
This is merely the simple support that we use in the fallback backend as
well. It doesn't interact with touch arbitration directly but it'll be
good enough for the default use-case.

Fixes #476

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-26 05:11:01 +00:00
Hans de Goede
3618129496 quirks: Add HP stream x360 11 ModelTabletModeNoSuspend keyboard quirk
The HP stream x360 11's embedded-controller filters out events form its
builtin keyboard when in tablet-mode itself; and it has a capacitive
home-button (windows logo) underneath its display which also sends
PS/2 key-events.

Suspending the keyboard while in tablet-mode also disable the capacitive
home button, which is undesirable.

Add a ModelTabletModeNoSuspend quirk so that the home button keeps working
when in tablet-mode. This can safely be done since the rest of the
keyboard gets disabled by the embedded-controller for us.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2020-05-22 04:06:40 +00: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
ba24c95b05 test: add a test for disabling the forced prox out
This somewhat duplicates the existing test
huion_static_btn_tool_pen_disable_quirk_on_prox_out

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-22 03:10:06 +00:00
Peter Hutterer
0b221c6c97 tablet: handle a valid prox-out sequence after a forced proximity out
With the previous patches a tablet would ignore a valid proximity out sequence
where it happends after a forced prox-out. Fix this by checking the state when
we're in forced proximity out - if we have a zero tool state but a tool
updated then we did get a proximity out.

And fix the existing test to check for that case.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-22 03:10:06 +00:00
Peter Hutterer
c457050d44 Revert "tablet: don't disable the proximity quirk on good sequences"
This quirk was introduced for #248 was caused by buggy input-wacom drivers,
not by actual firmware, see
https://gitlab.freedesktop.org/libinput/libinput/issues/381#note_279371

This appears to be the only tablet where this fix was needed, but we've been
playing whack-a-mole ever since to work around the various other tablets that
break with this behavior in place.

So let's revert that fix and hope there aren't any other tablets out there
(and if they are, we can probably quirk those). The revert makes the ISDV4 pen
quirk obsolete (see 9cb089f2b6), so this was
folded into this commit.

This reverts commit 4f63345b60.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-22 03:10:06 +00:00
Matt Mayfield
73870d938e touchpad: restore thumb detection while keeping fixes from !292
!292 improved libinput's ability to detect multiple-finger clicks when
the fingers were not aligned close to horizontally. However that caused
thumb detection to fail in several use cases.

This patch restores thumb detection for
- 2+ finger physical clickpad presses
- resting thumb while two-finger scrolling
- touches in the thumb exclusion area during multi-finger taps
and improves pinch detection when thumb is centered below fingers.

It also further enhances the flexibility of finger position for 2-, 3-,
or 4-finger taps: if all tapping fingers land on the touchpad within a
short time (currently 100ms), they will all count regardless of
position (unless below the lower_thumb_line).

Signed-off-by: Matt Mayfield <mdmayfield@yahoo.com>
2020-05-22 02:16:05 +00:00
Peter Hutterer
4ff6d6e317 Deprecate wheel tilt as separate axis source
This has never been supported through the stack. No device ever had the
required MOUSE_WHEEL_TILT_VERTICAL/HORIZONTAL udev property set, so
libinput never set the right axis source. Neither weston nor mutter
added the code for it. Even if we added wheel tilt for devices now, it
would break those devices. And the benefit we get from having those
separate is miniscule at best.

So let's do the long-term thing and just deprecate this axis source.

The wheel tilt mouse test device remains in the test suite, with the
udev properties set just to verify that we do indeed ignore those now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-21 07:29:44 +00:00
Peter Hutterer
152837f44a quirks: mark the 0x233 razer keyboard as internal
Razer Blade 2018 has a different model ID than the one we already have.

Fixes #489

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-21 13:34:28 +10:00
Peter Hutterer
bd7b91065b evdev: warn if our event processing lags by 10ms or more
Take a snapshot of the time every 10 libinput_dispatch() calls. During event
processing, check if the event timestamp is more than 10ms in the past and
warn if it is. This should provide a warning to users when the compositor is
too slow to processes events but events aren't coming in fast enough to
trigger SYN_DROPPED.

Because we check the device event time against the dispatch time we may get
warnings for multiple devices on delayed processing. This is intended, it's
good to know which devices were affected.

In the test suite we need to ignore the warning though, since we compose the
events in very specific ways it's common to exceed that threshold
(particularly when calling litest_touch_move_to).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-13 06:21:27 +00:00
Peter Hutterer
2ff0c3427d test: fix the lookup for the timer offset warnings
This was changed in 5e25bdfb03 but the litest
message lookup wasn't changed. Let's do that now and change to a generic
wording we can re-use for other messages.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-13 06:21:27 +00:00
Peter Hutterer
bfccf5c405 touchpad: correct a comment regarding the touchpad integration
The previous text wasn't accurate enough, USB used to be considered
external but we've since started deferring to the hwdb for those (except
Apple).

Fixes #483

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-05-12 13:46:57 +10:00
Troels Blicher Petersen
50ee371c59 Lenovo X201 Tablet: Added bezel buttons support in tablet mode
This patch allows the bezel buttons,
to work when entering SW_TABLET_MODE
similar to how other x2xx tablets are
working.

Signed-off-by: Troels Blicher Petersen <troels@newtec.dk>
2020-05-08 13:18:09 +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
58cf854124 gitlab CI: Ubuntu 19.04 is EOL, drop it
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-18 05:17:52 +00: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
e48a316c02 gitlab ci: fix a templating whitespace issue
For some reason I'm too tired to investigate, the whitespace in the CI is
different than the locally generated one. Alpine must've updated something, I
guess. Quickfix it by adjusting the whitespace so it's correct again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-16 15:45:05 +10: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
c4cb4da33a util: make the trace macro actually useful
This has been there for years and I never used it. Much better to convert it
to a generically useful one (i.e. one that prints red so it's easy to see) and
make it unconditional.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-04-04 21:10:40 +10:00
Peter Hutterer
72af32c89e tablet: use the AttrPressureRange quirk for tablets too
The Aiptek 8000U has a pressure offset above our default (%5) but no
meaningful way of detecting that. It doesn't provide distance or BTN_TOOL_PEN
either, so our heuristics can't hook onto anything. BTN_TOUCH is set by this
tablet but not at consistent pressure thresholds.

Work around this by shipping a quirk that ups it to 70. Aiptek
re-uses USB IDs because of course they do, so this applies to more than one
device. Let's see what breaks.

Fixes #462

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-31 02:49:24 +00: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
9351f54d1c Fix race condition causing duplicate devices in udev seats
There is a race between adding the udev monitor and enumerating current
devices. Any device added in that window will show up in both lists, causing
it to be added twice.

Fix this by comparing the syspath of any added device to the existin ones in
the seat - where it matches we can ignore the device.

Fixes #459

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 03:48:25 +00:00