Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
ec5d7702ff quirks: disable debouncing on the VMware Virtual mice
At least on MacBooks, the host emulates two clicks 8ms apart in response to a
doubletap. Those clicks are filtered by our debouncing code.

Since these are emulated devices anyway and by definition cannot have a stuck
button, let's tag them so we don't enable the debouncing code. If the button
of the physical device is stuck, that's a problem that needs to be fixed in
the host system.

Fixes #158

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-19 00:16:15 +00:00
Peter Hutterer
430ede8266 test: add tablet-mode suspend/resume keyboard and touchpad tests
Related #155

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-16 09:26:25 +10:00
Peter Hutterer
12dc64af24 touchpad: handle a touch ending and restarting in the same frame
If a touch ends and starts again in the same frame, our touch count gets out
of whack. This later triggers an assertion when the tap touch count mismatches
the real tap count.

E: 0.105005 0003 0039 -001      # EV_ABS / ABS_MT_TRACKING_ID   -1
E: 0.105005 0003 0035 8447      # EV_ABS / ABS_MT_POSITION_X    8447
E: 0.105005 0003 0036 4479      # EV_ABS / ABS_MT_POSITION_Y    4479
E: 0.105005 0001 014a 0000      # EV_KEY / BTN_TOUCH            0
E: 0.105005 0001 0145 0000      # EV_KEY / BTN_TOOL_FINGER      0
E: 0.105005 0003 0039 0074      # EV_ABS / ABS_MT_TRACKING_ID   74
E: 0.105005 0003 0035 8388      # EV_ABS / ABS_MT_POSITION_X    8388
E: 0.105005 0003 0036 4480      # EV_ABS / ABS_MT_POSITION_Y    4480
E: 0.105005 0001 014a 0001      # EV_KEY / BTN_TOUCH            1
E: 0.105005 0001 0145 0001      # EV_KEY / BTN_TOOL_FINGER      1
E: 0.105005 0003 0000 8388      # EV_ABS / ABS_X                8388
E: 0.105005 0003 0001 4480      # EV_ABS / ABS_Y                4480
E: 0.105005 0000 0000 0000      # ------------ SYN_REPORT (0) ---------- +19ms

This is a kernel bug but let's paper over here because otherwise we crash and
that's considered impolite.

Fixes #161

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-15 14:46:53 +10:00
Peter Hutterer
df1f6ba40f touchpad: avoid motion events when moving one finger into AREA
If a 2fg scroll motion starts with both fingers in the bottom button area and
one finger moves into the main area before the other, we used to send motion
events for that finger. Once the second finger moved into the main area the
scroll was detected correctly but by then the cursor may have moved out of the
intended focus area.

We have two transitions where we may start sending motion events: when we move
out of the bottom area and when the finger moves by more than 5mm within the
button area. In both cases, check for any touches that are in the
bottom area and started at the 'same' time as our moving touch. Mark those as
'moved' to release them for gestures so we get the right finger count and
axis/gesture events instead of just motion events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-04 10:44:55 +10:00
Peter Hutterer
655f565fba touchpad: if two fingers are within the lower thumb area, they're not thumbs
The shape of the average hand implies that two fingers down within the lower
thumb area (the bottom few mm of the touchpad) cannot be thumbs without
significant contortion. So let's not mark them as thumb.

Fixes #126

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-03 14:52:36 +10:00
Peter Hutterer
a8e3f4d1a5 touchpad: ignore motion speed for hovering touches
tp_detect_thumb_while_moving() assumes that of the 2 fingers down, at least
one must be in TOUCH_UPDATE, otherwise we wouldn't have a speed to analyze for
thumb.

If a touch starts in HOVERING and exceeds the speed limit, we were previously
increasing the 'exceeded count'. This later leads to an assert() in
tp_detect_thumb_while_moving() when the second finger comes down because
although we have multiple fingers, none of them are in TOUCH_UPDATE.

This only happens when fingers 2 and 3 come down in the same event frame,
because then we have nfingers_down at 2 (the hovering one doesn't count) but
we don't yet have a finger in TOUCH_UPDATE.

Fix this twofold, first by now calculating the speed on anything but
TOUCH_UPDATE. And second by force-resetting the speed count on
TOUCH_BEGIN/TOUCH_END so we definitely cover all the hover transitions.

Fixes #150

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-02 22:32:55 +00:00
Peter Hutterer
500d03d78e fallback: cancel touches, don't just release them when we suspend
When we disable the touch device, any existing touches should be cancelled,
not just released.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-27 10:27:19 +10:00
Peter Hutterer
037bd0cc9c test: drop a condition from the safe_atou test
If sizeof(long) == sizeof(int), this test won't pass so let's drop it
altogether.

Fixes #137

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-14 10:20:40 +10:00
Peter Hutterer
e09c822fd1 udev: re-instate the model-quirks callout
This was removed accidentally as part of a9ef4ba1f3 and then completely dropped in
870ddce9e4 when the hwdb was deprecated completely. The model quirks call
is also the one that reads and sets the LIBINPUT_FUZZ property, effectively
making that code a noop.

Fixes #138

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-10 15:57:27 +10:00
Peter Hutterer
f38fae3a89 tablet: on tip down/up, force the delta to zero
We may get a pointer jump on tip down/up, see #128. For absolute coordinates
we reset the history to avoid smoothing across that jump but deltas still used
to be calculated based on the previous position to the current one. This
can result in a large jump on tip down.

Since the delta is supposed to be useful (and not physically accurate, see the
docs), let's force it to 0/0 on tip down/up to avoid that scenario.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-06 14:11:23 +10:00
Peter Hutterer
f8fec24c2f tablet: always set the changed axis bits if the coordinates differ
Because we're doing axis smoothing, we may get a nonzero delta between events
even when the real axis hasn't updated. Make sure the bit is set in this case.

One part of #128

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-09-05 16:15:35 +10:00
Peter Hutterer
65f890a352 test: abort when we detect a touch jump during the tests
We never want to accidentally trigger this one. Where we trigger them on
purpose, we can swap the log handler out first.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:12 +10:00
Peter Hutterer
7768d7d981 test: drop the sleep_ms argument
This forces events for every ~10ms now. If we want a slower movement, we need
more steps - just like a real touchpad does it.

Cocinelle spatch files were variants of:
	@@
	expression A, B, C, D, E, F, G, H, I, J, K;
	@@

	- litest_touch_move_two_touches(A, B, C, D, E, F, G, H, I)
	+ litest_touch_move_two_touches(A, B, C, D, E, F, G, H)

The only test that needed a real fix was touchpad_no_palm_detect_2fg_scroll,
it used 12ms before, now it's using 10ms so on the bcm5974 touchpad the second
finger was a speed-thumb. Increasing the events and thus slowing down the
pointer means it's a normal finger and the test succeeds again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:12 +10:00
Peter Hutterer
20a9c38db0 test: force 10ms intervals for touch moves, unless specified otherwise
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:12 +10:00
Peter Hutterer
bdc7ef8bb2 test: change a few tests to use 10ms intervals
Change a number of tests to use 10ms intervals between finger events and fix
the coordinates up accordingly to avoid pointer jumps. This is in preparation
for a test-suite wide use of 10ms intervals.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 11:26:08 +10:00
Peter Hutterer
35b100a2ef test: make the touchpad jump test more robust for timing errors
move_to() now uses delays, let's make this test more robust for timing errors
so we don't fall below the threshold movement we want to trigger.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 10:51:04 +10:00
Peter Hutterer
974425f8b7 test: don't run the 2fg pressure tap test on single-touch devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 10:50:15 +10:00
Peter Hutterer
edd336b4f8 test: fix the late tripletap test
The coordinates ended up being in the first touch detected as palm. Not
relevant for this test, but let's not do that to avoid false positives.
Also change to 10ms intervals, more realistic given the hardware.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 10:50:15 +10:00
Peter Hutterer
f1668b33f2 test: fix a touchpad test using the wrong coordinates
We moved to 60/60 before, not 50/50.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-28 10:50:14 +10:00
Peter Hutterer
74f4491f17 test: fix pad_button_ignored test to not trigger the proximity timeout
Once we start working with real event frames (i.e. intervals after SYN_REPORT)
we'll always trigger the proximity timeout here. Avoid this by sending one
event with all buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-27 17:21:45 +10:00
Peter Hutterer
3b97de9a43 test: rename the diagonal scroll test for more clarity
This one only starts with diagonal but continues vertically. Make it clearer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-27 17:21:45 +10:00
Peter Hutterer
f9b1875ab4 test: fix a DWT test, only worked because of timing success
This test only succeeded because all events were sent within the dwt timeout.
Change it to actually test the behavior of a touch being disabled by DWT and
staying disabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-27 17:21:45 +10:00
Peter Hutterer
b9b4065cda test: drop two erroneous checks in the dwt tests
These only succeeded because the test suite doesn't use frame intervals - as
soon as the time between event frames is nonzero, we may fail these.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-27 17:21:45 +10:00
Peter Hutterer
c2877fdb0c test: don't use move_to for a single-step movement
If we only want one event anyway...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-27 17:21:45 +10:00
Peter Hutterer
040892572f test: re-use code in litest_touch_move_to()
We can use the _extended version here. And it turns out the behavior was
slightly different, with the _extended version doing one step too few.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-27 17:21:01 +10:00
Peter Hutterer
eca2f8c9c6 touchpad: improve pointer jump detection
Previously, we had a hard threshold of 20mm per event frame. That is just
about achievable by really fast movements (in which case you don't care too
much about the jumps anyway because you've already hit the edge of the screen).

Sometimes pointer jumps have lower deltas that are achievable even on slower,
more likely motions. Analysis of finger motion has shown that while a delta
>7mm per event is possible, jumping _by_ 7mm between two events is unlikely
and indicates a pointer jump. So let's diff the most recent delta and the
current delta, if it increases by 7mm between two event frames let's say it's
a pointer jump and discard it.

Helps with but does not fully resolve:
https://gitlab.freedesktop.org/libinput/libinput/issues/80
https://gitlab.freedesktop.org/libinput/libinput/issues/36

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-20 10:23:21 +10:00
Peter Hutterer
fffae6fb27 test: when testing for a touch sequence, assert it's the same slot's sequence
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-14 08:54:09 +10:00
Peter Hutterer
13bda5adcb touchpad: if a finger in the button area moves by more than 5mm, release it
The software button area is currently a partially-dead area. If the finger
moves into or out of the area pointer motion works. Finger motion within the
area however does not generate motion.

The main motivation for this was to avoid accidental pointer motion when a
button is pressed. This is required for stationary fingers but once you move a
significant distance, those bets are off.

So if the finger moves by more than 5mm from where it was put down, release it
and let it move the pointer.

The full impact is largely limited to horizontal movements within the button
area because:
- leaving the finger at the bottom area for 300ms without movement triggers
  the thumb identification, so it won't move anyway.
- moving the finger north is likely to go off the button area before we
  trigger this threshold.

https://gitlab.freedesktop.org/libinput/libinput/issues/86

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 13:36:40 +10:00
Peter Hutterer
11a5f91bb7 quirks: don't allow single quotes for values
At least not opening single quotes, same as the double quotes we already have.
Add the tests for both.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:50:21 +10:00
Peter Hutterer
41d4ab3d62 tests: more tests for quirks handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:50:21 +10:00
Peter Hutterer
a897fae128 test: add tests for successful/failing parsing of various quirks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:50:21 +10:00
Peter Hutterer
33ac390aa4 test: fix quirks test for invalid bus type matches
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:50:21 +10:00
Peter Hutterer
19ea63bf23 util: tighten safe_atod parsing to only parse 'normal' numbers
We don't have a sensible use case where we want hex to double, or INF to
double, or any of that. So check the strings for invalid characters and bail
out early. Invalid characters include 'e' and whitespaces too, we don't need
those.

Small chance of things breaking: if the user-exposed calibration matrix
property was specified using hex numbers this will stop working now. I'll take
that risk.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:50:21 +10:00
Peter Hutterer
e73f6a3899 util: fail property parsing if the dimensions are 0
There is no use-case for a zero width/height in anything using that property.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:50:21 +10:00
Peter Hutterer
c8e0e94c00 test: replace hand-rolled backtrace function with gstack
Let's use something that specializes in that task and does a better job of it
than whatever we'll come up with. Due to how it's implemented the stacktrace
will always show waitpid() as frame 0 now but we can live with that.

gstack prints to stdout but litest_log() uses stderr, so we cannot just call
system(), we have do do the pipe/fork/exec/waitpid/read dance.
We could use that to filter the #0 frame showing waidpid() from gstack but
meh.

This drops the libunwind and addr2line dependency and replaces it with gstack
instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:43:45 +10:00
Peter Hutterer
335554a80e test: remove the deviceless test runner, make it a commandline arg instead
No need to rebuild everything with an ifdef, we can just use meson to pass an
argument to the test itself and filter based on that. This drops about 100
ninja targets.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:08:32 +10:00
Peter Hutterer
0d27a3399d test: switch two ints to bools
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-13 11:08:32 +10:00
Peter Hutterer
f2d1b34808 test: ensure we write something during litest_sendfile
This mostly shuts up coverity about potentially using a negative size to
write.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 10:39:58 +10:00
Peter Hutterer
3b6cb471d3 test: remove an obsolete comment
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-09 10:39:58 +10:00
Matt Mayfield
916474b09c test: touchpad: add tests for 90 degree scroll (axis lock) 2018-08-08 11:28:30 -05:00
Peter Hutterer
28fc00b5f7 test: add a 10ms delay for scrolling tests
No touchpad gives us these events with a 0 delay, so let's not test for that.

This is required for adding timing-sensitive scroll code, see
https://gitlab.freedesktop.org/libinput/libinput/issues/101.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-07 10:29:09 +10:00
Peter Hutterer
531b1bf8de test: touchpad: swap an int for a bool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-07 10:00:40 +10:00
Peter Hutterer
cbf17131b9 test: rename the x220 clickpad to something more telling
Having this as the generic "synaptics" touchpad in the tests is not helpful,
this touchpad is tiny and quite special these days.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-07 10:00:40 +10:00
Peter Hutterer
d43dc1192d tablet: unify the license text with what we have in COPYING
Use the same blurb everywhere, changing from the old style MIT to the Expat
license we're using everywhere else.

Similar to bc9f16b40e

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-07 08:37:45 +10:00
Peter Hutterer
ba603ea192 touchpad: improve finger counting for synaptics serial touchpads
A three-finger touch may cause slot N to end, in a frame after the
BTN_TOOL_TRIPLETAP. This causes tp->nfinger_down to be decremented to 2 as the
touch switches to MAYBE_END - which happens to be our num_slots. We exit early
and never restore the touch correctly.

Fix this by checking that the number of fake touches is equal to the slots, if
it is higher then we need to check for recovery.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/99

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-03 15:01:55 +10:00
Peter Hutterer
da0fbb580f fallback: add support for ABS_MT_TOOL_TYPE for touch screens
Cancel any touches that trigger MT_TOOL_PALM.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/25

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-03 14:21:18 +10:00
Peter Hutterer
abab7f1609 test: handle ABS_MT_TOOL_TYPE from the litest devices
We want to autoreplace this value where possible but not scale it to min/max,
this is effectively an enum. The same is true for slot/tracking id, so let's
add it here too.

Because it's an enum and 99% of the cases require MT_TOOL_FINGER, we always
fall back to that instead of using the axis_defaults that we use for other
axes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-03 13:29:20 +10:00
Peter Hutterer
2855e26d6f test: add test helpers for touch sequence parts
The necessary helpers to test for a touch event + one touch frame and the
extra case for the TOUCH_CANCEL in is_touch_event

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-03 13:29:20 +10:00
Peter Hutterer
a508097e98 util: remove now-unused helper functions
Obsolete with the switch to the device quirks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-08-02 15:51:47 +10:00
Peter Hutterer
708b3f0d8e test: properly release a few leaking litest device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-26 11:51:26 +10:00