Commit graph

272 commits

Author SHA1 Message Date
Peter Hutterer
24b1f2e995 Merge branch 'master' into tablet-support
Manual changes:
* add tablet APIs to libinput.sym
* add the tablet-specific events to litest_event_type_str
* add NULL for device_remove in the tablet interface

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-18 09:47:45 +10:00
Peter Hutterer
e9b160a995 test: print axis event information for debugging too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-11 17:34:05 +10:00
Peter Hutterer
a296a102c7 test: print the string of the event type
Bit quicker to parse than the number

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-11 17:34:05 +10:00
Peter Hutterer
83f97991a0 0.7.0
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAlSBMWUACgkQ4jt+cLRn8L/4JQCgt0u/hImDVk9GLPXpUfFZinRc
 pIgAn1bZ91n/o4nEhq6zOXSsKRoZvxHL
 =oj19
 -----END PGP SIGNATURE-----

Merge tag '0.7.0' into tablet-support

0.7.0

Conflicts:
	src/libinput-private.h
	test/device.c
	test/litest.h
2014-12-08 11:14:11 +10:00
Jonas Ådahl
3b4d8509cc test: Don't send two motion events when button scrolling
Button scrolling motion events don't pass through the acceleration
filter so no need to assume the initial event will be absorbed.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-12-05 11:54:18 +10:00
Hans de Goede
365141ec60 test: Add litest_button_scroll helper function
Turn test_trackpoint_scroll into a generic helper function for testing
"button scrolling".

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-11 12:13:07 +10:00
Peter Hutterer
d7a1addcdd test: rename a parameter to litest_assert_scroll()
This doesn't test for direction only, it tests for the minimum distance we
expect in the scroll event. Rename accordingly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 10:00:55 +10:00
Peter Hutterer
1bd5d32463 test: add VMWare Virtual USB Mouse device
Yes, the name has VMware twice, not a typo.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 09:55:42 +10:00
Peter Hutterer
a0b3af0d91 test: add Xen Virtual Pointer device
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 09:55:42 +10:00
Peter Hutterer
529d30c7ac test: add QEMU tablet as test device
Re-uses the touch_down interface for now, but requires the slot is always 0.
That's easier for now than adding a new interface for abs event, at least
until we have more than one device that needs it.

This device, along with a couple of similar ones have a tendency to break in
the X.Org stack without people noticing. They're special in that they have
absolute x/y axes but relative wheels. For libinput that's not as much of a
problem as it is in X but let's add them anyway.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-11-11 09:55:42 +10:00
Peter Hutterer
341eeec611 test: fix coding style
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-10 11:16:08 +10:00
Hans de Goede
00f74270e5 litest: Add a sleep_ms parameter to litest_touch_move_to
In reality moving a touch from point to another takes time. In some cases
(when a timeout may trigger during the move, e.g. tap-n-drag on a touchpad),
this is important. Add a sleep_ms parameter, which will cause
litest_touch_move_to to sleep the specified amount of ms every step.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-06 11:04:17 +01:00
Peter Hutterer
ba30abff77 test: pass an enum for the axis instead of uint
Let's pretend that makes it type-safe.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-11-06 15:08:28 +10:00
Peter Hutterer
4dce0648f6 test: add litest_push/pop_event_frame() helpers
For some tests we need to string multiple event sequences together into one
event frame. Use a push/pop frame approach that stops litest from sending any
EV_SYN/SYN_REPORT events, so we can merge two touches together by e.g.

litest_push_event_frame(d);
litest_touch_down(d, 0, 10, 10);
litest_touch_down(d, 1, 20, 50);
litest_pop_event_frame(d);

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-23 14:38:52 +10:00
Peter Hutterer
e4adbff919 test: add helper functions for the two timers we care about
Rather than a random msleep() with a comment, use a helper function that
describes what we're waiting for. Also makes changing the timeouts easier in
the future.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-23 14:38:37 +10:00
Peter Hutterer
a6f18c9cca Merge branch 'master' into tablet-support
sendevents config tests currently disabled for LITEST_TABLET until that gains
the matching bits in the dispatch.

Conflicts:
	src/evdev.c
	src/libinput.c
	test/litest.c
	test/litest.h
2014-09-22 15:42:13 +10:00
Hans de Goede
faa8764921 litest: Add litest_assert_scroll() helper function
Make check_2fg_scroll functionality available outside of touchpad.c ,
no functional changes.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-19 15:49:06 +10:00
Peter Hutterer
fca1519395 test: wait for events in litest_assert_button_events
Takes the onus of waiting from the caller.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00
Peter Hutterer
84007034aa test: move assert_button_event to litest proper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00
Peter Hutterer
dc3ad5315f test: add litest_add_device()
For adding a litest device to an existing context.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00
Peter Hutterer
647b2ba18d test: avoid erroneous devices to be passed into the test suites
The litest features overlap with the litest device specifiers, so it's easy to
pass in LITEST_MOUSE where LITEST_POINTER should be passed in, and vice versa.
Lacking proper type checking the best we can do here is simply move the
devices into the negative range and check for that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-09-18 11:30:15 +10:00
Peter Hutterer
87c8d82ac5 test: print strerror() if uinput device creation fails
The most common error running the test suite is not running as root, but the
error message is hard to interpret. Make it more explicit when it failed,
printing the strerror of the errno.

Note that libevdev 1.3 is needed to get EACCES instead of EBADF
http://cgit.freedesktop.org/libevdev/commit/?id=debe9b030c8069cdf78307888ef3b65830b25122
A workaround is put in place for now until libevdev 1.3 is commonplace.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-17 13:35:41 +10:00
Peter Hutterer
496cd6ab27 test: use the evironment variable for check's verbosity
Allows to set CK_VERBOSITY to be set to "silent", "minimal", "normal", or
"verbose". Falls back to CK_NORMAL if unset.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-01 15:37:25 +10:00
Peter Hutterer
481430d8bb test: fix infinite loop in litest_wait_for_event_of_type()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-09-01 15:37:25 +10:00
Peter Hutterer
efb9081454 test: add a generic single-touch device
With a non-zero absmin for both axes and different ranges for x/y, just to
detect those errors.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-08-26 13:49:16 +10:00
Peter Hutterer
ca3f3ea9ce test: add helpers to wait for specific events
litest_wait_for_event() returns if any event is available.
litest_wait_for_event_of_type(... type, type, type, -1) returns if any of the
given event types is availble. All other events are discarded.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-08-26 13:49:15 +10:00
Jonas Ådahl
e3f39004a2 test: Don't fail when events are enabled multiple times
When overriding events of a test device, if one would enable an event
that was already enabled by default for the overridden device, an assert
checking if the event was already enabled would fail and cause the test
to fail.

Since the merging of the default and overriding event lists is implemented
by simply concatinating them letting libevdev deal with ignoring
superfluous event enabling, remove the assert to allow the implementation
to work.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 22:35:19 +02:00
Jonas Ådahl
ec0161eda3 test: Remove test device from context when deleting
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 22:35:19 +02:00
Jonas Ådahl
4be59a972a test: Use only one test device for some udev and path tests
Some tests in test/path.c and test/udev.c are not dependent on
device behaviour but rather managing of device lifetime etc. Run those
tests only once with only one device, resulting more or less the same
code coverage but shorter run time.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-08-18 22:35:19 +02:00
Peter Hutterer
d1cc84265b test: add a semi-mt Alps test device
Provides the bounding box only, with slot 0 always being the upper/left, slot
1 being the lower-right touch. This needs to use the touch_down etc. litest
interfaces, which are now widened to double (leftover from 489630f58) and a
device-specific private pointer in the litest device.

New device feature for litest: LITEST_SEMI_MT

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-08-04 20:21:03 +10:00
Peter Hutterer
61995348d9 test: auto-update for BTN_TOOL_* when using litest_touch_ functions
Set BTN_TOUCH, BTN_TOOL_DOUBLETAP automatically depending on the number of
fingers down.

This emulates real event sequences a bit better than the current approach,
though it's not a 100% correct emulation:
1) On real devices, BTN_* are usually sent last before the SYN_REPORT - here
   they are sent first to slot in with the custom, device-specific event
   sequence. We should only ever look at the complete sequence anyway, so this
   shouldn't matter.
2) On real devices, the switch from BTN_TOOL_DOUBLETAP to TRIPLETAP and vice
   versa is not always toggled within the same SYN_REPORT
3) On synaptics devices, BTN_TOUCH is released in the frame where
   BTN_TOOL_DOUBLETAP is set. It is then immediately set again in the next
   frame.  With the current litest framework this is hard to integrate, so we
   just leave BTN_TOUCH set the whole time, which is what MT devices do if
   they don't have BTN_TOOL_DOUBLETAP.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-23 15:08:15 +10:00
Peter Hutterer
125e98a1f8 style fix: Remove duplicate empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-22 09:00:45 +10:00
Peter Hutterer
0891bc0d92 Merge branch 'master' into tablet-support 2014-07-21 09:31:37 +10:00
Peter Hutterer
e1484cb7f8 test: set the abs resolution after creating the device
Until uinput gets that capability (likely not before 3.17) all we can do is a
racy approach of setting it after creating it. That won't work well for
anything test where libinput is already listening to udev when the device is
created, but it does work for those cases where libinput is started after the
device was initialized.

And it's a better alternative than not testing anything dependent on
resolution settings.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 08:56:12 +10:00
Peter Hutterer
489630f58b test: widen litest to use doubles for scaled variables
Using a 0-100% range is useful but in some cases we need events with finer
than 1% granularity.

And fix up the two-finger test that now fails. This was a bug in the test
anyway, the dx/dy supplied here was 1% of the touchpad width. Confined to
integers this meant we only ever had the touch down, then the single move by
1%. That caused two events - not enough to satisfy tp_estimate_delta, so we
always had a delta of 0/0 regardless of the size of the move.

Now with doubles this fails, so drop it to 0.1% instead, which is small enough
on all touchpads we currently have.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-07-21 08:56:10 +10:00
Jonas Ådahl
2eaefefdde test: Assert libevdev_uinput_write_event() call was successful
Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2014-07-15 23:44:50 +02:00
Peter Hutterer
5cecefeea0 test: fix compiler warnings for comparison int vs unsigned int
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-07-03 11:17:49 +10:00
Peter Hutterer
8302b0b7e3 Merge branch 'master' into tablet-support
Conflicts:
	src/libinput-util.h
	test/misc.c
2014-06-25 14:43:45 +10:00
Hans de Goede
6c4778f891 test: Prefix litest created device names with litest
And add an example xorg.conf.d .conf file for ignoring these devices under
xorg.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 11:11:45 +10:00
Peter Hutterer
bad56cac5b Merge branch 'ref-counting-context'
Conflicts:
	src/udev-seat.c
	test/log.c
2014-06-25 10:32:42 +10:00
Jonas Ådahl
faab25c25c Make context reference counted
Instead of only allowing one owner keeping a libinput context alive,
make context reference counted, replacing libinput_destroy() with
libinput_unref() while adding another function libinput_ref().

Even though there might not be any current use cases, it doesn't mean we
should hard code this usage model in the API. The old behaviour can be
emulated by never calling libinput_ref() while replacing
libinput_destroy() with libinput_unref().

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-25 10:27:03 +10:00
Peter Hutterer
97a6bf10f9 Change the logging system to be per-context
Rather than a single global logging function, make the logging dependent on
the individual context. This way we won't stomp on each other's feet in the
(admittedly unusual) case of having multiple libinput contexts.

The userdata argument to the log handler was dropped. The caller has a ref to
the libinput context now, any userdata can be attached to that context
instead.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-23 15:39:08 +10:00
Peter Hutterer
3f500b657f test: move the interface declaration up
No functional changes, just some prep work.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2014-06-23 15:23:35 +10:00
Carlos Garnacho
0716580fc2 test: Add Wacom ISDv4 E6 Pen device definition
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Carlos Garnacho
c5736b7a9b test: Add Wacom Intuos5 touch M Pen device definition
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Carlos Garnacho
20343ab41c test: Add Wacom Cintiq 12WX device definition
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Carlos Garnacho
f43a9b2c76 test: Add Wacom Bamboo 16FG 4x5 Pen device definition
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Carlos Garnacho
204d1d7514 test: Add infrastructure for testing tablet events.
no vfuncs are used, only input_event arrays.

Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-17 17:17:14 -04:00
Peter Hutterer
d4c29a0af8 test: Add description for the T440 synaptics touchpad
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-12 10:29:26 +10:00
Peter Hutterer
e0ce8a67ea test: add litest_assert_empty_queue helper function
Checks if the queue is empty and prints informatino about any events before
failing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2014-06-12 10:29:26 +10:00