Commit graph

385 commits

Author SHA1 Message Date
Peter Hutterer
1962c6f2db tablet: add a quirk for the HUION PenTablet that doesn't send proximity out events
Could be fixed in the kernel, but these tablets are effectively abandoned and
fixing them is a one-by-one issue. Let's put the infrastructure in place to
have this fixed once for this type of device and move on.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Yay-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2017-09-20 09:30:06 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Peter Hutterer
eb8cfa301a test: add missing linebreak to error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-03-14 12:33:15 +10:00
Peter Hutterer
be30b28a12 Merge branch 'gcov-tests'
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-09 12:27:39 +10:00
Peter Hutterer
2dd9b77c9d test: add helper functions to filter an event
Simplest implementation for what we need right now, it turns off an event on
the evdev device and turns it back on again. This allows us to change bits in
the 'normal' event stream, such as changing the tool type without triggering
proximity events for the BTN_TOOL_PEN that all test devices send by default.

This won't work for absolute devices because we need to re-enable with a
struct input_absinfo. But we don't need that ability for now anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-09 11:54:03 +10:00
Peter Hutterer
f2f616a1fc touchpad: mark the Apple onebutton touchpad as clickfinger-default
We don't initialize click methods on devices with physical buttons. This model
is a special case, it's not a clickpad but it only has one button (because one
button is all you ever need and whatnot).

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-09 09:26:07 +10:00
Peter Hutterer
00d6b908d3 Merge branch 'touchpad-pressure-based-v2' 2017-02-03 11:41:06 +10:00
Peter Hutterer
b9b0f368cb test: fix ranged test for 'no device' tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-02-02 17:11:28 +10:00
Peter Hutterer
dc15a42d6c switch: for surface 3 tablets, write the lid open to the device
These tablets only ever give us a close event, the open event is broken. So
when we detect keyboard events, fix the kernel device's state by writing the
event to the fd.

We still sync the lid state manually, in case this fails and we don't get the
SW_LID through the normal event sequence. If it works fine, the real open
event will just be ignored.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-30 15:26:45 +10:00
Peter Hutterer
c27f9afffc test: make sure touch up resets pressure
Should be overridden by the test devices where something more fine-grained is
needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-30 10:50:28 +10:00
Peter Hutterer
cef3a8705e test: handle semi-mt devices in litest
Don't rely on the devices to handle themselves, just handle it globally

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:45 +10:00
Peter Hutterer
72ac3c1aee test: convert event handling while loops into for loops
No functional changes, just enables us to use 'continue' instead of piling up
negated conditions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:02 +10:00
Peter Hutterer
11b37080df test: allow nesting of litest_push_event_frame()
Right now, we fail if we call litest_push_event_frame() when already inside a
frame. For the semi-mt handling we need to do exactly that though, so turn it
into a counting semaphore instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:02 +10:00
Peter Hutterer
618ee6ac94 test: force a pressure of 0 when we hover a touch
As we switch to pressure-based touch detection, we need for all
pressure-capable touchpads to send pressure values. They'll do so by filling
in an axis default but that breaks our current hover code.

Make sure the hover litest helpers force a pressure of 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:01 +10:00
Peter Hutterer
7c8cecdb02 test: add two more touch..._extended functions
So we can set pressure during touch sequences

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 15:43:01 +10:00
James Ye
a817098fcb test: add tests for lid switch
Ship a custom udev rule for the test device until systemd v333 is commonplace.

Signed-off-by: James Ye <jye836@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-01-26 14:44:04 +10:00