platform/upstream/libinput.git
6 years agotouchpad: add the pressure thresholds to the debugging output
Peter Hutterer [Wed, 28 Feb 2018 01:02:41 +0000 (11:02 +1000)]
touchpad: add the pressure thresholds to the debugging output

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: don't run the 2fg pressure test on single-touch touchpads
Peter Hutterer [Wed, 28 Feb 2018 04:05:31 +0000 (14:05 +1000)]
test: don't run the 2fg pressure test on single-touch touchpads

Only the appletouch has pressure and thus executed that code path

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: don't run the MT pressure test on devices without MT pressure
Peter Hutterer [Wed, 28 Feb 2018 04:24:27 +0000 (14:24 +1000)]
test: don't run the MT pressure test on devices without MT pressure

This test worked because on devices that don't use pressure the touches were
reset when BTN_TOUCH when to 0, triggering the 'ignore fake fingers when no
real fingers are down' behavior. But this is a different code path than the
pressure handling, so let's separate those tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodoc: more references to libinput-record
Peter Hutterer [Thu, 1 Mar 2018 02:19:44 +0000 (12:19 +1000)]
doc: more references to libinput-record

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: add --all to libinput-record
Peter Hutterer [Tue, 27 Feb 2018 04:25:43 +0000 (14:25 +1000)]
tools: add --all to libinput-record

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agodoc: add a section to the tools page for record/replay
Peter Hutterer [Thu, 22 Feb 2018 00:38:16 +0000 (10:38 +1000)]
doc: add a section to the tools page for record/replay

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: add a libinput-replay tool
Peter Hutterer [Thu, 23 Nov 2017 05:31:43 +0000 (15:31 +1000)]
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>
6 years agotools: add a libinput-record tool
Peter Hutterer [Thu, 23 Nov 2017 01:01:45 +0000 (11:01 +1000)]
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>
6 years agotouchpad: don't do speed-based thumb detection on single-touch or semi-mts
Peter Hutterer [Tue, 27 Feb 2018 06:18:20 +0000 (16:18 +1000)]
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>
6 years agotest: fix an incomplete comment
Peter Hutterer [Wed, 28 Feb 2018 04:31:35 +0000 (14:31 +1000)]
test: fix an incomplete comment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agomeson.build: bump to 1.10.900
Peter Hutterer [Wed, 28 Feb 2018 07:43:18 +0000 (17:43 +1000)]
meson.build: bump to 1.10.900

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotools: fix inverse up/down threshold handling in measure touch-size
Peter Hutterer [Tue, 27 Feb 2018 05:17:39 +0000 (15:17 +1000)]
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>
6 years agoudev: fix flake8-3 complaint in parse_hwdb.py
Peter Hutterer [Tue, 27 Feb 2018 00:37:28 +0000 (10:37 +1000)]
udev: fix flake8-3 complaint in parse_hwdb.py

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoWhitespace fix
Peter Hutterer [Mon, 26 Feb 2018 23:43:21 +0000 (09:43 +1000)]
Whitespace fix

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoindentation: add .dir-locals.el for emacs
Konstantin Kharlamov [Sat, 24 Feb 2018 15:55:34 +0000 (18:55 +0300)]
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>
6 years agotools: fix option parsing in libinput measure
Peter Hutterer [Mon, 26 Feb 2018 03:50:17 +0000 (13:50 +1000)]
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>
6 years agotools: remove pressure copy/paste leftovers from measure touch-size
Peter Hutterer [Fri, 23 Feb 2018 01:56:44 +0000 (11:56 +1000)]
tools: remove pressure copy/paste leftovers from measure touch-size

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoevdev: remove excessive debugging output
Peter Hutterer [Fri, 23 Feb 2018 00:46:36 +0000 (10:46 +1000)]
evdev: remove excessive debugging output

Accidentally committed in 2a378beab032d74277

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: delay arbitration by 90ms after touch toggle
Peter Hutterer [Mon, 19 Feb 2018 04:00:42 +0000 (14:00 +1000)]
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>
6 years agoevdev: pass the time down to toggle_touch
Peter Hutterer [Mon, 19 Feb 2018 04:41:50 +0000 (14:41 +1000)]
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>
6 years agotouchpad: change the stylus palm arbitration to process touches
Peter Hutterer [Mon, 19 Feb 2018 04:19:53 +0000 (14:19 +1000)]
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.

6 years agotouchpad: reset the palm state to NONE on a new touch
Peter Hutterer [Wed, 21 Feb 2018 05:08:31 +0000 (15:08 +1000)]
touchpad: reset the palm state to NONE on a new touch

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agomeson: add the 221 version to the libsystemd dependency
Peter Hutterer [Wed, 21 Feb 2018 03:56:08 +0000 (13:56 +1000)]
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>
6 years agotouchpad: only begin fake touches when we have at least one finger down
Peter Hutterer [Tue, 20 Feb 2018 03:27:57 +0000 (13:27 +1000)]
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

6 years agotest: send major/minor for the wacom intous 5 finger device
Peter Hutterer [Tue, 20 Feb 2018 05:47:41 +0000 (15:47 +1000)]
test: send major/minor for the wacom intous 5 finger device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotouchpad: add a touch index for debugging
Peter Hutterer [Tue, 20 Feb 2018 03:27:10 +0000 (13:27 +1000)]
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>
6 years agotouchpad: compress a statement
Peter Hutterer [Tue, 20 Feb 2018 03:00:24 +0000 (13:00 +1000)]
touchpad: compress a statement

Having this initialized and then changed later is more confusing that having
the trinary here in one line

6 years agolibinput-measure-touchpad-tap: use /usr/bin/env to invoke python3
Maxin B. John [Mon, 19 Feb 2018 13:32:01 +0000 (15:32 +0200)]
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>
6 years agoudev: fix segfault when resuming before assigning a seat
Peter Hutterer [Fri, 16 Feb 2018 06:42:00 +0000 (16:42 +1000)]
udev: fix segfault when resuming before assigning a seat

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoDon't leak when realloc fails
Peter Hutterer [Wed, 14 Feb 2018 05:39:07 +0000 (15:39 +1000)]
Don't leak when realloc fails

Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agoSilence coverity warning about uninitialized entry
Peter Hutterer [Wed, 14 Feb 2018 05:26:27 +0000 (15:26 +1000)]
Silence coverity warning about uninitialized entry

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agomeson: Fix absolute libdir case in install script
Quentin Glidic [Thu, 30 Nov 2017 08:23:38 +0000 (09:23 +0100)]
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>
6 years agomeson: Fix bindir usage in install script
Quentin Glidic [Thu, 30 Nov 2017 08:23:39 +0000 (09:23 +0100)]
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>
6 years agoAdd a test device for aiptek tablets
Peter Hutterer [Mon, 5 Feb 2018 00:08:47 +0000 (10:08 +1000)]
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>
6 years agotablet: fake a BTN_TOOL_PEN on the first event if needed
Peter Hutterer [Tue, 6 Feb 2018 04:22:01 +0000 (14:22 +1000)]
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>
6 years agotablet: disable BTN_TOOL_MOUSE/LENS for non-Wacom tablets
Peter Hutterer [Tue, 6 Feb 2018 03:45:34 +0000 (13:45 +1000)]
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>
6 years agotablet: skip tablet_flush() if our current tool type is none
Peter Hutterer [Fri, 2 Feb 2018 01:24:55 +0000 (11:24 +1000)]
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>
6 years agotablet: release the tablet state on device delete
Peter Hutterer [Mon, 5 Feb 2018 01:27:09 +0000 (11:27 +1000)]
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>
6 years agotablet: move the quirk disabling up within tablet_init
Peter Hutterer [Tue, 6 Feb 2018 03:44:57 +0000 (13:44 +1000)]
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>
6 years agotest: make the mouse tool a litest feature bit
Peter Hutterer [Tue, 6 Feb 2018 05:26:53 +0000 (15:26 +1000)]
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>
6 years agoevdev: add a quirk to disable debouncing on the MS Nano Transcievers
Peter Hutterer [Wed, 31 Jan 2018 06:18:15 +0000 (16:18 +1000)]
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>
6 years agoevdev: fail before open_restricted if the devnode doesn't exist
Peter Hutterer [Fri, 9 Feb 2018 09:24:15 +0000 (19:24 +1000)]
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>
6 years agolibinput 1.10.0 1.10.0
Peter Hutterer [Tue, 13 Feb 2018 01:28:58 +0000 (11:28 +1000)]
libinput 1.10.0

6 years agotablet: don't set rotation on a tool if we don't have ABS_Z
Peter Hutterer [Sun, 4 Feb 2018 23:11:42 +0000 (09:11 +1000)]
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>
6 years agotest: add a missing proximity timeout in a tip up test
Peter Hutterer [Mon, 5 Feb 2018 01:26:24 +0000 (11:26 +1000)]
test: add a missing proximity timeout in a tip up test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotablet: remove obsolete BTN_TOUCH case
Peter Hutterer [Fri, 2 Feb 2018 05:38:22 +0000 (15:38 +1000)]
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>
6 years agotablet: drop unnecessary switch case statements
Peter Hutterer [Fri, 2 Feb 2018 05:37:24 +0000 (15:37 +1000)]
tablet: drop unnecessary switch case statements

We fall through to the default statement anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput 1.9.902 1.9.902
Peter Hutterer [Tue, 6 Feb 2018 09:32:56 +0000 (19:32 +1000)]
libinput 1.9.902

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotimer: change the timer offset warning to a client bug
Peter Hutterer [Tue, 6 Feb 2018 04:10:40 +0000 (14:10 +1000)]
timer: change the timer offset warning to a client bug

This looks like a libinput bug (well, it does say "libinput bug" on the
package) but it hasn't been that for a long time. The cause is almost always
insufficient motivation to call libinput_dispatch() by the caller, or at least
not doing it with the celerity libinput demands (and deserves, if I may say
so).

Up-, down- or side-grade it to a client bug, so the outrage can be
directed elsewhere, preferably away from me. And add a section to the
documentation, just in case someone actually reads this stuff.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
6 years agoevdev: log all evdev_msg_* on one line
Peter Hutterer [Tue, 6 Feb 2018 01:51:29 +0000 (11:51 +1000)]
evdev: log all evdev_msg_* on one line

So we don't have to have newline handling in the callers. This effectively
reverts 6ab2999be90331 "test: detect linebreaks in log messages".

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
6 years agoevdev: whitespace fix
Peter Hutterer [Mon, 5 Feb 2018 06:36:49 +0000 (16:36 +1000)]
evdev: whitespace fix

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: swap KEY_POWER for KEY_VOLUMEUP on the switch key routing test
Peter Hutterer [Thu, 1 Feb 2018 05:25:34 +0000 (15:25 +1000)]
test: swap KEY_POWER for KEY_VOLUMEUP on the switch key routing test

If there's anything that listens for KEY_POWER it will likely shut down or
suspend the host. Since it doesn't matter whether we're really testing for
KEY_POWER or just any other key, let's just switch it and avoid one headache.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: don't abort for timer offset errors during valgrind runs
Peter Hutterer [Thu, 1 Feb 2018 06:45:35 +0000 (16:45 +1000)]
test: don't abort for timer offset errors during valgrind runs

Too easy to trigger with the short button debouncing offsets

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: inhibit nasty keys and switches during test runs
Peter Hutterer [Thu, 1 Feb 2018 04:23:41 +0000 (14:23 +1000)]
test: inhibit nasty keys and switches during test runs

Having the system suspend or shutdown halfway through a test run is a tad
annoying. So let's talk to logind and tell it to inhibit the various keys
we're testing.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agotest: fix udev rule for hp wmi hotkeys test device
Peter Hutterer [Thu, 1 Feb 2018 04:13:24 +0000 (14:13 +1000)]
test: fix udev rule for hp wmi hotkeys test device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agofallback: remove unused DEBOUNCE_TIME setting
Peter Hutterer [Tue, 23 Jan 2018 05:28:09 +0000 (15:28 +1000)]
fallback: remove unused DEBOUNCE_TIME setting

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agolibinput 1.9.901 1.9.901
Peter Hutterer [Wed, 10 Jan 2018 01:18:00 +0000 (11:18 +1000)]
libinput 1.9.901

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agocircleci: update to use Ubuntu 17.10
Peter Hutterer [Thu, 18 Jan 2018 23:20:41 +0000 (09:20 +1000)]
circleci: update to use Ubuntu 17.10

17.04 is EOL, and this means we can drop our meson-from-build section too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
6 years agocircleci: use meson configure rather than mesonconf
Peter Hutterer [Thu, 18 Jan 2018 23:04:14 +0000 (09:04 +1000)]
circleci: use meson configure rather than mesonconf

This broke with meson 0.44 and results in an error:
RuntimeError: Could not determine how to run Meson. Please file a bug with details.

See https://github.com/mesonbuild/meson/issues/2761

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: drop the double normalization
Peter Hutterer [Wed, 10 Jan 2018 01:48:58 +0000 (11:48 +1000)]
touchpad: drop the double normalization

Previously, touchpad deltas were converted to 1000-dpi normalized coordinates
and handled from there. This changed in bdd4264d6150f4a6248eec7e1fbf (1.6)
when the filter functions started taking device coordinates instead. Since
then, we used to convert the device delta to normalized coordinates, then
(often immediately) convert back to device coordinates, albeit for equal x/y
resolution. This isn't necessary, we can just convert the device coordinates
to x/y-equal resolution device coordinates and pass those on.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: don't disable the hysteresis unless a finger is down
Peter Hutterer [Mon, 8 Jan 2018 00:39:48 +0000 (10:39 +1000)]
touchpad: don't disable the hysteresis unless a finger is down

On the very first event, the last_motion_time set by tp_begin_touch is not yet
set because we are called before the pressure-based touch detection takes
effect. And any event timestamp is more than 80ms after a zero timestamp,
causing the hysteresis to always be disabled.

https://bugs.freedesktop.org/show_bug.cgi?id=98839#c74

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agopath: if the udev device is never initialized, bail
Peter Hutterer [Fri, 5 Jan 2018 04:30:21 +0000 (14:30 +1000)]
path: if the udev device is never initialized, bail

2000ms should be enough, if that fails let's bail completely.

Related to: https://bugs.freedesktop.org/show_bug.cgi?id=104278

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: collect test case failures and print them on each fd
Peter Hutterer [Tue, 19 Dec 2017 05:58:36 +0000 (15:58 +1000)]
test: collect test case failures and print them on each fd

When running the test suite in full fork mode, the error messages are in the
quite verbose output and searching for them is annoying. Work around this by
opening a pipe to each subprocess and writing the failed test cases to that
pipe. When all tests have finished, print the messages to stdout. This way the
failures are always the last thing printed by the test suite.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotablet: break up a long line
Peter Hutterer [Mon, 18 Dec 2017 04:41:14 +0000 (14:41 +1000)]
tablet: break up a long line

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: remove duplicate if condition
Peter Hutterer [Sun, 17 Dec 2017 22:59:17 +0000 (08:59 +1000)]
touchpad: remove duplicate if condition

This was never true, we for the first part 3 lines above and return early. So
if we get here, it's always false.

commit aa87d2b25b88b added the new condition above, so since then this code
was inactive and can be removed.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotablet: set the tip-up pressure threshold to 1%
Peter Hutterer [Fri, 8 Dec 2017 02:35:11 +0000 (12:35 +1000)]
tablet: set the tip-up pressure threshold to 1%

Some pens keep sending small amounts of pressure even when the tip is up. This
isn't always a sign of the pens worn out, it also happens on the new Pro Pen
3D models.

The X driver uses a default threshould of ~1.3% to paper over this, let's do
the same with a 1% threshold. This threshold only applies to pens that don't
already have a pressure offset anyway.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agofallback: send key events out immediately upon receiving them
Peter Hutterer [Thu, 7 Dec 2017 23:41:07 +0000 (09:41 +1000)]
fallback: send key events out immediately upon receiving them

Commit db3b6fe5f7f8 "fallback: change to handle the state at EV_SYN time"
introduced regressions for two types of event sequences.

One is a kernel bug - some devices/drivers like the asus-wireless send a key
press + release within the same event frame which now cancels out and
disappears into the ether. This should be fixed in the kernel drivers but
there appear to be enough of them that we can't just pretend it's an outlier.

The second issue is a libinput bug. If we get two key events in the same frame
(e.g. shift + A) we update the state correctly but the events are sent in the
order of the event codes. KEY_A sorts before KEY_LEFTSHIFT and our shift + A
becomes A + shift.

Fix this by treating key events as before db3b6fe5f7f8 - by sending them out
as we get them.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoInclude stdarg.h where variadic functions are used
Greg V [Thu, 30 Nov 2017 23:31:07 +0000 (09:31 +1000)]
Include stdarg.h where variadic functions are used

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomeson.build: add missing udev dependencies and linux/input.h includes
Greg V [Thu, 30 Nov 2017 23:27:05 +0000 (09:27 +1000)]
meson.build: add missing udev dependencies and linux/input.h includes

Almost everything requires libudev because libinput.h pulls it in. Make this
an explicit dependency.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: print the device in all measure tools
Peter Hutterer [Thu, 30 Nov 2017 04:21:22 +0000 (14:21 +1000)]
tools: print the device in all measure tools

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: more and more documentation about hwdb updates
Peter Hutterer [Thu, 30 Nov 2017 00:21:15 +0000 (10:21 +1000)]
doc: more and more documentation about hwdb updates

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: print out the device used for measuring the trackpoint range
Peter Hutterer [Wed, 29 Nov 2017 04:15:49 +0000 (14:15 +1000)]
tools: print out the device used for measuring the trackpoint range

Suggested in https://bugs.freedesktop.org/show_bug.cgi?id=103947#c2

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: update the pointer acceleration page for the 1.9 trackpoint accel
Peter Hutterer [Wed, 29 Nov 2017 02:47:25 +0000 (12:47 +1000)]
doc: update the pointer acceleration page for the 1.9 trackpoint accel

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: add a doc for trackpoints
Peter Hutterer [Wed, 29 Nov 2017 01:30:54 +0000 (11:30 +1000)]
doc: add a doc for trackpoints

7 years agotools: clarify PermissionError in measure-trackpoint-range
Peter Hutterer [Wed, 29 Nov 2017 01:31:10 +0000 (11:31 +1000)]
tools: clarify PermissionError in measure-trackpoint-range

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: fix dashes in man page
Peter Hutterer [Wed, 22 Nov 2017 23:41:01 +0000 (09:41 +1000)]
tools: fix dashes in man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodebounce: handle a timeout in MAYBE_SPURIOUS state
Peter Hutterer [Tue, 21 Nov 2017 06:02:13 +0000 (16:02 +1000)]
debounce: handle a timeout in MAYBE_SPURIOUS state

Sequences to trigger:
- spurious debouncing is enabled
- release a button in IS_DOWN state -> RELEASE_DELAYED
- short timeout triggers RELEASE_WAITING

If a button press now comes before the long timeout expires, we transition to
MAYBE_SPURIOUS where the long timeout may expire. In that case we should
transition to pressed state again.

Reported-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agomeson.build: bump to 1.9.900
Peter Hutterer [Tue, 21 Nov 2017 22:39:02 +0000 (08:39 +1000)]
meson.build: bump to 1.9.900

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoCorrect Lyude's Copyright assignment
Lyude Paul [Thu, 16 Nov 2017 22:40:07 +0000 (08:40 +1000)]
Correct Lyude's Copyright assignment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: work palm detection into the tap state machine
Peter Hutterer [Fri, 3 Nov 2017 00:59:36 +0000 (10:59 +1000)]
touchpad: work palm detection into the tap state machine

Unlike the already-existing thumb detection, a touch may be labelled palm at
any time, not just during the initial touch down. This requires full
integration into the tap state machine to unwind properly. For most states, a
palm detection simply ignores the finger and reverts to the most recent state.

One exception is the case of two fingers down, one finger up followed by the
remaining finger detected as a palm finger. This triggers a single-finger tap
but with timestamps that may be from the wrong finger. Since we're within a
short tap timeout anyway this should not matter too much.

The special state PALM_UP is only handled in one condition (DEAD). Once a
touch is a palm we basically skip over it from then on. If we end up in the
DEAD state after a button press we still need to handle the palm up events
accordingly to be able to return to IDLE. That transition also requires us to
have an accurate count of the real fingers down (palms don't count) so we need
a separate nfingers_down counter for tapping.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: replace a litest button with a litest key call
Peter Hutterer [Mon, 20 Nov 2017 00:58:00 +0000 (10:58 +1000)]
test: replace a litest button with a litest key call

Same thing under the hood but still...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: restore the non-debounced litest_button_click()
Peter Hutterer [Mon, 20 Nov 2017 00:49:08 +0000 (10:49 +1000)]
test: restore the non-debounced litest_button_click()

8cf6893 removed it to make search/replace easier, restore it for the tests
where we don't want debouncing to automatically be handled.

Still left in place are the various top software button cases. Because of the
button re-routing through the fallback interface we need those to be
debounced.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/button-debouncing-v3'
Peter Hutterer [Mon, 20 Nov 2017 00:15:16 +0000 (10:15 +1000)]
Merge branch 'wip/button-debouncing-v3'

7 years agoevdev: add new debouncing code
Peter Hutterer [Sun, 12 Nov 2017 23:33:50 +0000 (09:33 +1000)]
evdev: add new debouncing code

The current debouncing code monitors events and switches on when events are
too close together. From then on, any event can be delayed.

Vicente Bergas provided an algorithm that avoids most of these delays:
on a button state change we now forward the change without delay but start a
timer. If the button changes state during that timer, the changes are
ignored. On timer expiry, events are sent to match the hardware state
with the client's view of the device. This is only done if needed.

Thus, a press-release sequence of: PRP sends a single press event, a sequence of
PRPR sends press and then the release at the end of the timeout. The timeout
is short enough that the delay should not be noticeable.

This new mode is called the 'bounce' mode. The old mode is now referred to as
'spurious' mode and only covers the case of a button held down that loses
contact. It works as before, monitoring a button for these spurious contact
losses and switching on. When on, button release events are delayed as before.

The whole button debouncing moves to a state machine which makes debugging a
lot easier. See the accompanying SVG for the diagram.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agofallback: change to handle the state at EV_SYN time
Peter Hutterer [Mon, 13 Nov 2017 02:19:44 +0000 (12:19 +1000)]
fallback: change to handle the state at EV_SYN time

The previous approach was to remember the last event and flush it at the right
time. The new approach is to update the device state during the frame and send
out the events at EV_SYN time.

This gives us two advantages: we are not dependent on the kernel order of how
events come in and we can process events depending on other events in the same
frame. This will come in handy later for button debouncing.

This is also the approach we have in the touchpad and tablet backends.

Two FIXMEs are left in place, the button debouncing code and the lid switch
code. Both need to be handled in future patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agofallback: drop unused ratelimit struct
Peter Hutterer [Fri, 10 Nov 2017 05:04:43 +0000 (15:04 +1000)]
fallback: drop unused ratelimit struct

This one is present in the parent evdev device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agofallback: create the evdev-fallback.h header file
Peter Hutterer [Sun, 12 Nov 2017 23:30:30 +0000 (09:30 +1000)]
fallback: create the evdev-fallback.h header file

So we can split up evdev-fallback.c into multiple files where needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: replace litest_button_click with a debounced version
Peter Hutterer [Mon, 13 Nov 2017 22:44:47 +0000 (08:44 +1000)]
test: replace litest_button_click with a debounced version

This is via a simple search & replace. Later auditing is needed to switch
clicks that should not be debounced (e.g. touchpads) back to a non-debounced
version.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: use litest_wait_for_event() for the lid switch events
Peter Hutterer [Fri, 17 Nov 2017 00:01:05 +0000 (10:01 +1000)]
test: use litest_wait_for_event() for the lid switch events

Getting spurious test case failures in these two tests but they're not easily
reproducible. One cause may be a slight delay of the event that we're writing
to the kernel device. If that has a minor delay, we'll miss it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: replace the tap time measuring tool with a python one
Peter Hutterer [Wed, 6 Sep 2017 01:01:49 +0000 (11:01 +1000)]
tools: replace the tap time measuring tool with a python one

A lot easier to process data in python than in C.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-By: Dima Ryazanov <dima@gmail.com>
Tested-By: Dima Ryazanov <dima@gmail.com>
7 years agofallback: log an error if we failed to write the switch event
Peter Hutterer [Thu, 16 Nov 2017 04:50:26 +0000 (14:50 +1000)]
fallback: log an error if we failed to write the switch event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: fix typo in man page
Peter Hutterer [Tue, 5 Sep 2017 23:32:39 +0000 (09:32 +1000)]
tools: fix typo in man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoman: add --enable-middlebutton to debug-events man page
Peter Hutterer [Wed, 15 Nov 2017 03:32:30 +0000 (13:32 +1000)]
man: add --enable-middlebutton to debug-events man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: change a log message for consistency
Peter Hutterer [Tue, 14 Nov 2017 05:59:55 +0000 (15:59 +1000)]
touchpad: change a log message for consistency

The other tablet mode notices say "suspending ..."

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoudev: add integration flag for the Lenovo Compact Keyboard with TrackPoint
Peter Hutterer [Tue, 14 Nov 2017 05:53:12 +0000 (15:53 +1000)]
udev: add integration flag for the Lenovo Compact Keyboard with TrackPoint

From https://bugzilla.redhat.com/show_bug.cgi?id=1510814

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: fix axis mixup for the wheel click angles
Peter Hutterer [Mon, 13 Nov 2017 04:27:24 +0000 (14:27 +1000)]
evdev: fix axis mixup for the wheel click angles

vertical wheel is y, not x

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: post a SYN_REPORT after a faked trackpoint button
Peter Hutterer [Mon, 13 Nov 2017 03:29:00 +0000 (13:29 +1000)]
touchpad: post a SYN_REPORT after a faked trackpoint button

This has no real effect at the moment because the fallback interface doesn't
care much about SYN_REPORT, it processes events as they come in. But it's a
bug nonetheless, the process() callback expects correct event frames.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: fix two flake8-3 warnings
Peter Hutterer [Mon, 13 Nov 2017 04:04:03 +0000 (14:04 +1000)]
tools: fix two flake8-3 warnings

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: handle missing evdev/pyudev modules with a better error message
Peter Hutterer [Mon, 13 Nov 2017 04:04:56 +0000 (14:04 +1000)]
tools: handle missing evdev/pyudev modules with a better error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: reduce the number of separate calls to log_msg
Peter Hutterer [Wed, 8 Nov 2017 01:32:35 +0000 (11:32 +1000)]
evdev: reduce the number of separate calls to log_msg

We somewhat expect log message handlers to figure out how to prefix newlines
correctly anyway, but reducing the number of messages printed separately makes
the simple case better.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>