Commit graph

1193 commits

Author SHA1 Message Date
Peter Hutterer
8194655f2d Add .vimdir for libinput-specific settings
To avoid introducing broken indentations when I'm working in different
directories than the standard one add the vimdir with the local settings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-25 09:17:29 +10:00
Peter Hutterer
602bca6977 test: fix --list for the tests
The argument worked, but the test list was empty since b2fd428f96.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-25 08:56:53 +10:00
Peter Hutterer
8bb67c2550 test: fail if the filter leaves us with zero tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 17:18:05 +10:00
Peter Hutterer
a1075070a4 test: add missing filter for function names
Was added to other places, missing from here so some tests passed the filter
despite not being selected by it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 17:18:03 +10:00
Peter Hutterer
a6be43990c Merge branch 'litest-filter-tests'
The litest-selftest has its own main method and compiles litest.c with special
flags. Use that to ifdef out the litest.c main function, and inline the
litest_run/litest_parse_args functions so gcc doesn't complain about unused
functions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 09:15:15 +10:00
Peter Hutterer
fcd1cbe5e5 doc: drop leftovers of Check's selective test running
CK_RUN_CASE and CK_RUN_SUITE still work because we're still using check
underneath, but it's better to use the arguments.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:35 +10:00
Peter Hutterer
f3947c0eb9 test: add --filter-group argument to match test groups (suites)
Same as CK_RUN_SUITE, but supports fnmatch-like globs

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:35 +10:00
Peter Hutterer
538e98d46f test: add --filter-device argument
Similar to the CK_RUN_CASE environment variable, but it does support
fnmatch()-style wildcards, e.g.

	./test/test-touchpad --filter-device="synaptics*"

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:35 +10:00
Peter Hutterer
f3d37d9653 test: add filtering to litest framework
Complementary to CK_RUN_SUITE and CK_RUN_CASE, this filters on actual test
function names with a simple fnmatch.

./test/test-touchpad --filter-test="*1fg_tap*"

Most of this patch is renaming litest_add_* to _litest_add_* so we can use the
macros to get at the function names.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:35 +10:00
Peter Hutterer
b2fd428f96 test: move argument parsing into a separate function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:35 +10:00
Peter Hutterer
9dbeb9d0f7 test: move main() into litest
This allows us to filter things based on argv before setting up tests, etc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-22 08:45:33 +10:00
Peter Hutterer
af4ff07f6b touchpad: sync the initial touch state
Unlikely, but there's the odd chance of the first touch coming in with the
same X or Y coordinate the kernel already has internally. This would
generate a bogus delta on the second event when the touch coordinate jumps
from 0/y or x/0 to the real coordinates.

For touchpads with distance support this is a real issue since the default
value for a touch distance is > 0.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:48 +10:00
Peter Hutterer
180564c780 evdev: sync the initial state for absolute pointer devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:47 +10:00
Peter Hutterer
4889a0c3c2 evdev: sync the initial x/y position for touchscreens
Unlikely, but there's the odd chance of the first touch coming in with the
same X or Y coordinate the kernel already has internally. This would generate
a x/0 or 0/y event in libinput.

Sync the slot state on init, at least for Protocol B devices. For Protocol A
devices and mtdev, don't bother.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:47 +10:00
Peter Hutterer
736e292fc4 evdev: add an interface hook to suspend a device
The touchpad carries enough state around that calling release_all_keys() isn't
enough to properly suspend it. e.g. a button down after tapping won't be
released by trying to release the physical button for it.

We need to clear the state properly, but that's interface-specific so add a
new hook for it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:47 +10:00
Peter Hutterer
58174416ca evdev: move release_pressed_keys() up
Just a move to make the next diff easier

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:47 +10:00
Peter Hutterer
15a67e4fac touchpad: rename all interface functions for clarity
Add "interface" to the name to make things a bit clearer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:46 +10:00
Peter Hutterer
db567c01a4 evdev: log a bug if releasing a key fails, but don't loop forever
If a physical button is down but releasing said button doesn't actually
release it, we loop endlessly. Detect that and log a bug instead.

Reproducible: trigger a tap-n-drag on a touchpad device, then remove it.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-21 21:41:46 +10:00
Peter Hutterer
b84c60737f test: add missing linebreak in debug error message
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-21 17:28:07 +10:00
Jan Alexander Steffens (heftig)
e39dca063b Rename MODEL_SYSTEM76_CLEVO to MODEL_CLEVO_W740SU
The System76 Galago Ultra Pro is a rebranded Clevo W740SU with changed
firmware strings. To my knowledge, the Clevo W740SU and all its rebrands
possess smooth touchpads.

In the original bug report[1], a Galago Ultra Pro was returned to the
original DMI strings by flashing another firmware. This resulted in the
model identified as MODEL_SYSTEM76_CLEVO.

Since the actual manufacturer of the W740SU is Clevo and the CLEVO hwdb
entry already properly identifies other W740SU rebrands like the Schenker
S413, the model should be renamed to match.

[1]: https://bugs.freedesktop.org/show_bug.cgi?id=90170#c3

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

Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-21 11:31:55 +10:00
Peter Hutterer
ed5d43da36 Merge branch 'litest-backtrace' 2015-05-21 11:05:45 +10:00
Peter Hutterer
015151de3a test: move opening { to next line
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-20 13:06:43 +10:00
Peter Hutterer
42fa56c9ee doc: clarify a comment what a "no device" test case means
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-20 13:06:24 +10:00
Peter Hutterer
f70db17d21 Allow disabling of middle button emulation where it doesn't exist
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 16:57:49 +10:00
Peter Hutterer
cd163b3b8a Allow disabling tapping on a device without tapping
The doc says this "always succeeds", not "segfaults".

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 16:57:47 +10:00
Peter Hutterer
120a5b3384 test: add a note to one of the device tests
If we get two different sysnames for the device, this test doesn't test
anything much, so it's better to fail here. But add a comment so that when it
fails it's quite obvious why.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 10:58:57 +10:00
Peter Hutterer
d05363316c test: parse the LITEST_VERBOSE environment variable
--verbose only works when running a specific test, sometimes we need make
check to be more verbose. Set this by default for make check, the log becomes
a lot more expressive that way

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 10:49:49 +10:00
Peter Hutterer
b6eb43b537 path: be more lenient waiting for udev to settle things
Running tests in parallel can exceed the current 100ms max timeout for udev to
settle things. Since this pretty much only triggers in test cases anyway,
let's be more lenient here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 10:49:49 +10:00
Peter Hutterer
75fd354aa3 test: drop unneeded includes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-19 10:47:11 +10:00
Peter Hutterer
13c7b47d87 test: convert all helper functions to use the litest macros
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
b8af89f173 test: extract file:line from backtrace with addr2line
libunwind gives us a file and an address and usually a function name. Beyond
that, it's mostly guessing.
Fork off addr2line to resolve the addresses that libunwind gives us, if we
succeed we get a backtrace like this:

	Backtrace:
	0: litest_fail_comparison_int() (./test/litest.c:268)
	1: disable_button_scrolling() (./test/pointer.c:115)
	2: middlebutton_doubleclick() (./test/pointer.c:991)
	3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f6c12d8c025]
	4: litest_run() (./test/litest.c:689)
	5: main() (./test/pointer.c:1280)
	6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f6c11a73790]
	7: ./test/test-pointer (_start+0x29) [0x403d99]
	8: ? (?+0x29) [0x29]

Note: I intentionally swapped function/file name in the output to make it
easier to spot which one is fully resolved and which one is the basic
libunwind output.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
dc3dbc4dfc test: add pointer comparison macros
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
84e6321f51 test: add a backtrace facility to litest
The check unit test framework isn't particularly suited to having ck_assert*
calls in helper functions. A failed assertion in a helper function or the
litest framework merely gives us a the failed line in litest.c.
which doesn't tell us which test actually failed.

Add a backtracing facility with litest_backtrace(). And since this requires
wrapping all ck_assert macros with litest_assert() this patch ended up
replacing/duplicating a bunch of ck_assert_* bits. So rather than
ck_assert_int_eq() we now use litest_assert_int_eq(), etc. in the litest
framework itself.

The int comparison macros are more type-safe than ck_assert()'s macros which
just cast all the ints to intmax_t.

Backtrace is spewed to stderr, which is good enough for debugging. Example
backtrace:

	FAILED COMPARISON: status != expected
	Resolved to: 0 != 0
	in disable_button_scrolling() (pointer.c:115)

	Backtrace:
	0: ./test/test-pointer (litest_fail_comparison_int+0xab) [0x40973b]
	1: ./test/test-pointer (disable_button_scrolling+0x174) [0x40421b]
	2: ./test/test-pointer (middlebutton_middleclick+0x40) [0x40829c]
	3: /lib64/libcheck.so.0 (srunner_run+0x7f5) [0x7f0e8a277025]
	4: ./test/test-pointer (litest_run+0x107) [0x40a42b]
	5: ./test/test-pointer (main+0x2fa) [0x4090e7]
	6: /lib64/libc.so.6 (__libc_start_main+0xf0) [0x7f0e88f5e790]
	7: ./test/test-pointer (_start+0x29) [0x403ce9]
	8: ? (?+0x29) [0x29]

litest_backtrace() itself is copied from xserver/os/backtrace.c which git
blame attributes to Marcin.

CC:  Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
c9ea9836f3 test: cast to int before integer comparison
No effect with the current macros since they'll cast to int for us, but this
will change with the litest_assert macros.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
d81a677f6d test: don't use enum values in ck_assert macros directly
Unfortunately, typeof(enum something) != typeof(ENUM_VALUE) and produces a
-Wsign-compare warning

Preemptively fix this, it'll show up in the upcoming litest_asssert macros
otherwise.

This fix only applies to helper functions, tests themselves wont (yet) be
switched to the new macros and don't need fixing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:48 +10:00
Peter Hutterer
7b965b63c0 test: type-safe two ck_assert invocations
unsigned vs signed in both cases, but the ck_assert macros hide that
(everything is cast to intmax_t). The upcoming litest_assert wrappers expose
these warnings, so fix them ahead of time.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 20:55:47 +10:00
Peter Hutterer
6acd97457f doc: add some documentation for disable-while-typing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 15:16:33 +10:00
Peter Hutterer
c2f8b508b9 touchpad: use a two-stage timeout for disable-while-typing
Hitting a single key triggers a short timeout, just enough to cover the time
to the next key event. Hitting more than one key triggers the longer timeout.

This should improve responsiveness after single key events when the touchpad is
still the main interaction mode and a key needs to be pressed to advance in
the UI. When typing the hands require physical movement to get back to the
touchpad anyway so a longer timeout is acceptable and more reliable.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-18 14:39:22 +10:00
Peter Hutterer
d02b670e37 touchpad: add timeout-based disable-while-typing
On some touchpads, typing triggers touches in areas of the touchpad that
cannot easily be distinguished from other fingers. Pressure information is
useless too, so we have to go back to a timeout-based handling of touch data.

If we see non-modifier key events, disable the touchpad for a timeout and set
any touches starting during that timeout as palm.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-18 14:39:22 +10:00
Peter Hutterer
d288eb0a63 touchpad: switch from is_palm to an enum
Preparation to add different palm detection types. Not all of them need to be
un-done when leaving the edge area so a boolean is not enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-18 14:39:21 +10:00
Peter Hutterer
46171fbef3 Merge branch 'tap-to-end-drag'
Changed the test merged in to use the new ranged litests functionality

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 14:12:12 +10:00
Velimir Lisec
2e0f45b537 test: add test cases for ending drag with a tap
Signed-off-by: Velimir Lisec <lisec.velimir@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 14:10:17 +10:00
Velimir Lisec
1ab385bc83 touchpad: end tap-and-drag with an extra tap
Currently for the tap-and-drag gesture to end user has to wait for a
timeout to expire. Make it possible to end the drag gesture by just tapping.

The allowed finger sequences to start and end a drag are thus:
tap, down, .... move ...., up  <wait for timeout>
tap, down, .... move ...., up, tap

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

Signed-off-by: Velimir Lisec <lisec.velimir@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>

State diagram changes and a doc change squashed in.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-18 14:10:17 +10:00
Peter Hutterer
217ab899cf timer: fix coverity warning about unused return value
"read(int, void *, size_t)" returns the number of bytes read, but it
is ignored.

We don't really care about the number of bytes, but let's complain if we get
anything but EAGAIN.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-08 14:08:58 +10:00
Peter Hutterer
893fdf9b83 test: switch the touchpad multitap tests over to ranged tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-08 14:08:58 +10:00
Peter Hutterer
ca10fc2be7 test: switch the abs ranged tests over to real ranged tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-08 14:08:57 +10:00
Peter Hutterer
b97ad3c174 test: add litest_add_ranged* functionality
litest_add_ranged* takes a range parameter that serves as the lower/upper
boundary for a loop. This enables tests to be run multiple times, avoiding the
timeouts we triggered by having the loops inside (e.g. see 2bf8d035c and
6dd02468).

This just wraps the underlying check framework, the ranged variable is
available as "_i" in the test.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-08 14:08:57 +10:00
Peter Hutterer
12000e737e tools: add middle button emulation to listed capabilities
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-05-07 16:30:08 +10:00
Peter Hutterer
4a56ce17f0 test: use litest_is_button_event() helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 16:18:10 +10:00
Peter Hutterer
fd301dfba2 test: add litest_is_keyboard_event() helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-05-07 16:17:50 +10:00