Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
34f28a329b test: remove leftover sleep() for debugging in lid switch test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-19 11:00:50 +10:00
Peter Hutterer
53d53dd18e touchpad: don't resume a disabled touchpad
A touchpad that was disabled by toggling the sendevents option would come back
normally after a lid resume, despite still being nominally disabled.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-18 17:01:24 +10:00
Peter Hutterer
4ed0f7ee0e Merge branch 'wip/ignore-moved-touches' 2017-09-11 09:43:24 +10:00
Peter Hutterer
3d30015d5f Merge branch 'wip/sw-tablet-mode' 2017-09-11 09:02:14 +10:00
Peter Hutterer
635dc7d790 util: add a safe_atoi_base() function
For parsing hex numbers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-07 08:59:18 +10:00
Peter Hutterer
986604fd9d touchpad: if a device has a tablet mode switch, disable the touchpad
On some devices with a tablet mode switch, the touchpad is inacessible when
in tablet mode and we don't really need this except to avoid possible ghost
touches (none have been mentioned so far). On other devices like the Lenovo
Yoga, the touchpad points to the back of the device and it's hard to use the
device without accidentally using the touchpad. For those, disabling the
touchpad is the best solution.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-06 09:26:00 +10:00
Peter Hutterer
82f2dd8faa Add support for SW_TABLET_MODE
https://bugs.freedesktop.org/show_bug.cgi?id=101008

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-06 09:26:00 +10:00
Peter Hutterer
f0f6326490 evdev: move lid code to the fallback interface
This was originally designed to deal with devices that only have SW_LID. But
it can be moved into the evdev interface to avoid duplication once we have
SW_TABLET_MODE. The original assumption of the lid switch device being a
standalone device with no other switches is not true, having a separate
dispatch hurts us here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-06 09:26:00 +10:00
Peter Hutterer
d9a729e1a7 Add libinput_device_switch_has_switch()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-06 09:24:29 +10:00
Peter Hutterer
e320214091 test: make some of the switch tests more generic
Still hardcoded for lid switches, but easier to change for other switches now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-05 10:52:06 +10:00
Peter Hutterer
f9a4676044 test: add test for switch capability
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-05 10:48:19 +10:00
Peter Hutterer
e055803321 test: rename 'sw' to 'dev' for the lid tests
More in line with other tests and allows us to use 'sw' as name for the actual
switch to be toggled later. The variable name 'sw' stays in those tests where
we have touchpad/keyboard/etc. devices as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-05 10:41:27 +10:00
Peter Hutterer
aeca8739c7 test: make the lid action helper function a generic switch action helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-04 12:42:44 +10:00
Peter Hutterer
a3c5f37b28 test: rename test-lid.c to test-switch.c
So we can add other switch tests to it without confusing too many people.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-04 11:26:23 +10:00
Peter Hutterer
de5246dae0 touchpad: use motion speed to ignore accidental 2fg touches
Calculate the speed of the touch and compare it against a fixed speed limit.
If a touch exceeds the speed when a second touch is set down, that second
touch is marked as a thumb and ignored (unless it's right next to the other
finger, then it's likely a 2fg scroll).

The speed calculation is simple but has to lag behind by one sample - we reset
the motion history whenever a new finger is set down (to avoid pointer jumps)
so we need to know if the finger was moving fast *before* this happens. Plus,
with the pointer jumps we're more likely to get false positives if we
calculate the speed on actual finger down.

This is the simplest version for now, the speed varies greatly between
movements and should probably be averaged across the last 3-or-so samples.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-01 16:06:40 +10:00
Peter Hutterer
7a7595e044 test: fix the litest_touch_move_to() step counter
We were undercounting by one, causing a slight jump by (step-distance * 2) on
the last event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-01 14:55:28 +10:00
Peter Hutterer
e0c0db22e4 test: fix indentation for palm touch size test
Somehow this ended up being spaces instead of tabs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-01 14:55:15 +10:00
Peter Hutterer
32a671edcf test: add a test for removing a touch device with a finger still down
https://bugs.freedesktop.org/show_bug.cgi?id=102385

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-28 14:25:17 +10:00
Peter Hutterer
7d97bb0087 evdev: accept accelerometers if they are tagged as other devices too
Devices tagged as accelerometers may also be other devices like tablet pads.
Only ignore pure accelerometer devices but disable the accelerometer axes for
devices that have multiple types.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2017-08-28 09:19:54 +10:00
Peter Hutterer
e3e6406c4f test: fix pad ring test for small pad ranges
The current tests worked because all rings had the same range, so our error
margin covered for that. With the upcoming MobileStudio Pro 16 pad device, the
range is half and our error margins don't work anymore. Switch to a more
reliable approach that tests every integer value the wheel can send, even
though it relies on kernel filtering.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-28 09:19:54 +10:00
Peter Hutterer
00272cfbb1 Add support for LIBINPUT_IGNORE_DEVICE
The recommended way to have libinput ignore specific devices so far was to
remove the ID_INPUT* properties from the device. That may also affect other
pieces of the stack that need access to this device.

For the niche case of a device that should only be ignored by libinput but
otherwise be treated normally by the system, we now support the
LIBINPUT_IGNORE_DEVICE property.

If the property is set to "0", it's equivalent to being unset. This gets
around some technical limitations in udev where unsetting a property is
impossible via a hwdb entry.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-23 14:56:51 +10:00
Peter Hutterer
dddcc1f959 test: expose litest_create() to test cases
And make it init the full litest device minus the libinput device. This
enables us to add litest devices that aren't handled by libinput.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-23 14:56:51 +10:00
Peter Hutterer
3ddabb7739 test: fix typo in test case name
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-17 02:03:15 +02:00
Peter Hutterer
35bfab4f6e test: when restoring the log handler to defaults, also restore log priority
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-17 01:29:32 +02:00
Peter Hutterer
6d435cda06 gestures: don't try to pinch for nfingers > slots
We don't know the position of the third finger on 2-slot touchpads, differing
between swipe and pinch is reliable. Simply disable 3-finger pinch and always
use swipe; 3fg pinch is uncommon anyway and it's better to have one of the
gestures working reliably than both unreliably.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-08-01 16:42:03 +01:00
Peter Hutterer
6bb05c594a lid: disable all types but EV_SYN and EV_SW
The lid dispatch interface is a one-trick pony and can only handle SW_LID. It
ignores other switches but crashes on any event type other than EV_SW and
EV_SYN. Disable those types so we just ignore the event instead of asserting.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2017-07-27 19:00:43 +10:00
Peter Hutterer
55d1bb1217 pointer: add button debouncing
Some devices have worn-out switches or just cheap switches that trigger
multiple button events for each press. These can be identified by unfeasably
short time deltas between the release and the next press event. In the
recordings I've seen so far, that timeout is 8ms.

We have a two-stage behavior: by default, we do not delay any events but we
monitor timestamps. The first time a bouncing button is detected we switch to
debounce mode. From then on, release events are delayed slightly to check for
subsequent button events. If one occurs, the releas and press are filtered. If
none occurs, the release event is passed to the caller.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-26 00:21:46 +10:00
Peter Hutterer
399c50dbeb evdev: recover from a lost button count
If the kernel sends us a button press for a button that is thought to be down
we have lost track of the state of the button. Ignore the button press event,
in the hope that the next release makes things right again.

A release event may be masked if another process grabs the device for some
period of time, e.g. libinput debug-events --grab.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-25 09:30:24 +10:00
Peter Hutterer
87b5682824 filter: add a custom trackpoint accelerator
Switch to a pure factor with a max scaled after a function. The offset is just
0 now (will be removed eventually). Both are determined with a function based
on a linear/exponential regression of a sample set of data pairs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-20 11:53:01 +10:00
Peter Hutterer
91cbe7a11d test: drop an unnecessary wait for event
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-19 13:28:38 +10:00
Peter Hutterer
688142c8a2 Merge branch 'wip/touchpad-apple-touch-major-v2' 2017-07-14 13:47:29 +10:00
Peter Hutterer
1cf7c88ae6 test: silence a coverity warning
Value set but overwritten before use.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-12 15:39:31 +10:00
Peter Hutterer
2e4895b888 Add safe_strdup()
Return value is either NULL or a strdup'd string, depending on the input
value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-12 15:39:31 +10:00
Peter Hutterer
e71ade2755 Replace calloc calls with zalloc
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-12 10:18:08 +10:00
Peter Hutterer
d5d6d4cd53 Abort if zalloc ever fails
There's no guarantee that libinput does the right thing if memory allocation
fails and it's such a niche case on the systems we're targeting that it just
doesn't matter. Simply abort if zalloc ever fails.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-12 10:18:07 +10:00
Peter Hutterer
ca4285de66 touchpad: add touch-size-based palm detection
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 12:28:28 +10:00
Peter Hutterer
432fbc33cd touchpad: add touch-size based touch handling
Apple touchpads don't use ABS_MT_PRESSURE but they are multitouch touchpads,
so the current pressure-based handling code doesn't apply because it expects
slot-based pressure for mt touchpads.

Apple does however send useful data for ABS_MT_WIDTH_MAJOR/MINOR, so let's use
that instead. The data provided in those is more-or-less random, so we need a
hwdb entry to track the acceptable thresholds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 12:27:54 +10:00
Peter Hutterer
e08a76674a util: rename the pressure range parser to a more generic range_parser
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 12:26:17 +10:00
Peter Hutterer
f13abd202a test: loosen up litest to allow major/minor handling
The max values on ABS_MT_TOUCH_MAJOR/MINOR aren't hard limits, they basically
represent the size of a finger with (afaict) a suggestion that anything
greater than the max may be a palm. Disable the 0-100% range checks for those
axes so we can send custom events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 12:26:17 +10:00
Peter Hutterer
4af403ab5e test: force-release major/minor on the default touch up
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 12:26:17 +10:00
Peter Hutterer
9e5d1df4bb touchpad: set keyboard to non-active when the keyboard is removed
If the keyboard is removed while dwt thinks it is in active state, that state
is never reset and subsequent touches are ignored.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-11 11:42:27 +10:00
Peter Hutterer
756c7e3dac timer: add a timer name to each timer
So we have something useful to print when we trigger an error in the timer
code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-10 12:00:50 +10:00
Peter Hutterer
7b5ca6204b Fix a few things scan-build complains about
Uninitialized variables, potential NULL dereferences, dead assignments and an
unused return value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-10 10:37:58 +10:00
Ming-Yang Lu
5dc330bdea touchpad: add upper edge into exclusion zone
This reduces unexpected cursor moves when placing the thumb near the border
of trackpoint buttons and upper edge of touchpad.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-10 09:33:24 +10:00
Peter Hutterer
9ddf8a6421 test: skip double-initialization of all_tests lists
Already done in main(), this here is a leftover from having multiple mains fro
different tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-07 09:58:45 +10:00
Peter Hutterer
6060abc3b3 test: fix some tap palm detection tests
Without the timeout we're not guaranteed that the tap button event triggers

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-06 10:26:45 +10:00
Peter Hutterer
50550e9811 test: add missing check for an empty queue to the palm detection test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-06 10:26:45 +10:00
Peter Hutterer
7e06b47018 test: stop changing argv[0] for forked tests
This was useful when we had a small number of test-forks with the suites
distributed. It helped debug which one is still running and then which suites
are in it. Now that we simply distributed everything across the forks it
doesn't have a lot of usefulness and it interferes with the ability to
backtrace properly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-06 09:33:18 +10:00
Peter Hutterer
a31e4b818c test: remove failing thumb edge scroll test
Broken since the merge of palm pressure detection in
25d54b90d, not sure why the test suite succeeded on that one nonetheless.

I'm not 100% sure why the test does what it does but it seems to be testing
that a wide touch on the side still striggers edge scrolling and not the thumb
detection on the bottom of the touchpad. That is obsolete now, it's hard to
generically figure out the small gap between thumb and palm pressure, so this
test almost always triggers palm detection. It's obsolete.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-06 09:33:18 +10:00
Peter Hutterer
ca9d6a88d7 Merge branch 'wip/touchpad-palm-pressure' 2017-07-04 13:57:32 +10:00