platform/upstream/libinput.git
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>
7 years agotools: when the command isn't installed, print that
Peter Hutterer [Thu, 9 Nov 2017 05:17:37 +0000 (15:17 +1000)]
tools: when the command isn't installed, print that

Makes it more user-friendly to be able to split the tools into multiple
packages

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: fix missing words in man page
Peter Hutterer [Thu, 9 Nov 2017 03:51:35 +0000 (13:51 +1000)]
tools: fix missing words in man page

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotimer: require a timer name
Peter Hutterer [Thu, 9 Nov 2017 00:40:25 +0000 (10:40 +1000)]
timer: require a timer name

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotimer: print the error messages in ms, not µs
Peter Hutterer [Thu, 9 Nov 2017 00:39:13 +0000 (10:39 +1000)]
timer: print the error messages in ms, not µs

A lot easier to understand and we're not that precise anyway

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: add an extra linebreak before closing
Peter Hutterer [Thu, 9 Nov 2017 00:32:51 +0000 (10:32 +1000)]
tools: add an extra linebreak before closing

Just puts the ^C from the Ctrl+C on a separate line to make it easier to spot

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add the wmi hotkeys test device
Peter Hutterer [Mon, 6 Nov 2017 05:28:04 +0000 (15:28 +1000)]
test: add the wmi hotkeys test device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotimer: print the time delta unit when the timer offset causes an error
Peter Hutterer [Wed, 8 Nov 2017 04:19:51 +0000 (14:19 +1000)]
timer: print the time delta unit when the timer offset causes an error

Because we use ms in most other things that matter, having µs here can cause
confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoevdev: print the timestamps for events when debugging events
Peter Hutterer [Wed, 8 Nov 2017 04:18:06 +0000 (14:18 +1000)]
evdev: print the timestamps for events when debugging events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: add a missing libinput_dispatch() to the debounce_timer test
Peter Hutterer [Wed, 8 Nov 2017 03:52:04 +0000 (13:52 +1000)]
test: add a missing libinput_dispatch() to the debounce_timer test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: add a FAQ regarding "please add a configuration option"
Peter Hutterer [Wed, 8 Nov 2017 11:38:13 +0000 (21:38 +1000)]
doc: add a FAQ regarding "please add a configuration option"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: move the tap state bug messages to a helper function
Peter Hutterer [Mon, 6 Nov 2017 04:22:06 +0000 (14:22 +1000)]
touchpad: move the tap state bug messages to a helper function

There's no need for a custom error message everywhere, it's better to log the
current state and the event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: reduce the multitap range
Peter Hutterer [Fri, 3 Nov 2017 06:22:54 +0000 (16:22 +1000)]
test: reduce the multitap range

if it works for 3, 4, 5, it'll work for above that too

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agocircle.yml: add libsolv to the fedora packages
Peter Hutterer [Sun, 5 Nov 2017 23:23:45 +0000 (09:23 +1000)]
circle.yml: add libsolv to the fedora packages

Works around the dnf error on the fedora docker image
"BDB1539 Build signature doesn't match environment"

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

Suggested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: Handle LIBINPUT_SWITCH_TABLET_MODE
Stefan Brüns [Fri, 3 Nov 2017 22:01:23 +0000 (23:01 +0100)]
tools: Handle LIBINPUT_SWITCH_TABLET_MODE

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotools: Show gesture/switch capabilities in list-devices output
Stefan Brüns [Fri, 3 Nov 2017 22:22:15 +0000 (23:22 +0100)]
tools: Show gesture/switch capabilities in list-devices output

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoMerge branch 'wip/touchpad-hysteresis-issues-v2'
Peter Hutterer [Fri, 3 Nov 2017 01:00:03 +0000 (11:00 +1000)]
Merge branch 'wip/touchpad-hysteresis-issues-v2'

7 years agotest: mkdir -p the udev rules and hwdb directories
Peter Hutterer [Wed, 1 Nov 2017 04:12:01 +0000 (14:12 +1000)]
test: mkdir -p the udev rules and hwdb directories

Especially /run/udev/rules.d may not exist, causing a test suite failure.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agoRevert "test: mkdir -p the udev rules and hwdb directories"
Peter Hutterer [Thu, 2 Nov 2017 22:42:08 +0000 (08:42 +1000)]
Revert "test: mkdir -p the udev rules and hwdb directories"

recursive functions are hard...

This reverts commit 8a2177b3ba18f3fd3050afa37cb194bc803ea209.

7 years agodoc: update test suite page for ninja and other recent changes
Peter Hutterer [Thu, 2 Nov 2017 00:23:50 +0000 (10:23 +1000)]
doc: update test suite page for ninja and other recent changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: fix the device name for the magic mouse test device
Peter Hutterer [Thu, 2 Nov 2017 00:21:46 +0000 (10:21 +1000)]
test: fix the device name for the magic mouse test device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agodoc: quote all paths in the doxygen file
Peter Hutterer [Wed, 1 Nov 2017 04:54:59 +0000 (14:54 +1000)]
doc: quote all paths in the doxygen file

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agocircle.yml: add ninja dist to tests
Peter Hutterer [Wed, 1 Nov 2017 01:19:08 +0000 (11:19 +1000)]
circle.yml: add ninja dist to tests

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: if we don't have a uinput device node, skip the test suite
Peter Hutterer [Wed, 1 Nov 2017 04:19:21 +0000 (14:19 +1000)]
test: if we don't have a uinput device node, skip the test suite

When running ninja dist in a container, we cannot create devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotest: mkdir -p the udev rules and hwdb directories
Peter Hutterer [Wed, 1 Nov 2017 04:12:01 +0000 (14:12 +1000)]
test: mkdir -p the udev rules and hwdb directories

Especially /run/udev/rules.d may not exist, causing a test suite failure.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: allow for multiple paired keyboards
Peter Hutterer [Mon, 23 Oct 2017 04:34:47 +0000 (14:34 +1000)]
touchpad: allow for multiple paired keyboards

needed for the razer blade keybard which provides multiple event nodes for
one physical device but it's hard/impossible to identify which one is the real
event node we care about.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
7 years agotouchpad: automatically disable the hysteresis where not required
Peter Hutterer [Thu, 26 Oct 2017 03:56:44 +0000 (13:56 +1000)]
touchpad: automatically disable the hysteresis where not required

Touchpads that require the hysteresis do not have filtering in the firmware
and holding a finger still causes continuous cursor movements. This implies
that we get a continuous stream of events with motion data.

If the finger is on the touchpad but we don't see any motion, the finger is
stationary and the touchpad firmware does filtering. In that case, we don't
need to add a hysteresis on top.

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

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