Commit graph

2899 commits

Author SHA1 Message Date
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
Peter Hutterer
64c73d7ae6 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>
2018-02-06 19:29:26 +10:00
Peter Hutterer
d4b76be18b evdev: log all evdev_msg_* on one line
So we don't have to have newline handling in the callers. This effectively
reverts 6ab2999be9 "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>
2018-02-06 19:29:26 +10:00
Peter Hutterer
bb431ae20d evdev: whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-05 17:50:15 +10:00
Peter Hutterer
b8bef106c0 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>
2018-02-05 17:49:04 +10:00
Peter Hutterer
394f343e70 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>
2018-02-01 16:52:02 +10:00
Peter Hutterer
7175cafe78 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>
2018-02-01 16:52:02 +10:00
Peter Hutterer
39fa810b58 test: fix udev rule for hp wmi hotkeys test device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-01 14:13:24 +10:00
Peter Hutterer
dccc23a77f fallback: remove unused DEBOUNCE_TIME setting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-23 15:28:09 +10:00
Peter Hutterer
0ac4a14861 libinput 1.9.901
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-01-22 09:08:43 +10:00
Peter Hutterer
59d62ff234 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>
2018-01-19 09:24:47 +10:00
Peter Hutterer
a2a54586eb 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>
2018-01-19 09:05:44 +10:00
Peter Hutterer
937e60319b touchpad: drop the double normalization
Previously, touchpad deltas were converted to 1000-dpi normalized coordinates
and handled from there. This changed in bdd4264d61 (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>
2018-01-10 12:21:01 +10:00
Peter Hutterer
f5a9e38c90 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>
2018-01-09 13:47:42 +10:00
Peter Hutterer
932911d229 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>
2018-01-09 13:47:42 +10:00
Peter Hutterer
613ecda1cb 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>
2018-01-09 13:47:42 +10:00
Peter Hutterer
43de03a08c tablet: break up a long line
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-12-18 14:41:14 +10:00
Peter Hutterer
4da9d51b67 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 aa87d2b25b 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>
2017-12-18 14:16:26 +10:00
Peter Hutterer
61bdc05fb0 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>
2017-12-08 12:59:58 +10:00
Peter Hutterer
1c8636923b fallback: send key events out immediately upon receiving them
Commit db3b6fe5f7 "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 db3b6fe5f7 - 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>
2017-12-08 10:09:26 +10:00
Greg V
8adfac3975 Include stdarg.h where variadic functions are used
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-12-01 09:31:42 +10:00
Greg V
01917805fa 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>
2017-12-01 09:29:31 +10:00
Peter Hutterer
0b8372962b tools: print the device in all measure tools
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-30 14:26:43 +10:00
Peter Hutterer
01da0ec1cb doc: more and more documentation about hwdb updates
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-30 10:21:15 +10:00
Peter Hutterer
d1146930da 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>
2017-11-29 14:16:03 +10:00
Peter Hutterer
ac9c3f53b9 doc: update the pointer acceleration page for the 1.9 trackpoint accel
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-29 12:47:25 +10:00
Peter Hutterer
c727ee7f23 doc: add a doc for trackpoints 2017-11-29 12:11:46 +10:00
Peter Hutterer
ac1d5082fe tools: clarify PermissionError in measure-trackpoint-range
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-29 12:11:46 +10:00
Peter Hutterer
1b54b726f0 tools: fix dashes in man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-27 13:04:33 +10:00
Peter Hutterer
ac1748ef4d 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>
2017-11-22 08:44:30 +10:00
Peter Hutterer
6a8d5a6e0f meson.build: bump to 1.9.900
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-22 08:44:30 +10:00
Lyude Paul
4ebb131bc7 Correct Lyude's Copyright assignment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-21 15:33:49 +10:00
Peter Hutterer
46eab97538 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>
2017-11-20 11:31:56 +10:00
Peter Hutterer
f35bb9760e 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>
2017-11-20 11:31:56 +10:00
Peter Hutterer
3fea53c3a9 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>
2017-11-20 11:31:56 +10:00
Peter Hutterer
0e0dfe9bdf Merge branch 'wip/button-debouncing-v3' 2017-11-20 10:15:16 +10:00
Peter Hutterer
de994d135e 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>
2017-11-20 09:55:05 +10:00
Peter Hutterer
db3b6fe5f7 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>
2017-11-20 09:55:05 +10:00
Peter Hutterer
8e86f28931 fallback: drop unused ratelimit struct
This one is present in the parent evdev device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-20 09:55:05 +10:00
Peter Hutterer
87920f4992 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>
2017-11-20 09:55:05 +10:00
Peter Hutterer
8cf6893f6d 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>
2017-11-20 09:55:05 +10:00
Peter Hutterer
6f447cb8de 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>
2017-11-17 10:01:05 +10:00
Peter Hutterer
fca003d305 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>
2017-11-17 09:22:37 +10:00
Peter Hutterer
2fc394dcde fallback: log an error if we failed to write the switch event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-17 09:22:37 +10:00
Peter Hutterer
b170993b74 tools: fix typo in man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-16 13:13:28 +10:00
Peter Hutterer
13c9ef07a2 man: add --enable-middlebutton to debug-events man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-15 13:33:11 +10:00
Peter Hutterer
875ae4de1e touchpad: change a log message for consistency
The other tablet mode notices say "suspending ..."

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-11-14 15:59:55 +10:00
Peter Hutterer
c06660b314 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>
2017-11-14 15:53:12 +10:00
Peter Hutterer
eb048529b5 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>
2017-11-14 12:04:27 +10:00