platform/upstream/libinput.git
5 years agotest: add another test for thumb movements
Peter Hutterer [Tue, 18 Jun 2019 05:36:13 +0000 (15:36 +1000)]
test: add another test for thumb movements

Small movements mustn't trigger events, large movements should.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix the clickfinger thumb test
Peter Hutterer [Tue, 18 Jun 2019 05:13:05 +0000 (15:13 +1000)]
test: fix the clickfinger thumb test

This test was putting both fingers down in the thumb area. That's not
representative, it's more likely that a thumb is in the area and the second
finger clicks elsewhere. So let's test for that instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: rename/fix/move thumb tests
Peter Hutterer [Tue, 18 Jun 2019 02:08:19 +0000 (12:08 +1000)]
test: rename/fix/move thumb tests

These were supposed to test the thumb area, but the pressure exceeded the
threshold for most devices, thus ending up testing the palm detection instead.

Fix to use a timeout where possible, otherwise move them to the palm detection
code instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotouchpad: slightly change a debug message
Peter Hutterer [Tue, 18 Jun 2019 03:20:32 +0000 (13:20 +1000)]
touchpad: slightly change a debug message

Makes it clearer that thumb detection always enables area-based detection.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: disable the forced proximity out for the Dell Canvas pen
Peter Hutterer [Mon, 17 Jun 2019 03:25:59 +0000 (13:25 +1000)]
tablet: disable the forced proximity out for the Dell Canvas pen

This pen has random timeouts, often when a button is pressed. This causes a
forced proximity out (and the button release) and makes the whole device a
tad unusable.

Nothing we can detect by heuristics since it looks like other devices that
don't send proximity out events. And the timeout can be quite high, the
recording in #304 has over 800ms for one sequence.

Fixes #304

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoquirk: drop the ModelTabletNoTilt quirk
Peter Hutterer [Mon, 17 Jun 2019 04:02:07 +0000 (14:02 +1000)]
quirk: drop the ModelTabletNoTilt quirk

This quirk is unused, use AttrEventCodeDisable instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: fix double proximity out on slow proximity out pens
Peter Hutterer [Mon, 17 Jun 2019 01:18:57 +0000 (11:18 +1000)]
tablet: fix double proximity out on slow proximity out pens

Where the proximity out event is delayed by the kernel, libinput would cause
an extra proxmity in-out after the forced proximity out event.

Event sequence is basically (k: kernel, l: libinput)

k: tablet axis events
l: tablet axis events
k: nothing for $proximity timer milliseconds
l: tablet proximity out
k: proximity out event
l: proximity in event
l: proximity out event

Fixes #306

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: don't make timer offset errors fatal in gdb
Peter Hutterer [Mon, 17 Jun 2019 01:35:31 +0000 (11:35 +1000)]
test: don't make timer offset errors fatal in gdb

No way we can debug without triggering those, so let's not make them fatal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoReplace one more __builtin_popcount with bitwise test
Michael Forney [Mon, 17 Jun 2019 02:37:37 +0000 (19:37 -0700)]
Replace one more __builtin_popcount with bitwise test

__builtin_popcount might not be available and in this case, a bitwise-and
can accomplish the same task.

Signed-off-by: Michael Forney <mforney@mforney.org>
5 years agoDon't return expression in function returning void
Michael Forney [Sat, 15 Jun 2019 21:31:03 +0000 (14:31 -0700)]
Don't return expression in function returning void

This is a constraint violation in ISO C[0].

[0] http://port70.net/~nsz/c/c11/n1570.html#6.8.6.4p1

Signed-off-by: Michael Forney <mforney@mforney.org>
5 years agoUse bitwise test instead of __builtin_popcount
Michael Forney [Sat, 15 Jun 2019 21:04:38 +0000 (14:04 -0700)]
Use bitwise test instead of __builtin_popcount

__builtin_popcount might not be available on all compilers, so using
it requires a configure check and fallback implementation. In fact
on gcc without an -march flag, it gets compiled to a function call to
libgcc. However, we only need to test whether multiple bits are set,
and this can be done easily with a bitwise and.

Signed-off-by: Michael Forney <mforney@mforney.org>
5 years agoAvoid case ranges in switch statement
Michael Forney [Sat, 15 Jun 2019 20:51:56 +0000 (13:51 -0700)]
Avoid case ranges in switch statement

Signed-off-by: Michael Forney <mforney@mforney.org>
5 years agoAvoid unnecessary VLAs
Michael Forney [Sat, 15 Jun 2019 20:50:33 +0000 (13:50 -0700)]
Avoid unnecessary VLAs

When the array length is fixed, or bounded by a fixed upper bound,
just use that fixed length.

Signed-off-by: Michael Forney <mforney@mforney.org>
5 years agoRemove semicolons after function definitions
Michael Forney [Sat, 15 Jun 2019 20:50:03 +0000 (13:50 -0700)]
Remove semicolons after function definitions

Signed-off-by: Michael Forney <mforney@mforney.org>
5 years agotest: only write one single rules file for our device quirks
Peter Hutterer [Mon, 10 Jun 2019 12:18:50 +0000 (22:18 +1000)]
test: only write one single rules file for our device quirks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: auto-generate the udev rules
Peter Hutterer [Mon, 10 Jun 2019 12:00:40 +0000 (22:00 +1000)]
test: auto-generate the udev rules

We only ever set properties in the devices, so let's make that more explicit
and auto-generate the udev rule. This way we're hopefully better protected
from the various typos that hid in those rules over the years, but also be
prepared for passing the udev property key/value pairs elsewhere.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: remove invalid GOTO in udev rule
Peter Hutterer [Mon, 10 Jun 2019 12:08:33 +0000 (22:08 +1000)]
test: remove invalid GOTO in udev rule

This was always jumped over because for this device, the touchpad was never
set anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: adjust the relative pointer motion test for low-dpi devices
Peter Hutterer [Wed, 12 Jun 2019 04:24:57 +0000 (14:24 +1000)]
test: adjust the relative pointer motion test for low-dpi devices

This escaped us before because the MOUSE_DPI setting on the low-dpi device was
ignored thanks to a broken udev rule (see a future commit for that).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: replace the double assert macros with proper checks
Peter Hutterer [Wed, 12 Jun 2019 04:11:00 +0000 (14:11 +1000)]
test: replace the double assert macros with proper checks

Instead of value * 256 which makes for bad debug messages, expand it to a full
double test with a 1/256 epsilon.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: describe the various debug-gui features in the man page
Peter Hutterer [Thu, 13 Jun 2019 00:54:22 +0000 (10:54 +1000)]
tools: describe the various debug-gui features in the man page

There are too many things now to make it immediately obvious, let's describe
all this accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: handle pad strip/ring events in the debug-gui
Peter Hutterer [Thu, 13 Jun 2019 00:35:13 +0000 (10:35 +1000)]
tools: handle pad strip/ring events in the debug-gui

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: display tablet and tablet pad buttons when pressed
Peter Hutterer [Wed, 12 Jun 2019 23:48:28 +0000 (09:48 +1000)]
tools: display tablet and tablet pad buttons when pressed

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoquirks: add a quirk for the Lenovo X1 Yoga 1st gen
Alex Flowers [Wed, 12 Jun 2019 06:16:32 +0000 (23:16 -0700)]
quirks: add a quirk for the Lenovo X1 Yoga 1st gen

Signed-off-by: Alex Flowers <afpv72@gmail.com>
5 years agotest: remove a duplicate check
Peter Hutterer [Tue, 11 Jun 2019 00:19:55 +0000 (10:19 +1000)]
test: remove a duplicate check

We already checked that pointer a few lines earlier

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: swap a few litest_assert() calls for their more precise cousins
Peter Hutterer [Mon, 10 Jun 2019 22:24:10 +0000 (08:24 +1000)]
test: swap a few litest_assert() calls for their more precise cousins

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add the 24HDT pad to the custom device group
Peter Hutterer [Mon, 10 Jun 2019 11:52:41 +0000 (21:52 +1000)]
test: add the 24HDT pad to the custom device group

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agopath: add helper function to destroy a device
Peter Hutterer [Thu, 6 Jun 2019 05:31:53 +0000 (15:31 +1000)]
path: add helper function to destroy a device

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agopath: initialize the quirks context after error checking
Peter Hutterer [Thu, 6 Jun 2019 01:17:42 +0000 (11:17 +1000)]
path: initialize the quirks context after error checking

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agopath: factor out the seat creation into a helper function
Peter Hutterer [Thu, 6 Jun 2019 00:44:10 +0000 (10:44 +1000)]
path: factor out the seat creation into a helper function

No functional changes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoudev: don't init the quirks until we checked all arguments
Peter Hutterer [Thu, 6 Jun 2019 00:29:35 +0000 (10:29 +1000)]
udev: don't init the quirks until we checked all arguments

If we fail with an invalid argument, there's no need to initialize all the
quirks beforehand.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agopath: drop the separate header, not necessary
Peter Hutterer [Thu, 6 Jun 2019 04:25:21 +0000 (14:25 +1000)]
path: drop the separate header, not necessary

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: abort if our device didn't initialize
Peter Hutterer [Thu, 6 Jun 2019 04:40:11 +0000 (14:40 +1000)]
test: abort if our device didn't initialize

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix an intermitted failing test
Peter Hutterer [Tue, 11 Jun 2019 05:38:09 +0000 (15:38 +1000)]
test: fix an intermitted failing test

The touchpad_2fg_scroll_initially_diagonal test would semi-reliably fail under
valgrind but succeed otherwise. Cause was that on some devices, the initial
diagonal movement wasn't diagonal enough and closer to a horizontal movement.
This was fine on normal runs, but under valgrind we'd hit the "active
threshold" time limit and lock to horizontal scrolling, ditching the remaining
events and failing the test.

Fix this by calculating the scroll vector based on the device's width/height
ratio and go "more diagonal" on the initial vector.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoBetter Thinkpad T480 trackpoint multiplier
Zach Moazeni [Thu, 6 Jun 2019 04:33:06 +0000 (00:33 -0400)]
Better Thinkpad T480 trackpoint multiplier

5 years agoudev: only change the fuzz on touchpads and touchscreens
Peter Hutterer [Wed, 5 Jun 2019 00:11:12 +0000 (10:11 +1000)]
udev: only change the fuzz on touchpads and touchscreens

If we don't handle a device, don't touch it. Especially joysticks that we
don't handle and thus should not touch either.

Related to !231

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoAdd a new dispatch interface for the Dell Canvas Totem
Peter Hutterer [Fri, 14 Sep 2018 04:03:09 +0000 (14:03 +1000)]
Add a new dispatch interface for the Dell Canvas Totem

This device looks similar to a MT device on the kernel side, but it's not a
MT device and it's not quite a tablet either. It uses slots to track up to 4
totems off the same device and the only hint that it's not a MT device is that
it sends ABS_MT_TOOL_TYPE / MT_TOOL_DIAL.

udev thinks it's a touchscreen and a tablet but we currently init those
devices as touchscreen (because all wacom tablet touch devices are udev
tablets+tochscreens). So we need a quirk to hook onto this device.

And we use a completely separate dispatch implementation, because adding the
behavior to the tablet interface requires so many exceptions that it's easier
to just add a separate dispatch interface.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: add a the Totem tool type to the tablet interface
Peter Hutterer [Thu, 13 Sep 2018 03:26:22 +0000 (13:26 +1000)]
tablet: add a the Totem tool type to the tablet interface

This is the public API only, not the internal bits, so nothing will work just
yet.

This interface addition is for the Dell Canvas Totem tool, so let's go with
the same name because options like "Rotary" are too ambiguous.

The totem is a knob that can be placed on the surface, it provides us with
location and rotation data. The touch major/minor fields are filled in by the
current totem, but they're always the same size.

The totem exports BTN_0 as well, so let's add that to the debug-events output.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: force the litest feature enum to be 8 bytes or more
Peter Hutterer [Wed, 6 Feb 2019 05:35:08 +0000 (15:35 +1000)]
test: force the litest feature enum to be 8 bytes or more

We've used up all bits, so let's extend the enum. (1 << 31) triggers an
assertion because we check for > LITEST_DEVICELESS. So we can't use that bit
without other changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agodoc/api: more CSS styling
Peter Hutterer [Wed, 5 Jun 2019 00:27:37 +0000 (10:27 +1000)]
doc/api: more CSS styling

5 years agodoc/user: fix some typos
René Genz [Tue, 4 Jun 2019 01:44:38 +0000 (01:44 +0000)]
doc/user: fix some typos

5 years agotest: drop two unreachable statements
Peter Hutterer [Mon, 3 Jun 2019 00:10:40 +0000 (10:10 +1000)]
test: drop two unreachable statements

This was a copy-paste error in the form of

while(event) {
   ...}
} while(event);

Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoWarn if NDEBUG is defined
Peter Hutterer [Tue, 28 May 2019 04:10:54 +0000 (14:10 +1000)]
Warn if NDEBUG is defined

We rely on assert() too much for safety checks, let's not let the user disable
it without warning

Fixes #262

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoquirks: add trackpoint integration attribute
Peter Hutterer [Mon, 27 May 2019 23:54:27 +0000 (09:54 +1000)]
quirks: add trackpoint integration attribute

Some versions [1] of the Lenovo ThinkPad Compact USB Keyboard with TrackPoint USB
have the pointing stick on an event node that has keys but is not a regular
keyboard. Thus the stick falls through the cracks and gets disabled on tablet
mode switch. Instead of adding more hacks let's do this properly: tag the
pointing stick as external and have the code in place to deal with that.

[1] This may be caused by recent kernel changes

Fixes #291

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add a missing blank line
Peter Hutterer [Tue, 28 May 2019 03:19:42 +0000 (13:19 +1000)]
test: add a missing blank line

5 years agoquirks: handle ID_INPUT_KEY as udev keyboard match
Peter Hutterer [Mon, 27 May 2019 22:27:40 +0000 (08:27 +1000)]
quirks: handle ID_INPUT_KEY as udev keyboard match

We handle that as keyboard in the evdev code, let's do so here as well.

Related to #291

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agogitlab CI: switch F29 special builds to F30
Peter Hutterer [Tue, 28 May 2019 00:34:34 +0000 (10:34 +1000)]
gitlab CI: switch F29 special builds to F30

Let's test all these on the most recent version

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: don't treat a signal exit as success
Peter Hutterer [Thu, 11 Apr 2019 02:10:32 +0000 (12:10 +1000)]
test: don't treat a signal exit as success

WEXITSTATUS() "should be employed only if WIFEXITED returned true", see
wait(2). If a test failed with an abort, WIFEXITED is false and WEXITSTATUS
is... undefined? and apparently zero, so test case failures would cause a
false postive test result.

This doesn't affect a normal test run because check handles the aborts
correctly, but the valgrind invocation with CK_FORK ended up being handle by
litest. So with the result that any abort during valgrind was a silent success
and if there was a memleak in the same process that exited with a signal, the
memleak would be ignored too.

Fixes #267

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoAbstract libwacom database initialization into a single place
Peter Hutterer [Mon, 27 May 2019 08:21:09 +0000 (18:21 +1000)]
Abstract libwacom database initialization into a single place

No real changes for the non-tablet code, but for tablets we now keep the
libwacom datbase around. The primary motivating factor here is response time
during tests - initializing the database under valgrind took longer than the
proximity timeouts and caused random test case failures when a proximity out
was triggered before we even got to process the first event.

This is unfortunately a burden on the runtime now since we keep libwacom
around whenever a tablet is connected. Not much of an impact though, I
suspect, chances are you're running a web browser and everything pales against
that anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: allow for a LITEST_JOBS environment variable
Peter Hutterer [Mon, 27 May 2019 04:28:24 +0000 (14:28 +1000)]
test: allow for a LITEST_JOBS environment variable

valgrind struggles with too many parallel jobs, too easy to hit timeouts.
Let's reduce this for the valgrind runs.

Meson doesn't let us pass arguments through depending on the setup, so let's
make this an environment value.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: make all tap tests use the "tap" group prefix
Peter Hutterer [Mon, 27 May 2019 04:47:00 +0000 (14:47 +1000)]
test: make all tap tests use the "tap" group prefix

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: always set CK_FORK=no under valgrind
Peter Hutterer [Mon, 27 May 2019 04:21:53 +0000 (14:21 +1000)]
test: always set CK_FORK=no under valgrind

Set this in the code rather than the environment variable to make it easier to
run valgrind manually.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: split a test up into events vs processing
Peter Hutterer [Mon, 27 May 2019 04:19:26 +0000 (14:19 +1000)]
test: split a test up into events vs processing

Running under valgrind, this test often fails when the machine is under load.
Split it up so the events are all processed in one go, reducing the chance of
getting a timeout while processing a previous event.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add test cases for tablet/touchpad left-handed rotation locks
Peter Hutterer [Fri, 10 May 2019 03:13:11 +0000 (13:13 +1000)]
test: add test cases for tablet/touchpad left-handed rotation locks

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotouchpad: lock the touchpad rotation to the tablet rotation
Peter Hutterer [Fri, 3 May 2019 05:56:54 +0000 (15:56 +1000)]
touchpad: lock the touchpad rotation to the tablet rotation

Follow-up to 6229df184e8a03e76ba99483e7f9ecdd9ef02f4a
We must not rely on the caller to toggle the left-handed bits correctly since
they may not know which devices belong together (despite device groups). Let's
do the right thing here, if the tablet is set to left-handed, rotate the
touchpad accordingly.

Note that the left-handed setting of the tablet is left as-is
(right-handed). Until we have notifications about configuration changes, this
is the best we can do.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: lock the tablet rotation to the touchpad rotation
Peter Hutterer [Fri, 3 May 2019 05:56:54 +0000 (15:56 +1000)]
tablet: lock the tablet rotation to the touchpad rotation

Follow-up to 6229df184e8a03e76ba99483e7f9ecdd9ef02f4a
We must not rely on the caller to toggle the left-handed bits correctly since
they may not know which devices belong together (despite device groups). Let's
do the right thing here, if the touchpad is set to left-handed, rotate the
tablet accordingly.

Note that the left-handed setting of the touchpad is left as-is
(right-handed). Until we have notifications about configuration changes, this
is the best we can do.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: add --apply-to to debug-events and debug-gui
Peter Hutterer [Wed, 8 May 2019 01:24:28 +0000 (11:24 +1000)]
tools: add --apply-to to debug-events and debug-gui

All configuration options will only apply to the device with the given match
mattern. This makes it easier to test things like tapping on one device but
not on the other.

Exception is the sendevents pattern which applies independently.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: don't disable the proximity quirk on good sequences
Peter Hutterer [Sun, 26 May 2019 23:13:06 +0000 (09:13 +1000)]
tablet: don't disable the proximity quirk on good sequences

There are tablets out there that *sometimes* send the right event sequence,
but are generally broken. So let's not disable that quirk even if we do get a
right sequence.

Affected devices: Lenovo Flex 5
Fixes #248
Fixes #290

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix a typo in the test device name
Peter Hutterer [Sun, 26 May 2019 23:51:47 +0000 (09:51 +1000)]
test: fix a typo in the test device name

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: assign ID_INPUT_TABLET to the bamboo/intuos5 touchpad parts
Peter Hutterer [Sun, 26 May 2019 23:48:12 +0000 (09:48 +1000)]
test: assign ID_INPUT_TABLET to the bamboo/intuos5 touchpad parts

We rely on libwacom to set this, but it doesn't do so by default for uinput
devices. Let's set this here so the parts are correctly detected as tablet
touchpads.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofallback: make a debug log prefix more consistent
Peter Hutterer [Sun, 26 May 2019 23:02:06 +0000 (09:02 +1000)]
fallback: make a debug log prefix more consistent

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: make the test case failure output easier to select
Peter Hutterer [Thu, 9 May 2019 03:55:36 +0000 (13:55 +1000)]
test: make the test case failure output easier to select

Split the suite and test case name up so it's easier to select with a
double-click in the terminal. Because usually those tests need to be re-run
individually and making that easier is a good thing.

Previously:
:: Failure: ../test/test-tablet.c:4434:touch_arbitration:wacom-cintiq-13hdt-pen-tablet

Now:
:: Failure: ../test/test-tablet.c:4434: touch_arbitration(wacom-cintiq-13hdt-pen-tablet)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotouchpad: fix two debug messages to have the same prefix as the rest
Peter Hutterer [Fri, 3 May 2019 04:12:44 +0000 (14:12 +1000)]
touchpad: fix two debug messages to have the same prefix as the rest

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotouchpad: don't check libwacom if we're not tagged as tablet touchpad
Peter Hutterer [Fri, 3 May 2019 03:52:09 +0000 (13:52 +1000)]
touchpad: don't check libwacom if we're not tagged as tablet touchpad

No need to go through the effort if we're not tagged as a tablet+touchpad
device anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: add an extra debug message
Peter Hutterer [Fri, 3 May 2019 04:13:49 +0000 (14:13 +1000)]
tablet: add an extra debug message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: indentation fix
Peter Hutterer [Fri, 3 May 2019 05:51:58 +0000 (15:51 +1000)]
tablet: indentation fix

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix the wacom bamboo touch device
Peter Hutterer [Wed, 8 May 2019 03:15:50 +0000 (13:15 +1000)]
test: fix the wacom bamboo touch device

Missing buttons caused it to fail sanity checks in some cases.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix a bunch of tests expecting BTN_TOOL_TRIPLETAP
Peter Hutterer [Wed, 8 May 2019 03:59:27 +0000 (13:59 +1000)]
test: fix a bunch of tests expecting BTN_TOOL_TRIPLETAP

A device may have 1 or 2 slots without setting BTN_TOOL_TRIPLETAP, those
devices will fail those tests.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: drop the SKIP_LIBINPUT_TEST_RUNNER environment variable
Peter Hutterer [Wed, 1 May 2019 04:01:53 +0000 (14:01 +1000)]
test: drop the SKIP_LIBINPUT_TEST_RUNNER environment variable

We have the meson test suites now that we can use to filter which tests to
run, let's use those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoCI: use meson test instead of ninja test
Peter Hutterer [Wed, 1 May 2019 03:46:46 +0000 (13:46 +1000)]
CI: use meson test instead of ninja test

This way we can use the test suites to exclude the ones that won't run on a
container.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: skip the backtrace under valgrind
Peter Hutterer [Fri, 12 Apr 2019 00:00:12 +0000 (10:00 +1000)]
test: skip the backtrace under valgrind

gstack can't resolve the backtrace under valgrind anyway, so let's just skip
it altogether.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: return 77 for skip when we're not running a test
Peter Hutterer [Tue, 30 Apr 2019 03:12:23 +0000 (13:12 +1000)]
test: return 77 for skip when we're not running a test

This isn't technically needed since those tests aren't in the valgrind test
suite anymore. But let's have it here anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: replace the USING_VALGRIND env with the valgrind.h header
Peter Hutterer [Tue, 30 Apr 2019 03:10:42 +0000 (13:10 +1000)]
test: replace the USING_VALGRIND env with the valgrind.h header

This header is intended to be included in the project, so let's do that and
have proper runtime detection of the valgrind environment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: drop the valgrind check in the option-parsing test
Peter Hutterer [Tue, 30 Apr 2019 03:13:56 +0000 (13:13 +1000)]
tools: drop the valgrind check in the option-parsing test

It's not part of the valgrind test suite, so we don't need this check anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agomeson: group all tests under suite names
Peter Hutterer [Thu, 11 Apr 2019 23:24:49 +0000 (09:24 +1000)]
meson: group all tests under suite names

Three suite names to allow for filtering tests: 'valgrind', 'root',
'hardware'. The latter two require root/hardware to succeed, the former labels
tests that should be run under valgrind.

Usage is documented in the docs now, but basically:

$ meson test --setup=valgrind --suite=valgrind
$ meson test --no-suite=root

This is documented a bit now and because we now rely on meson test, let's
replace all ninja test invocations with meson test instead for consistency.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: we don't need a core file for failed option parser tests
Peter Hutterer [Wed, 1 May 2019 00:46:20 +0000 (10:46 +1000)]
tools: we don't need a core file for failed option parser tests

SIGQUIT which we send to any successful test of libinput debug-event will
trigger a coredump. We don't need that one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoRevert "Reduce button scroll timeout to 38ms"
Peter Hutterer [Thu, 2 May 2019 00:53:54 +0000 (10:53 +1000)]
Revert "Reduce button scroll timeout to 38ms"

This introduces a regression, see #265. Reverting until a better solution can
be found.

This reverts commit 5dae7aac3850f37088eaf71e07472d0b8e70922f.

5 years agoCI: update Ubuntu from 18.04 to 19.04
Peter Hutterer [Wed, 1 May 2019 22:42:18 +0000 (08:42 +1000)]
CI: update Ubuntu from 18.04 to 19.04

Using 18.04 holds back the use of meson test suites in the CI infrastructure
(!216) and it's not likely to get an update to a more recent libinput version
anyway, so let's not bother with it here, even if it is an LTS.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoCI: switch from Fedora 28 to Fedora 30
Peter Hutterer [Wed, 1 May 2019 22:36:03 +0000 (08:36 +1000)]
CI: switch from Fedora 28 to Fedora 30

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: update valgrind suppressions for a glib leak
Peter Hutterer [Wed, 1 May 2019 02:02:42 +0000 (12:02 +1000)]
test: update valgrind suppressions for a glib leak

Fixed upstream, but it's not in F30 yet so the valgrind tests fail there.
https://gitlab.gnome.org/GNOME/glib/merge_requests/338

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotouchpad: rotate the touch part of tablets
Peter Hutterer [Tue, 30 Apr 2019 04:52:28 +0000 (14:52 +1000)]
touchpad: rotate the touch part of tablets

Tablets in left-handed mode are rotated, so we need to rotate the touchpad
part of them too. This doesn't affect all tablets though, some of them are
symmetrical and the left-handed mode merely changes the button order around
(some of the earlier Bamboos). So we rely on libwacom to tell us which device
must be rotated.

The rotation itself is done on the input coordinate itself as we get it. This
way any software buttons, palm zones, etc. are automatically handled by rest
of the code.

Fixes #274

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: use identifiable shortnames for the Intuos5 devices
Peter Hutterer [Tue, 30 Apr 2019 05:27:35 +0000 (15:27 +1000)]
test: use identifiable shortnames for the Intuos5 devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: move tablet tool change processing to tablet_flush
Peter Hutterer [Fri, 5 Apr 2019 04:58:56 +0000 (14:58 +1000)]
tablet: move tablet tool change processing to tablet_flush

Unlike virtually everything else, the tablet tool was processed at the time
the event was read rather than when the subsequent EV_SYN came in. This causes
difficulties with tablets that send the wrong BTN_TOOL_PEN events.

Moving the tool change processing to tablet_flush() makes the injection of the
BTN_TOOL_PEN event a lot easier, simply flipping the matching bit does the
job. It also makes it easier to ignore duplicate tool updates like we've seen
in #259.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agoCI: update arch package list
Sebastian Krzyszkowiak [Sun, 14 Apr 2019 12:40:34 +0000 (14:40 +0200)]
CI: update arch package list

Signed-off-by: Sebastian Krzyszkowiak <dos@dosowisko.net>
5 years agoevdev-mt-touchpad-buttons: use a model quirk instead of vendor ID to identify Apple...
Sebastian Krzyszkowiak [Thu, 11 Apr 2019 22:59:19 +0000 (00:59 +0200)]
evdev-mt-touchpad-buttons: use a model quirk instead of vendor ID to identify Apple devices

Recent Apple touchpads use a proper Bluetooth vendor ID assigned to Apple instead of the USB one,
so this code would have to check for two vendor IDs and their udev types. However, we already
have that matching done via models in quirks, so let's just use that.

Signed-off-by: Sebastian Krzyszkowiak <dos@dosowisko.net>
5 years agoquirks: add a new Apple vendor ID for Bluetooth devices
Sebastian Krzyszkowiak [Thu, 11 Apr 2019 22:55:26 +0000 (00:55 +0200)]
quirks: add a new Apple vendor ID for Bluetooth devices

Also, set a default AttrTouchSizeRange for Apple touchpads via Bluetooth
to match the one from the USB rule.

Signed-off-by: Sebastian Krzyszkowiak <dos@dosowisko.net>
5 years agotest: abort when no default value is available for an axis
Jason Gerecke [Wed, 10 Apr 2019 19:41:40 +0000 (12:41 -0700)]
test: abort when no default value is available for an axis

And fix the cases where the default value isn't filled in correctly

Issue found because of the following ubsan error:
../src/evdev-tablet.c:182:19: runtime error: signed integer overflow: 0 - -214783648 cannot be represented in type 'int'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: Clean up memory leaks
Jason Gerecke [Thu, 11 Apr 2019 03:17:02 +0000 (13:17 +1000)]
test: Clean up memory leaks

A few leaks in the test code were found when running linput-test-suite
with the -fsanitize=address option enabled. Clean up these leaks so that
we can more clearly see real issues.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agofallback: Fix ubsan runtime error
Jason Gerecke [Wed, 10 Apr 2019 16:55:25 +0000 (09:55 -0700)]
fallback: Fix ubsan runtime error

Running libinput-test-suite with -fsanitize=undefined highlights the two
following errors. Force C to realize we want an unsigned result by making
the '1' literal unsigned.

../src/evdev-fallback.c:314:22 runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
../src/evdev-fallback.c:377:24 runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

v2: use bit() instead of manual shift 1U<<1

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: add proximity timeout delay to a tablet test
Peter Hutterer [Thu, 11 Apr 2019 04:19:49 +0000 (14:19 +1000)]
test: add proximity timeout delay to a tablet test

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: add a debugging message when we force a proximity out
Peter Hutterer [Thu, 11 Apr 2019 03:16:02 +0000 (13:16 +1000)]
tablet: add a debugging message when we force a proximity out

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: tighten the test for tablet button releases on proximity out
Peter Hutterer [Mon, 8 Apr 2019 00:17:23 +0000 (10:17 +1000)]
tablet: tighten the test for tablet button releases on proximity out

Make sure we check the expected sequence more stringent and change the x/y
coordinates on prox in so the kernel doesn't filter them.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: reduce some touch sequences to avoid tablet timeouts
Peter Hutterer [Sun, 7 Apr 2019 22:50:41 +0000 (08:50 +1000)]
test: reduce some touch sequences to avoid tablet timeouts

We need to keep those sequences to fall below the tablet proximity timeout.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: fix the hid4800 device's prox out serial number
Peter Hutterer [Fri, 5 Apr 2019 04:24:47 +0000 (14:24 +1000)]
test: fix the hid4800 device's prox out serial number

The test device sent a serial of 0. That would end up creating a new tool in
libinput which is wrong. Let's hope this was just an error in creating the
test device, if the device really sends that sequence, we're in trouble.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: filter BTN_TOOL_PEN correctly for the mouse tool tests
Peter Hutterer [Fri, 5 Apr 2019 05:49:31 +0000 (15:49 +1000)]
test: filter BTN_TOOL_PEN correctly for the mouse tool tests

With the previous code we'd set both tools simultaneously which isn't allowed.
It only worked because the second tool set was the one we cared about.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotest: actually filter events when writing to udev
Peter Hutterer [Fri, 5 Apr 2019 05:57:48 +0000 (15:57 +1000)]
test: actually filter events when writing to udev

Don't write events to the uinput device if we disabled that specific event
code.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: fix waiting for the tool to quit in the options test
Peter Hutterer [Fri, 5 Apr 2019 01:02:46 +0000 (11:02 +1000)]
tools: fix waiting for the tool to quit in the options test

Just use the wait() timeout directly instead of sleep and kill. This allows us
to have a longer timeout and still get fast handling where the tool
immediately exits, but less failure when running on busy machines.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotools: use American spelling for 'unrecognized'
Peter Hutterer [Fri, 5 Apr 2019 00:46:56 +0000 (10:46 +1000)]
tools: use American spelling for 'unrecognized'

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: fix some code alignment
Peter Hutterer [Fri, 5 Apr 2019 04:51:42 +0000 (14:51 +1000)]
tablet: fix some code alignment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: add missing linebreak after error message
Peter Hutterer [Thu, 4 Apr 2019 23:35:41 +0000 (09:35 +1000)]
tablet: add missing linebreak after error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
5 years agotablet: always enable the proximity out quirk
Peter Hutterer [Thu, 4 Apr 2019 04:49:47 +0000 (14:49 +1000)]
tablet: always enable the proximity out quirk

Don't require a quirk update, just enable this by default for all tablets. If
we get a proximity out event at the right time, the quirk is disabled for that
tablet for the rest of its lifetime. And it's virtually impossible to have a
false positive here anyway - you cannot hold the pen still enough to not
trigger events for 50ms.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>