Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
302aaa548e Drop autotools
This also makes the gitignore files shorter and/or obsolete.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-04 13:44:07 +10:00
Peter Hutterer
d698de6e68 touchpad: send a left button event when we move out of topbuttons and click
We used to completely ignore a finger that was within the top software button
area and then moved to the main area and remained there for a timeout. This
avoids erroneous pointer movements when the user moves the finger while using
the trackpoint.

But we also ignored physical clicks, something we should not be doing. This
patch fixes that behavior: we still ignore the finger for movement, but a
physical click now triggers a left click once we've been in the area for the
timeout.

This new behavior doesn't apply within the timeout, i.e. if a finger is in the
right top button area, moves out and immediately clicks, we still trigger a
right click. This avoids erroneous switches to left-clicks when the finger is
at the edge of the button area and moves out during the press.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-04 13:43:35 +10:00
Peter Hutterer
25d54b90db touchpad: add pressure-base palm detection
If a touch goes past the fixed pressure threshold it is labelled as a palm and
stays a palm. Default value is one that works well here on a T440 and is
virtually impossible to trigger by a normal finger or thumb. A udev property
is exposed so we can handle this in the udev hwdb and the new tool introduce a
few commits ago can help finding the palm detection threshold.

Unlike the other palm detection features, once a palm goes past the threshold
it remains a palm until the touch is released. This means palm overrides any
other palm detection features. For code simplicity, we don't combine the
states but merely check for pressure before and after the other palm detection
functions. If the pressure triggers, it will trigger before anything else. And
if something else is already active (e.g. edge where the pressure doesn't work
well) it will trigger as soon as the palm is released.

The palm threshold should thus be chosen with some room to spare between the
highest finger pressure.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-07-03 15:58:13 +10:00
Peter Hutterer
3b2c47a86d test: strdup the suite and test name
The check framework takes and stores the pointer and expects it to be live for
the livetime of the test but it doesn't strdup it. We have to keep those
pointers around ourselves.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-26 18:43:59 +10:00
Peter Hutterer
be7da7f7da touchpad: ignore the tap motion threshold if fingers > slots
Do so on the synaptics serial touchpads at least, they're known to cause
cursor jumps when the third finger is down. Not detecting a tap move means
three-finger taps get more reliable on these touchpads.

This change affects gestures who now effectively have to wait for the tap
timeout to happen. It's a trade-off.

https://bugs.freedesktop.org/show_bug.cgi?id=101435
https://bugzilla.redhat.com/show_bug.cgi?id=1455443

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-26 18:43:59 +10:00
Peter Hutterer
933ab0e95f test: remove duplicate test
Copy/paste error, no functional changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-22 14:53:22 +10:00
Peter Hutterer
d2054c8188 touchpad: use the "is internal keyboard" tag to enable dwt
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-19 15:42:43 +10:00
Peter Hutterer
42ee99ee4d test: decouple our tests/test suites from the ones used by check
Check arranges the tests into suites and test cases (which then can have
multiple test functions). The primary feature for suites is the ability to
select them with environment variables and that the log messages are printed
per suite, not per test case.

We used the suites to distribute tests across the processes forked by the test
runner, but that also resulted in slow suites relying on timeouts (tap/dwt) to
take a lot longer than other suites and hold everything else up.

This patch basically drops the use of check test suites. Our test runner has a
--filter-group argument which selects on suite names, the log messages are
more useful if they immediately include the device and the test case name.

So we just save the test metatdata in our own struct and then assemble a
suite/test case on the fly for each test.

The advantage of this is that tests of the same suite are now distributed
across the forks so slow tests that rely on length timeouts are now run in
parallel. This brings the test runs down to under 6 min again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-13 10:09:55 +10:00
Peter Hutterer
b64f2382f7 test: localise the open/close function counter in the path tests
Reduces the chance of interference between tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-09 14:28:19 +10:00
Peter Hutterer
57d4d7d3b4 test: use unique names for all the test suite names
This makes it possible to run multiple test suite simultaneously on the same
host without messing up the other runs (provided that all instances use
the same udev/hwdb files). Previously, removing the udev rules/hwdb at the end
of a test run would cause test case failures in other runs that hadn't
completed yet.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
2017-06-09 07:48:55 +10:00
Peter Hutterer
a369b2c208 test: remove unused devices field from struct test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-07 14:23:47 +10:00
Peter Hutterer
09a8c5b505 test: remove unused litest_handle_events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:53 +10:00
Peter Hutterer
dbe519f176 test: limit the wait_for_event timeout to 2s
No internal timeout we have takes longer than 2s, so we can abort if we don't
succeed. This gives us a better backtrace to figure out where we're hanging
than the SIGABRT that check will eventually send us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:51 +10:00
Peter Hutterer
dcbf2c2a44 test: don't leak test warnings to stdout
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-02 10:53:50 +10:00
Peter Hutterer
e0ac0153f7 test: drop two superfluous empty queue checks
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-01 09:52:31 +10:00
Peter Hutterer
3108653e0a test: tighten some test cases
Instead of just waiting for events, use a libinput_dispatch() and assume the
event is there when we want it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-01 09:52:31 +10:00
Peter Hutterer
2704511c50 test: add an extra assert into litest_wait_for_event_of_type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-01 09:52:31 +10:00
Peter Hutterer
89ac7fd24b test: make sure we search for event node, not the parent input device
This explains the heisenbugs when running the test suite. libevdev gives us
the syspath to the /sys/.../input123 node, not the one for the event node.
The device node path is created based on the sysfs tree, so there's a
window where the device node may not exist yet but we already returned the
device node path.

In litest, we're using a udev monitor to wait until the device is ready for
us, but the path interface only takes a device node path. So what happens is:
* libevdev gives us a syspath for the input node and a device path
* the monitor receives the input node udev device and matches the syspath
* we pass that up to the caller litest_add_device_with_overrides()
  which opens the device node and adds it to libinput
* the path interface creates a udev device from the device node, which still
  points to the old device node. Things fail because we don't have the device
  we expect or it doesn't send events and eventually times out [1].

The errors triggered by this are either odd udev property mismatches or
timeouts because events are never processed.

This race is fixed by simply constructing the actual device node path we
expect from the udev device and waiting for the right device.

[1] We rely on the caller to notify us when to remove the device and thus
silently ignore ENODEV.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-06-01 09:34:33 +10:00
Peter Hutterer
0c428d6b77 Revert "lid: force the lid to open when the keyboard device is removed"
This reverts commit 1e2b66fb9a0de8956abc7d996afdd24a11893eb6.
2017-05-23 15:10:10 +10:00
Peter Hutterer
d35d122eb1 lid: force the lid to open when the keyboard device is removed
On unreliable tablets (Surface3), always force the lid switch to open when the
paired keyboard is removed. This way the lid can't be stuck in a closed state
when there's nothing attached that can actually trigger that state.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:10:10 +10:00
Benjamin Tissoires
8fbdef3aad lid: setup the keyboard notifier when pairing it
On unreliable LID switches, we might have the LID declared as closed
while it is actually not. We can not wait for the first switch event to setup
the keyboard listener: it will never occur.

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

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 15:10:10 +10:00
Peter Hutterer
1daaa07fc3 test: tighten the wakeup-on-key lid test
Having a litest_wait_for_event_of_type() in there causes us to silently
discard anything but the events we're looking for. This is risky, we want to
make sure that if we re-enable the lid that the key events arrive *after* the
lid open event, not before. So let's not paper over those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 13:03:42 +10:00
Peter Hutterer
3f6b97d4c4 test: fix a lid test
We were checking for the empty queue on the wrong context, the default context
got drained a few lines above.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-23 13:03:39 +10:00
Peter Hutterer
695facc130 test: make the initial copy file error messages more sensible
This is most likely the first error message a developer encounters when
running the test suite and the /run/udev/rules.d directory already exists.
Make it more meaningful than the current generic integer comparison failure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-15 09:02:32 +10:00
Peter Hutterer
2c818ec267 test: don't use ck_abort_msg outside of test runs
This function used to be called inside a test run a long time ago but moved to
a pre-setup stage without switching to the more generic litest_abort_msg.
The only error message we got is "check_msg.c:80: No messaging setup".

https://github.com/libcheck/check/issues/18#issuecomment-301217615

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-15 09:00:16 +10:00
Peter Hutterer
c2c97a0b01 test: install the litest device groups file
We never installed the device groups file for the tests, effectively relying
on a system copy to be installed already.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-11 11:48:39 +10:00
Peter Hutterer
211bed2c25 touchpad: pull the tap exclusion zone down to the full edge zone
This was originally left outside of the button areas in case users tap in
those zones, but we're getting false tap events in that zone.

On a 100mm touchpad, the edge zone is merely 5mm, it's acceptable to ignore
taps in that area even in the software button. We can revisit this if we see
tap detection failures in the future.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2017-05-11 10:30:04 +10:00
Peter Hutterer
e877fd605c test: suppress Python3 valgrind errors
Running through mesontest also runs parse-hwdb through valgrind and
gives us a bunch of leaks that originate within Python somewhere - we don't
care about those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-08 20:51:15 +10:00
Peter Hutterer
27c9736e27 test: disable coredumps during test suite runs
Running valgrind through mesontest produces coredumps for a lot of tests
(unclear why, the core dump merely shows a call to abort). But even without
mesontest, creating a core dump for each failed test is a bad idea - if one
fails, most likely many others fail and the coredumps quickly fill up the file
system.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-08 20:51:14 +10:00
Peter Hutterer
8dcd71b395 lid: remove the keyboard listener on remove and re-init the listener
If the event listener is added, then removed again on a lid switch on/off
event, the list is set to null. This can trigger two crashes:
* when the keyboard is removed first, the call to
  libinput_device_remove_event_listener() dereferences the null pointer
* when the switch is removed first, the call to device_destroy will find a
  remaining event listener and assert

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-05 12:50:57 +10:00
Peter Hutterer
9d1fdb0c6d touchpad: remove the lid switch listener on device_removed
Sequence triggered by the xorg driver, but basically: if the touchpad is
destroyed before the lid switch, the event listener wasn't removed and an
assertion was triggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-05 12:50:04 +10:00
Peter Hutterer
717fbc42c3 test: switch from #ifdef to #if HAVE_LIBUNWIND
We use #if everywhere else and it allows building with '-Wundef -Werror=undef'
to avoid accidental misuse.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 13:49:37 +10:00
Peter Hutterer
3c2fbabb27 test: allow running the symbols-leak-test.in script directly
With autotools, we replace the @top_srcdir@ during configure and then run teh
resulting scripts.

With meson, it's easier to just pass top-srcdir it in as argument.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2017-05-04 13:49:37 +10:00
Peter Hutterer
37397bb218 test: fix compiler warning
test-tablet.c: In function ‘proximity_in_out’:
test-tablet.c:797:20: warning: increment of a boolean expression [-Wbool-operation]
    have_tool_update++;

And tighten the test so we fail for multiple prox in events

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 12:45:23 +10:00
Peter Hutterer
d187ef44aa test: undef ck_assert_double before redefining it
check 0.11 has those macros, but they don't work the same way as our homemade
ones. So for now just #undef them

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-04 12:43:38 +10:00
Peter Hutterer
691aea6d06 touchpad: for 2/3-finger tap, use the last finger down as press time
This makes the tapping times shorter and hopefully more obvious. It also fixes
a bug where repeated tripletap (by tapping with one finger while leaving the
other two down) could cause incorrect timestamps.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28 15:37:00 +10:00
Peter Hutterer
4c0b8ba4c2 touchpad: send multitap button events with the correct timestamps
For multitap, we're one tap behind with the button clicks, i.e. we send the
first full click button on the second tap, etc. Remember the timestamps of the
touches so we can send the events with the right timestamps. This makes
tapping more accurate because the time between taps and various timeouts
matter less for double-click detection.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28 15:37:00 +10:00
Peter Hutterer
68ed1b96a8 test: enable drag lock for multitap tests
Without this enabled, we stay in the single/double tap part of the state
machine and a triple tap is just a double tap followed by a single tap.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28 15:37:00 +10:00
Peter Hutterer
e461f21c52 touchpad: fix the button timestamps for double/tripletap
Both events had the same timestamp but we have the timestamp from the original
event - use it.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-28 15:11:30 +10:00
Peter Hutterer
3ecdab130a Merge branch 'wip/touchpad-custom-pressure-values' 2017-04-26 12:38:28 +10:00
Peter Hutterer
8d5f4decb4 touchpad: move the pressure range to a hwdb entry
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-26 12:38:15 +10:00
Peter Hutterer
97d3ddb070 Merge branch 'wip/touchpad-mt-tool-palm' 2017-04-26 12:23:24 +10:00
Peter Hutterer
555ee1a989 evdev: improve default scroll button detection
Try to guess the default scroll buttons a bit better. Right now we default to
scroll button 0 (disabled) whenever a device doesn't have a middle button but
we might as well cast a wider net here as setting a scroll button only has a
direct effect when button scrolling is enabled.

Use the first extra button we find or fall back onto the right button if we
don't have any extra buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-24 10:27:32 +10:00
Peter Hutterer
9495713b05 touchpad: add MT_TOOL-based palm detection
If the touchpad driver tells us something is a palm, go with that.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-04-21 10:03:58 +10:00
Peter Hutterer
4030959f35 test: unset MOUSE_DPI for the apple magic mouse
As of systemd commit f013e99e160f385a0c02793c612ef4c8a8ffc4d7, ID_BUS is now
set for all bluetooth devices, not just those with subsystem bluetooth. This
affects the Apple Magic Mouse and sets the systemd hwdb's MOUSE_DPI value.

That value is different to the test results we currently have, causing some
tests to fail because different deltas are generated (e.g.
pointer_scroll_button).

Our udev rules are prefixed 99 and thus apply after the various system rules.
So we can't easily set ID_BUS in our rule because it'll apply after
70-mouse.rules checks for the bustype. So we'd have to detect systemd version
or so, but the easy way is to simply force MOUSE_DPI to the empty value. For
our test cases it doesn't matter if the DPI is set correctly anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-30 12:56:49 +10:00
Peter Hutterer
402be40ba9 test: fix udev rule for click count device
Assigned click counts to other, unrelated devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-30 12:09:06 +10:00
Peter Hutterer
24445374b2 test: highlight the various state machines with colors
Makes visual identification easier

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-28 18:56:38 +10:00
Peter Hutterer
6ab2999be9 test: detect linebreaks in log messages
If a single log message is composed of multiple calls (as are all from
evdev_log_*), don't prefix multiple times.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-28 18:56:38 +10:00
Peter Hutterer
0bd36f2542 test: add color to litest verbose output
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-28 18:56:38 +10:00
Peter Hutterer
937541cb82 test: align litest output messages
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-28 18:56:38 +10:00