Commit graph

1996 commits

Author SHA1 Message Date
Peter Hutterer
1a5474d166 tablet: add a debugging message when we force a proximity out
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-11 14:59:20 +10:00
Peter Hutterer
0f44173ff5 tablet: fix some code alignment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-08 11:19:51 +10:00
Peter Hutterer
502e54f93a tablet: add missing linebreak after error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-08 11:19:51 +10:00
Peter Hutterer
9bba14990a tablet: always enable the proximity out quirk
Don't require a quirk update, just enable this by default for all tablets. If
we get a proximity out event at the right time, the quirk is disabled for that
tablet for the rest of its lifetime. And it's virtually impossible to have a
false positive here anyway - you cannot hold the pen still enough to not
trigger events for 50ms.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-08 11:19:19 +10:00
Peter Hutterer
ca1a75a961 tablet: log a bug when a tablet switches between tools directly
We expect the kernel to transition properly for us, e.g. BTN_TOOL_PEN goes to
0, BTN_TOOL_ERASER goes to 1. Two cases have surfaced recently where this
doesn't happen and debugging this takes time - so let's warn about it to make
it obvious.

Example 1: https://github.com/linuxwacom/libwacom/issues/70
Example 2: https://gitlab.freedesktop.org/libinput/libinput/issues/259

This is just a warning, nothing more. We should just handle that case
accordingly but that requires more effort.

Fixes #260

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-04 05:51:34 +00:00
Peter Hutterer
4912e7ed4a tablet: move the current tool bits into a substruct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-04 05:51:34 +00:00
Peter Hutterer
4bb2899d00 doc/api: add since tags to all functions after 1.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-04-03 09:29:32 +10:00
Peter Hutterer
5d7c93a3d1 doc/api: improve readability of the API docs
Still not great and probably makes any professional designer's eyes bleed, but
at least it's more readable now.

Changes:
- spacing after param name so they don't cuddle up with the description
- color changes and background image removals to drop the doxygen default look
- font size changes to not make things overrun
- font family change to make the function prototypes readable

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-27 16:01:10 +10:00
Konstantin Kharlamov
3a8631a88d evdev: remove unnecessary comparison
All "goto err" resides after fd have been properly initialized.

Fixes "Comparison is always true because fd >= 0." warning by LGTM.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-03-22 00:02:24 +03:00
Konstantin Kharlamov
661a6d0169 evdev: fix "always false" comparison
Fixes "Comparison is always false because rc >= 0." warning by LGTM.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-03-21 23:57:03 +03:00
Benjamin Poirier
5e798a2a6e evdev: Rename button up and down states to mirror each other
The button up debouncing states mirror the button down states with the
addition of the spurious debouncing states. Rename the states to better
show this symmetry.
2019-03-21 01:07:59 +00:00
Paolo Giangrandi
a88d73cef4 touchpad: multitap state transitions use the same timing used for taps
Multitap sequences (more than 2 taps) had a 180ms timer set only on press,
not on release.
New taps within those 180ms could either trigger multitap+drag or another
multitap (for N+1 taps), resetting the timer on press once again.
If no new tap appears within those 180ms, the sequence was considered
complete.

This behavior differed from regular taps: for the very first tap of a
sequence the timer was set both on touch and on release.

The multitap timing caused misdetection of triple-tap-and-drag sequences as
the timer was hit frequently. Some of those were correctly detected, others
as tripletap only.

Changing the timer to be set on press **and** release gives us a more lenient
timeout. 180ms for tap-and-drag and 180ms for the next tap down after
release. This was also the behavior for the xorg synaptics driver.

Note that quadruple-tap-and-drag didn't suffer from this because the timeout
resulted in double-tap + double-tap-and-drag. Which has the same
user-visible effect.
2019-03-18 02:45:00 -06:00
Peter Hutterer
d4f5faae0d tools: move the builddir lookup function out to a separate file
We want to use this from the tests as well soon, so let's move it to a more
generic location. This also changes the API to be slightly more sensible, a
free() is the same cost (and safer) than passing a static buffer in and hoping
we didn't get the size wrong.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-14 11:28:05 +10:00
Peter Hutterer
43cbae6c68 fallback: fix grammar in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-03-04 15:47:27 +10:00
Benjamin Poirier
fa73b3b307 evdev: Do not perform spurious detection when spurious is already enabled
When exiting RELEASE_DELAYED state, do not transition into states to detect
the need for spurious mode (RELEASE_WAITING, MAYBE_SPURIOUS).
RELEASE_DELAYED is only entered when spurious mode is enabled, there is no
need to detect the need for spurious mode again.
2019-03-04 14:48:22 +10:00
Henré Botha
5dae7aac38 Reduce button scroll timeout to 38ms
When using button scrolling, a hardcoded delay of 200 milliseconds between
button down and scroll events being emitted makes fast scrolling gestures feel
clunky and sometimes fail entirely. This feature comes from
xf86-input-mouse, was copied into xf86-input-evdev and reimplemented in
libinput.

This was, as far as can be determined, to allow right clicks without
triggering scrolling. libinput now also has distance triggers (2bbf4a0117)
and sends button events if no movement has happened for long clicks,
regardless of the delay.

The 200ms delay is thus not really necessary anymore, let's drop it to 38ms
which is just above the 3-event threshold for 8/10/12ms intervals which is
most devices.

Fixes #237

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-19 10:37:05 +10:00
Peter Hutterer
eb51479485 touchpad: fix typo in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-13 06:53:51 +00:00
Peter Hutterer
8b761e2fec fallback: cancel the arbitration timer on device remove
When the touch arbitration is reset to ARBITRATION_NOT_ACTIVE, the proximity
timer is set for 90ms to avoid erroneous touches (see 2a378beab for the
reason).

If the device is removed within those 90ms, the timer is never cancelled,
leading to an assert on cleanup.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 13:46:31 +10:00
Peter Hutterer
faeaee5f20 timer: print the timers still in the list before the assert
Helps a lot with debugging if we know which timer is still there during
cleanup.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 13:46:31 +10:00
Peter Hutterer
7db3233f11 Drop the AS_MASK macro, replace with bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 13:46:31 +10:00
Peter Hutterer
6bbe03a086 Add a bit() macro
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 13:46:31 +10:00
Peter Hutterer
df527b07b4 path: limit path device nodes to PATH_MAX characters
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 03:35:53 +00:00
Peter Hutterer
4353ed9152 udev: restrict the seat ID to 256 characters
Anything longer than that is likely a bug.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-11 03:35:53 +00:00
Pascal Kockwelp
3a89f95b55 quirks: add a quirk for the Lenovo L380 (Yoga) clickpad 2019-02-11 00:02:28 +01:00
Peter Hutterer
eb48a9e9b9 evdev: fix a a compiler warning
Implicit enum conversion

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-07 14:58:59 +10:00
Peter Hutterer
5222920d44 pad: rename the include guard
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-06 14:22:03 +10:00
Peter Hutterer
b64828e79a filter: drop an unused function and an unused struct
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-06 14:22:02 +10:00
Peter Hutterer
6edf2ed5ee fallback: fix a comment typo 2019-02-06 09:38:29 +10:00
Peter Hutterer
fdf896a764 quirks: add a quirk to ignore unreliable tablet mode switch devices
On the Asus Vivobook Flip 14, the tablet mode switch is unreliable and always
on. Instead of marking every device as 'do not suspend', just mark the tablet
switch itself.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-05 09:53:23 +10:00
Benjamin Poirier
89b9d1bc5a evdev: Rename some debouncing functions for consistency
All other similar functions are named with the "_handle_event" postfix.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-04 12:04:56 +10:00
Peter Hutterer
f612c1ef0c tablet: add tilt-based touch arbitration for screen tablets
If the tilt angle on tip down is not 0 set the touch arbitration to a
rectangle around the assumed position of the hand. This assumed position is
right of the tip for a rightwards tilt and left of the tip for a leftwards
tilt (i.e. left-handed mode). The rectangle is 200x200mm with a 20x50mm
NW of the tip or NE for left-handed. In other words, if the period below is
the tip, the rectangle looks like this:

    +-----------+                          +-----------+
    | . 	| <- for rightwards tilt   |         . |
    |           |                          |           |
    |           |                          |           |
    |           |    for leftwards tilt -> |           |
    +-----------+                          +-----------+

Touches within that rectangle are canceled, new touches are ignored. As the
tip moves around the rectangle is updated but touches are only cancelled on
the original tip down. While the tip is down, new touches are ignored in the
exclusion area but pre-existing touches are not cancelled.

This is currently only implemented in the fallback interface, i.e. it will
only work for Cintiqs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
f325ca921d evdev: add a rectangle to the touch arbitration
This enables us to specify the location that needs to be arbitrated, rather
than just disabling the whole device altogether. This patch just adds the
hooks, no implementation.

This is internal API only, one backend can specify an area in mm which gets
converted to device coordinates in the target device and arbitrated there.
Right now, everything simply passes NULL.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
72560e031b fallback: force the palm state to PALM_NONE on touch begin
If we don't have tool-based palm detection, make sure our touch is labelled as
"not palm" during touch down. Otherwise that slot remains on palm forever if
it gets tagged as palm through some other means.

This currently has no effect, nothing in the code would label the touch as
palm. This is prep work for better touch arbitration.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
d3595908e5 evdev: introduce a touch arbitration enum
This enables us to change the types of touch arbitration, with the focus on
allowing location-based touch arbitration as well as the more generic "disable
everything".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
ab1dbcc996 fallback: add timer-based touch arbitration
When a hand is resting on a pen+touch device, lifting the hand may remove the
stylus from proximity before the hand leaves the surface. If the kernel
performs touch arbitration, this triggers a touch down on proximity out,
followed by a touch up immediately after when the hand stops touching.

This can cause ghost touch events. Prevent this by using a timer-based
arbitration toggle.

Same as 2a378beab0 but for the fallback
interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 05:17:28 +00:00
Peter Hutterer
caa8f3fe61 touchpad: release all button presses on device suspend
This leaves a bug open, on a Lenovo T440 generation touchpad with top software
buttons, the button will not be leased correctly. This is caused by
device->is_suspended=true by the time we try to clear the state and the
button events thus getting filtered.

This used to affect all touchpads, this patch just moves it so it only affects
the T440-like devices now.

Fixes #233

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
34b49d5118 evdev: cancel the middle button timer on device removed
If a middle-button-emulating device is removed with one button down, the timer
never gets cancelled and triggers an assert during device removal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
c75c00dac3 fallback: when force-releasing keys, release them directly
An emulated button is recorded as BTN_MIDDLE in the key down mask. If the
device is removed in that state, the BTN_MIDDLE event processed triggers
an assertion when we try to send out the event twice.

Fixes #201

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
507441537e evdev: cancel the button scroll timer on device removed
If a device was removed while a button was held down and within the timeout,
the timer was never cancelled (and removed from the timer list), triggering an
assert during device removal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-31 15:09:44 +10:00
Peter Hutterer
c412924003 quirks: enforce uppercase hex numbers
No specific reason other than consistency.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-18 04:31:53 +00:00
Konstantin Kharlamov
15e64b7b60 evdev: don't execute snprintf if not gonna print
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-01-17 13:08:14 +03:00
Konstantin Kharlamov
d9338b001c evdev: inline evdev_log_msg_va
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2019-01-17 09:10:37 +03:00
Peter Hutterer
c9728d8403 doc: add missing @ref
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-17 12:32:48 +10:00
Peter Hutterer
029c0b199a doc: correct a slightly ambiguous @ref wording
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-17 12:32:48 +10:00
Thomas Sailer
f9ec9b8f8d ModelTabletModeNoSuspend=1 is currently only honored for keyboards, but not touchpads. This commit changes that. 2019-01-03 10:15:14 +01:00
Peter Hutterer
a60b5b0f8f doc: fix doxygen references for libinput_get_user_data
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-03 12:03:39 +10:00
makepost
99bb0ee7cb util: fall back to strtod if no locale in libc
uClibc-ng has experimental locale support but it's incomplete and
disabled by default, for example in Hardened Gentoo.

Fixes #63
2018-12-22 19:58:16 +02:00
Peter Hutterer
c32bd79af5 filter: fix typo in comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-19 15:51:29 +10:00
Peter Hutterer
0cd65cf336 quirks: add a quirk for the Lenovo T480s clickpad
It's missing INPUT_PROP_BUTTONPAD but working kernel drivers prove to be
elusive. Meanwhile, add a quirk here that force-enables this bit.

Fixes #177

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-12-13 12:06:53 +10:00
Peter Hutterer
5685980437 path: don't leak the udev device on failure
If by sheer coincidence the device succeeds on the last try, we'd have a
leaking udev device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-11-07 05:03:52 +00:00