Commit graph

2947 commits

Author SHA1 Message Date
Konstantin Kharlamov
400aadd53a touchpad: add wobbling detection
The details are explained in comment in the code. That aside, I shall
mention the check is so light, that it shouldn't influence CPU
performance even a bit, and can blindly be kept always enabled.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104828

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-03-02 08:58:36 +10:00
Konstantin Kharlamov
e8dffbd73a touchpad: remove the code for disabling hysteresis
Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-03-01 16:35:13 +10:00
Peter Hutterer
e43bd4ae3a touchpad: move the hysteresis into its own substruct
Prep work for the wobbling detection patch

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
2018-03-01 16:34:24 +10:00
Peter Hutterer
223c914847 tools: remove a stray perror() in libinput-record
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 12:51:27 +10:00
Peter Hutterer
f1c0f28bca tools: fix two scan-build errors in libinput-record
division by 0 and an unused variable

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 12:48:48 +10:00
Peter Hutterer
d25aa301b1 doc: more references to libinput-record
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 12:19:44 +10:00
Peter Hutterer
b02579121b tools: add --all to libinput-record
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 11:50:46 +10:00
Peter Hutterer
4072db4c38 doc: add a section to the tools page for record/replay
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 11:50:46 +10:00
Peter Hutterer
578151da61 tools: add a libinput-replay tool
Similar in style to evemu-play but parses the YAML printed by
libinput-record. Note that this tool requires python-libevdev which is a new
package and may not be packaged by your distribution. Install with pip3 or
alternatively, just ignore libinput-replay, it's a developer tool only anyway.

User-visible differences to evemu-play:
* supports replaying multiple devices at the same time.
* no replaying on a specific device, we can add this if we ever need it
* --verbose prints the event to stdout as we are replaying them. This is
  particularly useful on long recordings - once the bug occurs we can ctrl+c
  and match up the last few lines with the recordings file. This allows us to
  e.g. drop the rest of the file.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 11:50:46 +10:00
Peter Hutterer
576f2ed2a7 tools: add a libinput-record tool
This is a tool that does effectively the same job as evemu-record.
evemu has two disadvantages: its API is clunky and hard to extend even for
simple features. And it has a custom file format that requires special
processing but is difficult to extend and hard to write manually. e.g. the
bitmasks require keeping a line number state to know which bit an entry refers
to.

libinput-record records the same data but the output is YAML. That can be
processed easier and extended in the future without breaking the parsing. We
can (in the future) also interleave the evemu output with libinput's debug
output, thus having a single file where the events can be compared and
analysed without the need for replaying.  Likewise, we can easily annotate the
file with parsable bits of information without having to shove all that into a
comment (like version numbers of libinput, kernel, etc).

User-visible differences to evemu-record:
* the output file requires an explicit -o or --output-file argument
* no evemu-describe equivalent, if you just want the description simply cancel
  before any events are sent
* to see key codes, a --show-keycodes flag must be supplied, otherwise all
  'normal' keys end up as KEY_A. This protects against inadvertent information
  leakage
* supports a --multiple option to record multiple devices simultaneously. All
  recordings have the same time offset, it is thus possible to reproduce bugs
  that depend on the interaction of more than one device.

And to answer the question of: why a printf-approach to writing out yaml
instead of a library, it's simply that we want to be able to have real-time
output of the recording.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 11:50:46 +10:00
Peter Hutterer
39b806089c touchpad: don't do speed-based thumb detection on single-touch or semi-mts
Because life is too short for this

https://bugs.freedesktop.org/show_bug.cgi?id=105265

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-01 11:23:07 +10:00
Peter Hutterer
4eb420b16e test: fix an incomplete comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-28 17:43:30 +10:00
Peter Hutterer
4b10af94a8 meson.build: bump to 1.10.900
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-28 17:43:30 +10:00
Peter Hutterer
5b29be3998 tools: fix inverse up/down threshold handling in measure touch-size
https://bugs.freedesktop.org/show_bug.cgi?id=105264

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-27 15:17:39 +10:00
Peter Hutterer
f1b740022a udev: fix flake8-3 complaint in parse_hwdb.py
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-27 14:36:08 +10:00
Peter Hutterer
601a18a602 Whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-27 14:36:08 +10:00
Konstantin Kharlamov
d133dc9440 indentation: add .dir-locals.el for emacs
It's pretty basic as compared to e.g. one of Mesa, but I don't see what
else could be needed, and if anything, it can be added later.

Signed-off-by: Konstantin Kharlamov <Hi-Angel@yandex.ru>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-26 18:44:00 +10:00
Peter Hutterer
59550ed21c tools: fix option parsing in libinput measure
Missing '+' in the optstring caused it to evaluate all options. If any
argument was passed to a subcommand, libinput-measure would throw an error and
exit.

https://bugs.freedesktop.org/show_bug.cgi?id=105246

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-26 13:53:40 +10:00
Peter Hutterer
963a7600f1 tools: remove pressure copy/paste leftovers from measure touch-size
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-26 13:53:40 +10:00
Peter Hutterer
3e77f2e9f5 evdev: remove excessive debugging output
Accidentally committed in 2a378beab0

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-23 10:47:08 +10:00
Peter Hutterer
2a378beab0 touchpad: delay arbitration by 90ms after touch toggle
When drawing on a tablet, the hand usually rests on the device, causing touch
events. The kernel arbitrates for us in most cases, so we get a touch up
and no events while the stylus is in proximity. When lifting the hand off in a
natural position, the hand still touches the device when the pen goes out of
proximity. This is 'immediately' followed by the hand lifting off the device.

When kernel pen/touch arbitration is active, the pen proximity out causes a
touch begin for the hand still on the pad. This is followed by a touch up when
the hand lifts which happens to look exactly like a tap-to-click.

Fix this by delaying the 'arbitration is now off' toggle, causing any touch
that starts immediately after proximity out to be detected as palm and
ignored for its lifetime.

https://bugs.freedesktop.org/show_bug.cgi?id=104985

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-21 15:58:35 +10:00
Peter Hutterer
56fd071412 evdev: pass the time down to toggle_touch
Currently unused, will be used in later patches

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-21 15:13:08 +10:00
Peter Hutterer
da74aab7f7 touchpad: change the stylus palm arbitration to process touches
Previously, on touch toggle (invoked by the tablet when a pen goes in
proximity) the touchpad cleared the state and ignored any events. Since we
ignore touches that we didn't see the touch begin for, this handled the cases
of a touch remaining after proximity out.

This code pre-dates palm detection, so let's take the bluetack off and instead
integrate it with proper palm detectino.
2018-02-21 15:13:08 +10:00
Peter Hutterer
402b179bc7 touchpad: reset the palm state to NONE on a new touch
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-21 15:13:08 +10:00
Peter Hutterer
8353eeb5a8 meson: add the 221 version to the libsystemd dependency
The sd-bus interface we're using wasn't public until 221.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-21 13:56:08 +10:00
Peter Hutterer
01a633b6eb touchpad: only begin fake touches when we have at least one finger down
If a single-touch touchpad drops below the pressure threshold in the same
frame where a fake finger is added, we begin a fake touch here. The subsequent
loop ends this fake touch because real_fingers_down is 0.

This causes the tapping code to have a mismatch of how many fingers are down
because it never sees the touch begin event for that finger.

https://bugs.freedesktop.org/show_bug.cgi?id=105160
2018-02-20 15:48:06 +10:00
Peter Hutterer
8f71cb40fe test: send major/minor for the wacom intous 5 finger device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-20 15:48:06 +10:00
Peter Hutterer
dd096a50fe touchpad: add a touch index for debugging
Makes debugging a bit easier when you know *which* touch was marked as palm,
etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-20 15:45:01 +10:00
Peter Hutterer
6020ce7c9f touchpad: compress a statement
Having this initialized and then changed later is more confusing that having
the trinary here in one line
2018-02-20 13:00:24 +10:00
Maxin B. John
920debffd7 libinput-measure-touchpad-tap: use /usr/bin/env to invoke python3
Tweak this python scripts to use '/usr/bin/env python3'

Signed-off-by: Maxin B. John <maxin.john@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-20 11:11:08 +10:00
Peter Hutterer
63880d6e1b udev: fix segfault when resuming before assigning a seat
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-16 16:57:30 +10:00
Peter Hutterer
075e998b07 Don't leak when realloc fails
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-16 16:57:30 +10:00
Peter Hutterer
da94e4e603 Silence coverity warning about uninitialized entry
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-16 16:57:30 +10:00
Quentin Glidic
b2b5cdaf61 meson: Fix absolute libdir case in install script
If libdir is an absolute path (which means it’s outside of prefix) we
would wrongly add the prefix to it in the install script. Just pass the
correct libdir from Meson directly thanks to join_paths() magic.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-16 16:57:30 +10:00
Quentin Glidic
0843fa8e5e meson: Fix bindir usage in install script
Since the install script cannot know the correct bindir, just pass it
from Meson directly.

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-16 16:57:30 +10:00
Peter Hutterer
582e3c00b7 Add a test device for aiptek tablets
This tablet advertises tilt but doesn't actually have it. Let's rule out tilt
for all aiptek devices until someone complains.

Recording from: https://bugzilla.redhat.com/show_bug.cgi?id=1535755
Related to: https://bugs.freedesktop.org/show_bug.cgi?id=104911

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 16:04:58 +10:00
Peter Hutterer
2191ed6cc0 tablet: fake a BTN_TOOL_PEN on the first event if needed
Some (?) Aiptek tablets have BTN_TOOL_PEN but aren't inclined to actually send
this on proximity in. This means we don't have a tool assigned and ignore the
events.

This patch piggy-backs on the already-existing proximity-out quirks. On the
first EV_SYN and if the tool is still NONE (i.e. no BTN_TOOL_* was received), we
pretend that we've earlier forced a proximity-out event for this tablet. This
causes the proximity-out quirk code to emulate a proximity in and we're off.
Hooray.

https://bugs.freedesktop.org/show_bug.cgi?id=104911

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 16:04:08 +10:00
Peter Hutterer
ee2b58a66f tablet: disable BTN_TOOL_MOUSE/LENS for non-Wacom tablets
Mouse and lens cursor tools are rare and the rotation calculation is quirky to
say the least. I don't have access to a non-Wacom mouse tool, so
until this changes, just disable those tools and wait for someone to shout.

This is a much easier fix than trying to figure out the correct generic
rotation calculation that may not be correct anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 16:04:08 +10:00
Peter Hutterer
26705762e2 tablet: skip tablet_flush() if our current tool type is none
If a tablet never sends a BTN_TOOL_foo, we never update the tool and we remain
on the 'none' tool.

Somewhat related to:
https://bugzilla.redhat.com/show_bug.cgi?id=1535755
https://bugs.freedesktop.org/show_bug.cgi?id=104911

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 16:04:08 +10:00
Peter Hutterer
44426b460c tablet: release the tablet state on device delete
When the device gets deleted in a non-neutral state, we need to release all
buttons, lift the tip up and send a proximity out event.

https://bugs.freedesktop.org/show_bug.cgi?id=104940

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 16:04:08 +10:00
Peter Hutterer
c897b1e2f8 tablet: move the quirk disabling up within tablet_init
Let's make sure all libevdev manipluations are done before we start
initializing anything based on the event codes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 16:04:08 +10:00
Peter Hutterer
134893790e test: make the mouse tool a litest feature bit
Aiptek tablets have the BTN_TOOL_MOUSE|LENS bits but don't actually have a
mouse, at least not in libinput (see future patches). Turns out we only have
one device that really has the tool anyway, so not running the tests for the
others seems sensible.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 16:04:08 +10:00
Peter Hutterer
3a3fd645c4 evdev: add a quirk to disable debouncing on the MS Nano Transcievers
A set of wireless devices that can scramble the timestamps, so we get
press/release within 8ms even though I doubt the user is capable of doing
this. Since they're generally good quality anyway, let's just disable
debouncing on those until someone complains and we need something more
sophisticated.

https://bugs.freedesktop.org/show_bug.cgi?id=104415

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 15:58:48 +10:00
Peter Hutterer
cb186abc17 evdev: fail before open_restricted if the devnode doesn't exist
https://bugzilla.redhat.com/show_bug.cgi?id=1536633
https://bugzilla.redhat.com/show_bug.cgi?id=1539046
https://bugzilla.redhat.com/show_bug.cgi?id=1539783
https://bugzilla.redhat.com/show_bug.cgi?id=1540662
https://bugs.freedesktop.org/show_bug.cgi?id=104278

Debugged-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-13 14:18:06 +10:00
Peter Hutterer
1b21a4317d libinput 1.10.0 2018-02-13 11:28:58 +10:00
Peter Hutterer
cbb4ec1e3e tablet: don't set rotation on a tool if we don't have ABS_Z
Rotation on a tool can either ABS_Z or in the case of the mouse/lens tools a
combination of ABS_TILT_X/Y. The code assumes that if the rotation on a stylus
(not mouse/lense) changes, we need to fetch it from ABS_Z. This happens on the
very first event from the tablet, proximity in invalidates all axes so we can
send the current state to the caller.

On libwacom-recognized tablets we never set the rotation bit on the stylus, so
that's all fine. On tablets without libwacom support, the stylus may have a
rotation bit copied because we have it set thanks to mouse+tilt on the tablet.
When that first event is handled, we try to access ABS_Z. On tablets without
ABS_Z like Aipteks, we go boom.

Fix this by checking for ABS_Z during tablet init, if we don't have that axis
then never set the rotation bit on the tool. That's the only axis where we
need this, all other axes have a single cause only and thus the tablet bits
are accurate anyway.

https://bugs.freedesktop.org/show_bug.cgi?id=104939

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-09 12:18:35 +10:00
Peter Hutterer
76cda659b7 test: add a missing proximity timeout in a tip up test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-07 10:06:29 +10:00
Peter Hutterer
2872cb4dec tablet: remove obsolete BTN_TOUCH case
We filter BTN_TOUCH in the caller, so this cannot happen here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-07 10:06:29 +10:00
Peter Hutterer
5ec1dcbfb4 tablet: drop unnecessary switch case statements
We fall through to the default statement anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-07 10:06:29 +10:00
Peter Hutterer
95242ceb4b libinput 1.9.902
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-06 19:32:56 +10:00