Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
281ecf10d1 udev: don't use IMPORT+=
IMPORT really only supports == and != and for a short while udevd warned about
this before that warning was reverted again.

Where anything else is used, it falls back to ==. systemd upstream rules all
use a single = though, so let's stick with that to be consistent, even if it
is technically wrong (udevd will warn about this in debug mode).

See the long discussion in systemd upstream for details:
https://github.com/systemd/systemd/issues/14062

Fixes #461

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-30 00:35:43 +00:00
Peter Hutterer
8a858fc65e test: fix a scan-build warning (value set but not read)
This test pre-dates litest_assert_empty_queue(), so let's just use that

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 10:44:17 +10:00
Peter Hutterer
05201958eb evdev: print a human time for ratelimit tests
No point in printing an interval of e.g. 2h as milliseconds, let's convert
this to something human-readable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-22 10:35:21 +10:00
Peter Hutterer
d80bbcb028 tools: record: drop quotes from os-release information
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-21 11:02:48 +10:00
Peter Hutterer
c7f06b0bdd quirks: rename the alps touchpad quirk to note it's a serial TP quirk
This quirk only applies to serial ALPS touchpads, so let's name it
accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-05 16:35:53 +10:00
Peter Hutterer
7b94955634 test: fix a coverity complaint
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-03-02 12:51:15 +10:00
Peter Hutterer
6d173f890a test: disable a bunch of tests relying on libwacom
Some of these may have a non-libwacom solution but let's be honest, you
shouldn't be skipping libwacom if you rely on tablets to be precise.

Fixes #436

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 06:45:01 +00:00
Peter Hutterer
2bfbdfaf6b test: remove double-assignment to a variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-24 01:53:21 +00:00
Peter Hutterer
06591e5913 touchpad: sync the initial tracking id state to the touchpad
Where fingers are down during startup we need to sync them to the known state
of the device so our slot count is correct. Otherwise, when the fingers are
lifted we will trigger the new assert for nactive_slots being less than 0.

Regression introduced in eb6ef9fe70

Fixes #429

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-18 17:11:35 +10:00
Peter Hutterer
1e1b9c0e60 touchpad: never reduce the slot count to 0
Where a user releases all touches during a SYN_DROPPED and then puts more than
one finger back down before we sync, we end up with nonzero fake touches but
a zero slot count. This is caused by a wrong event sequences provided by
libevdev in that case.

This really needs to be fixed in libevdev, see
https://gitlab.freedesktop.org/libevdev/libevdev/merge_requests/19

In the meantime, put a check in to ignore that case and never reduce the slot
count to 0. It still leaves us open for some issues where 3fg gestures may
stop working if the right sequences are triggered during SYN_DROPPED but
updating libevdev will eventually make that go away too.

Fixes #422

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-18 06:26:56 +00:00
Peter Hutterer
07a86b85dd tablet: don't force a proximity out while buttons are down
While buttons are down, don't let a forced proximity out happen. If the tablet
goes out of proximity normally that's fine but we don't force a proximity out.

Remains to be seen if this causes stuck buttons now on devices that rely on
the forced proximity out...

Fixes #403

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-13 04:53:27 +00:00
Peter Hutterer
ea78fef450 test: drop a wait in favor of direct event processing
We know we should have an event here, so we might as well process it
immediately to speed the error case up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-13 04:53:27 +00:00
Peter Hutterer
664ecaa152 test: fix a duplicate button down where we want a button press + release
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-13 04:53:27 +00:00
Peter Hutterer
eb085bddec test: mark the tablets that require forced prox out as such
Because certain things are hard to test when you have to guess whether a
tablet has forced proximity out or not. Currently unused, see future patches.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-13 04:53:27 +00:00
Peter Hutterer
0dcb02d369 test: add a test case for checking EVDEV_ABS overrides
Problem: it's still not a 100% check because the way real udev handles the
EVDEV_ABS overrides ignores any that are set through udev properties only. So
we manually have to trigger the keyboard builtin for our test device which
can give us false positives (e.g. it wouldn't have detected #424). But still,
it'll alert us if the actual overridden values are different to what we
expect.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-12 21:22:01 +10:00
Peter Hutterer
5a51add5f3 test: drop the #define for the litest device rules
This was more useful when we installed multiple device rules but now it's only
one file anyway. Also, this drops the inadvertant double-dash
(e.g. 99-litest--Jo7Ji8.rules) which made the file name look like some
substitution was missing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-12 19:23:36 +10:00
Peter Hutterer
71830dd460 tablet: fix the handling of axis updates after a forced proximity out
Where a pen was forced out of proximity and an eraser came into proximity
without axis updates on the prox-in, subsequent axis updates would trigger the
pen back into proximity. This resulted in two tools in proximity at once
though the new pen never went out of proximity

This would trigger crashes in various compositors/applications, see
https://github.com/xournalpp/xournalpp/issues/1141#issuecomment-578362497

The cause was a wrong condition introduced in ffd8c71e4e. We only need to
force the pen bit on if the current tool state is currently zero and no tool
update was sent with the axis event. In our case, the tool state is nonzero
already (eraser) and we can skip this bit.

Fixes #418

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-02 23:46:14 +00:00
Peter Hutterer
8705aba2ea test: add helper functions for checking proximity events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-02 23:46:14 +00:00
Peter Hutterer
736de2f9a7 test: add a comment to a test device
Just so I don't have to look up the git history next time

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-02-02 23:46:14 +00:00
Peter Hutterer
5e25bdfb03 timer: make the timer offset error a bit more user-friendly
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-31 13:03:00 +10:00
Peter Hutterer
eb6ef9fe70 touchpad: correct a wrong slot count by the kernel
alps.c hardcodes 5 slots in the kernel but some devices only provide 2 slots
plus BTN_TOOL_TRIPLETAP, etc. Fix this by counting active slots and when the
fake finger count exceeds the active slots but is still less than the number
of slots, adjust the slots themselves downwards.

And because the new test device messes with our slot count assumptions for the
various tests hardcode that one device to return 2 slots.

Fixes #408

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-29 15:58:49 +10:00
Peter Hutterer
56f1ac2b72 test: make the custom touch override methods filter-able
Let those functions return true if they handled the event or false where they
didn't. This makes it more flexible to override touches in special cases only
and fall back to the normal litest handling otherwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-29 15:58:49 +10:00
Peter Hutterer
8fdeba9ea2 test: wrap slot counting into a helper function
This is prep work for future devices that announce a wrong slot count. For the
tests this can be a problem if we rely on the correct slot count to decided
whether to run a test or not.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-29 15:58:49 +10:00
Peter Hutterer
9149c09a3b test: switch from counting slot max to num_slots
Much more human-readable this way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-09 05:58:53 +00:00
Peter Hutterer
b4fa301d1f test: simplify a slot count check
Smaller than 3 and greater or equal to 4 means - well, anything that's not 3.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-09 05:58:53 +00:00
Peter Hutterer
62df51789b test: fix some wrong touchpad slot range checks
This was excluding tests from some touchpads due to slot count confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-09 05:58:53 +00:00
Michael Forney
25a940a549 litest: Fix warnings about discarded qualifiers with check-0.13.0
check 0.13.0 introduced a new struct type TTest for test functions
instead of just a function. However, now the tcase_add_* functions use
`const Ttest *`, and since litest stores the test case in a `void *`,
we get warnings like the following:

../test/test-touchpad.c:7079:30: warning: passing argument 3 of '_litest_add' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
  litest_add("touchpad:fuzz", touchpad_fuzz, LITEST_TOUCHPAD, LITEST_ANY);

To fix this, use `const void *`, which is compatible with both APIs.

Signed-off-by: Michael Forney <mforney@mforney.org>
2020-01-03 18:31:33 -08:00
Peter Hutterer
148b147173 test: indentation fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-03 16:44:03 +10:00
Peter Hutterer
bfc4980754 test: add the test cases to the suite in the utils tests
oops...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2020-01-03 16:44:03 +10:00
Peter Hutterer
2d1bcf982a pad: add LIBINPUT_EVENT_TABLET_PAD_KEY for pad keys
The Wacom Cintiq 24HD and later tablets send specific key events for
hardware/soft buttons. KEY_PROG1..KEY_PROG3 on earlier tablets,
KEY_CONTROLPANEL, KEY_ONSCREEN_DISPLAY, and KEY_BUTTONCONFIG on later tablets.
We ignore KEY_PROG1-3 because starting with kernel 5.4 older tablets will too
use the better-named #defines.

These differ from pad buttons as the key code in itself carries semantic
information, so we should pass them on as-is instead of mapping them to
meaningless 0-indexed buttons like we do on the other buttons.

So let's add a new event, LIBINPUT_EVENT_TABLET_PAD_KEY and the associated
functions to handle that case.

Pad keys have a fixed hw-defined semantic meaning and are thus not part of
a tablet mode group.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-12-04 15:38:39 +10:00
Peter Hutterer
3ac525db19 test: write our test case results out as junit xml files
libcheck has the ability to write out XML files for test results, but
converting those into junit isn't ideal, for a number of reasons:
- junit xml is different to libcheck's xml, so not all data is available or
  useful. Especially with our litest wrappers around it.
- litest forking off tests means we have to wrap around everything anyway to
  avoid multiple forks writing to the same test file.

This is the minimal implementation since it's only user is likely the CI which
we control fairly tightly. So there are a few corners we can skip:
- no filename validation is performed by litest
- we write out a lot of junit xml files (one per litest fork). Rather than
  collating those we just rely on the CI to find the files.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-28 11:52:54 +01:00
satrmb
bba79754d6 test: fix a multitap test expecting one tap too few
The problem was masked by a missing timeout, causing one up / down pair to not yet be enqueued before reading the queue.
2019-11-26 02:34:44 +00:00
Peter Hutterer
a524cf9761 test: allow for substring matching in the various --filter- arguments
A unique substring of a test/group/device should be enough to filter, even
without surrounding it with asterisks.

This allows for things like --filter-device=t440 as opposed to the previous
--filter-device="*t440*".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 00:24:00 +00:00
Peter Hutterer
271616265b touchpad: don't allow for multifinger tapping after a move
In the current implementation, movements > threshold and timeouts usually move
to HOLD state and continue from there. Where a finger is lifted, we go back
up the diagram into the previous finger count's HOLD state.

The side-effect of this is that a tap of a finger can be counted as tap even
after a movement:

- two fingers down, move to scroll, hold down
- third finger down, third finger up

This sequence triggers an erroneous three-finger tap. Once the motion
threshold is hit by any touch, no finger must trigger 2/3 finger tap events
while any touch is down.

The false tap is only triggered where the new finger can execute a tap without
any other finger changing any property. This can be triggered on the
reporter's Dell Precision 5520 but on most other touchpads, a new finger down
will trigger slight movement, pressure or touch size updates and thus the bug
cannot be triggered.

Fixes #382

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 00:24:00 +00:00
Peter Hutterer
c5f5a0fa7b test: fix a pressure test to movement during tap
The motion event here was intended to offset the light pressure from the
extended touch down. This also causes motion past the tap threshold and won't
work with a future patch.

Make the touch "real" by simply plaing a normal movement in the current
position - the kernel will filter and we'll just update the pressure.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-15 00:24:00 +00:00
Peter Hutterer
bdd798778a test: remove the hardcoded four-job valgrind test run
Make this dependent on the number of processes too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-05 00:54:32 +00:00
Peter Hutterer
c6905dcd0b test: drop a now-obsolete test
As of d20bbfa5cb we handle the direct tool switch correctly so there's
no more warning. Which means testing for the warning is pointless.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-11-05 00:12:08 +00:00
Peter Hutterer
d20bbfa5cb tablet: handle a direct tool switch correctly
Fixes #259

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-31 23:27:39 +00:00
Peter Hutterer
2f22580deb test: remove a useless assignment
copy/paste error that makes coverity unhappy. This is the code to correctly
release all touches and the buttons have already been processed above - no
need to reassign here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-30 10:43:18 +10:00
Peter Hutterer
3819b21967 test: silence a coverity warning
Coverity complains that we call libinput_event_destroy() twice on the variable
(once in and once just outside the condition). This is technically correct but
never true because we always break the loop early for the touch up/frame events.
Let's just reset the pointers so coverity is happy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-30 10:38:59 +10:00
Peter Hutterer
cfa06b6098 test: remove some useless code triggering a coverity warning
x/y assigned but never used. Dropping those few lines gets rid of the warning
and checks the coordinates correctly now too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-30 10:29:46 +10:00
Peter Hutterer
454dd4a2cb test: make the test jobs dependent on the number of processors
Let's hope the test suite is more successful on puny VMs that way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-29 08:01:00 +10:00
Peter Hutterer
63f9923013 Add a scroll button lock feature
Scroll button locking is an accessibility feature. When enabled, the scroll
button does not need to be held down, the first click holds it logically down,
to be released on the second click of that same button.

This is implemented as simple event filter, so we still get the same behavior
from the emulated logical button, i.e. a physical double click results in a
single logical click of that button provided no scrolling was triggered.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-17 12:21:41 +10:00
Peter Hutterer
f392766155 fallback: don't send a single-touch motion if we just sent a begin
Any touch down event will also provide motion data, but we must not send a
motion event for those in the same frame as the down event.

Fixes #375

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-16 03:43:45 +00:00
Peter Hutterer
2b33445bc9 touchpad: use the same speed for scrolling as the baseline of the accel curve
Scrolling and gestures use unaccelerated motion. The idea behind it was that
at least for the default speed setting of 0, the accelerated speed and
unaccelerated speed are identical where meaningful.

The touchpad speed curve has a plateau for 'normal' speeds (i.e. not very slow
and not very fast) where the acceleration factor is constant. This is the
reference factor that the unaccelerated motion should use as well.

Since the touchpad acceleration rework in d6e5313497 the reference factor is
0.9 * TP_MAGIC_SLOWDOWN (previously the factor was 1.0 * TP_MAGIC_SLOWDOWN)
and scroll motion is thus 10% faster than the pointer movement at the default
speeds. Let's fix this and let the two match up.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-10-14 02:57:48 +00:00
Peter Hutterer
df7b82588d test: fix a coverity warning about an unused value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-30 11:18:27 +10:00
John Chadwick
8568cf1b3a tablet: Improve forced prox out behavior.
Some graphics tablets (most or all Wacom, for example) do not emit
proximity out events when the tablet pen goes out of range. To
compensate for this, libinput synthesizes proximity out events when no
events are received for a certain period of time. Unfortunately, on some
tablets, this is fairly failure prone when moving the pen slowly. As a
workaround, this patch causes libinput to avoid synthesizing proximity
out events when the pen is still in contact with the tablet pad, as
defined by the TABLET_TOOL_IN_CONTACT status.
2019-09-29 23:35:09 +00:00
John Chadwick
b71a1b6e2d test: Make udev_properties array fixed-size.
The udev_properties array is currently variable length, which causes the
tests to invoke undefined behavior on empty lists, as it attempts to
access the first array item to check if the key is NULL, which is an out
of bounds read and will fail when the struct alignment happens to line
up such that there is no padding after the list in the empty list case.

By making the udev_properties array 32 items long, it can encapsulate
every existing case, with only a fairly small amount of memory overhead,
and without requiring every single `TEST_DEVICE` call to initialize
`udev_properties`.
2019-09-26 20:06:11 -07:00
Peter Hutterer
67151ddcf5 test: don't use debounced clicks for the middle button emulation click
This used to work under valgrind up to F30 but with the F31 beta something is
now a tad slower so it triggers the timeouts before the middle emulation kicks
in.

The middlebutton timeout is 50ms and the first debounce timeout is 30ms, so if
we're late by 20ms, well, there goes the timeout.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 16:49:08 +10:00
Peter Hutterer
cb1be90439 gestures: where we have more fingers than slots, default to swipe
Fixes #360

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-25 04:10:02 +00:00