Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
aa3d09932f test: add a Wacom Intuos 5 Finger test device
Works as a touchpad but has no buttons.

Minor change to one of the touchpad tests: because the touch area is so big
the slow-scrolling trigger needs to be adjusted.

And because the device is an external device, the "disable on external mouse"
test needs to be adjusted.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
f8fae70d0c test: enable tapping before verifying correct tap events
These tests make sure we don't get tapping events in certain situations
(finger movement, timeouts, ...). Tapping must be enabled for that to be a
valid test.

The tests can't work on semi-mt devices because we can't end slots
independently. Disable the tests there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
8b633f9de3 test: add a button requirement to a couple of touchpad tests
If we send BTN_LEFT or similar, we need the LITEST_BUTTON capability on the
device.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
5b9b662b2e test: split 3-finger tap-and-drag test
Split out into a btntool test and a true three-finger test. For consistency,
check the number of slots on all those tests rather than having
litest-device-specific exclusions.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:49 +10:00
Peter Hutterer
19120ef96c test: disable tapping for pure motion tests
No effect, all devices currently have tapping disabled.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-05 13:30:48 +10:00
Peter Hutterer
13afa8e5c7 test: disable tapping for palm detection tests
The event sequences we use for plam detection trigger tap events if enabled by
default. Always disable tapping, a set of tests for tapping in the palm
exclusion zones. Arguably, tapping in the zones should be handled in a
separate set of tests though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-05 13:30:48 +10:00
Peter Hutterer
411f95b17f tablet: sync tools already in proximity at startup
If a tool is in proximity when we init, send a proximity event immediately.

This is only partially reliable due to the current kernel behavior:
* if the tool comes into proximity when there is no evdev client, the device
  won't send any events and must be lifted out-of-proximity first. Patch is in
  the works, see https://patchwork.kernel.org/patch/5924611/
* before 3.19, if the tool was in proximity (with an evdev client attached),
  but goes out of proximity and back in with no client connected, we get an
  immediate proximity out event from the kernel once we connect to the device
  and no further events after that.
  See kernel commit b905811a49bcd6e6726ce5bbb591f57aaddfd3be

Otherwise, things work as expected. The above should be fixed in the kernel
anyway.

Note that this changes the order of events during a udev seat init, before we
had all DEVICE_ADDED events in a row, now the proximity event may be
interspersed.

Reported-by: Jason Gerecke <killertofu@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
2015-03-05 11:23:38 +10:00
Peter Hutterer
b69f9cdfab tablet: fix tool capability test
The devices were never added to the libinput context we were checking, and the
while loop would quietly ignore not getting any events.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-04 07:38:58 +10:00
Peter Hutterer
3370e67336 test: add tablet wheel test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-03 10:32:49 +10:00
Peter Hutterer
b7a19079bf test: add REL_WHEEL to intuos tablet
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-03 10:32:49 +10:00
Peter Hutterer
3927b63207 cosmetic: more duplicate empty line removal
This should be it now, finally...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-03-02 16:48:51 +10:00
Peter Hutterer
ea77fd3272 Merge branch 'master' into tablet-support
Conflicts:
	test/litest.h
	test/valgrind.suppressions
2015-03-02 13:57:17 +10:00
Peter Hutterer
57bba7f8a5 tablet: add libinput_tablet_get_axis_delta()
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:20:45 +10:00
Peter Hutterer
3407226804 tablet: support artpen rotation
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:20:44 +10:00
Peter Hutterer
0d87dd8121 tablet: support airbrush wheel as slider
The little wheel isn't a full wheel, it has a ~90 degree rotation angle with a
range of 1024 values. To avoid confusion with "wheel" elsewhere in the API
name it slider.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:20:44 +10:00
Peter Hutterer
8edae426e3 tablet: support z-rotation for the mouse/lens tool
Needs to be calculated from the x/y tilt values, the mouse has a fixed offset
of 175 degrees counterclockwise.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:20:44 +10:00
Peter Hutterer
7d62532479 tablet: handle mouse-buttons from a tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:20:44 +10:00
Peter Hutterer
9c62daf1d8 tablet: use libwacom to identify tablets for left-handedness
A tablet hotplug event is rare and not a time-critical event, so we load the
database on tablet init and throw it away again.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:20:44 +10:00
Peter Hutterer
3288349077 test: add litest_assert_tablet_button_event()
Does what it says on the box. or at least in the manual inside the box.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:19:00 +10:00
Peter Hutterer
c23fb36eb1 test: fix double comparison macros
args needs to be within () to ensure correct calculation

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:19:00 +10:00
Peter Hutterer
6df8c70c3b test: replace a while loop with a litest helper
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:19:00 +10:00
Peter Hutterer
c1e567e4fa test: fix two tablet tests
The serial test was broken, it succeeded even if we never got an event. The
second test was fine, but complicated. Make it use some of the newer litest
features.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Stephen Chandler Paul <thatslyude@gmail.com>
2015-03-02 13:19:00 +10:00
Peter Hutterer
72cc601007 test: add protocol A touch screen tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-03-02 12:45:47 +10:00
Hans de Goede
18887f90ee touchpad: Gesture support preparation
Handle everything which is not handled by the tap, (soft)button or edge-scroll
code/statemachines in a unified way. Everything is treated as a X-finger
gesture now, and the action to take on finger movement is decided by
the gesture.finger_count setting. Pointer control now simply is seen as a
1 finger gesture, and 2fg scrolling as a 2fg gesture.

This removed the need for special-casing things like switching back to
pointer mode when lifting a finger in 2fg scrolling mode, and also lays the
groundwork for adding 3+ fg gesture support.

Note that 1 test-case needs to be updated to wait for the finger mode
switching when switching mode while a gesture has already been started.
This is actually an improvement as this stops sending spurious pointer
motion events at the end of 2fg scrolling when not lifting both fingers at
exactly the same time.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-23 10:01:02 +01:00
Peter Hutterer
048fc37ba5 Merge branch 'master' into tablet-support 2015-02-23 15:35:17 +10:00
Peter Hutterer
2840733978 cosmetic: drop more double empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-23 13:49:10 +10:00
Peter Hutterer
15974106a6 cosmetic: drop double empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-20 10:16:48 +10:00
Peter Hutterer
115e68476e Merge branch 'master' into tablet-support 2015-02-20 10:16:21 +10:00
Peter Hutterer
ed0f0bf494 test: fix Coverity complaints
seat_button_count
seat_key_count ... uninitialized variable

t = zalloc
s = zalloc ... dereferencing potential NULL-pointer

d->ntouches_down... side-effect in assertion

Coverity run against the 0.10.0 tag, see
https://scan.coverity.com/projects/4298

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Christian Hartmann <cornogle@googlemail.com>
2015-02-20 10:03:09 +10:00
Peter Hutterer
002ef1635d cosmetic: drop double empty lines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-20 09:57:39 +10:00
Stephen Chandler Paul
9871848b53 tablet: Add tests for axes on proximity events 2015-02-19 13:50:19 +10:00
Peter Hutterer
1d8de38853 Revert "tablet: Add tests for axes on proximity events"
mea culpa, I merged a patch that wasn't ready yet (despite me saying I
wouldn't merge it). Updated patch coming up next commit.

This reverts commit 6e7beeb347.
2015-02-19 13:50:19 +10:00
Peter Hutterer
52997faf45 Merge branch 'master' into tablet-support
Conflicts:
	src/libinput.sym
2015-02-18 15:14:26 +10:00
Stephen Chandler Paul
6e7beeb347 tablet: Add tests for axes on proximity events
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-18 13:59:14 +10:00
Stephen Chandler Paul
657f6a9b77 tablet: Update motion_event_state test to use litest_tablet_motion()
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-18 13:59:14 +10:00
Stephen Chandler Paul
b5d6be3cd6 tablet: Include starting values of axes in proximity events
Having a motion event that's sent right after the original proximity event just
to give the values of each axis is somewhat redundant. Since we already include
the values of each axis with each type of event, we may as well use the
proximity event to give the client the starting values for each axis on the
tablet.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-18 13:59:14 +10:00
Stephen Chandler Paul
c7948e3bb5 tablet: Merge PROXIMITY_IN and PROXIMITY_OUT into a single event
There isn't much purpose in having proximity in and out as different events,
combining them into one single event is more consistent with the rest of the
API, and means less code for clients to have to work with.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-18 13:27:29 +10:00
Stephen Chandler Paul
1751688cc8 tablet: Add a left handed mode and tests
On the majority of Wacom tablets, the buttons are on the left side, opposite of
the side where the palm is meant to rest. Because of this, it's impossible to
use the tablet with your left hand (comfortably, anyway) unless you flip it
over, in which case the coordinates need to be inverted for it to match up with
the screen properly. This is where left handed mode comes in. When enabled, it
reverses all the coordinates so that the tablet may be rotated, and the palm
rest on the tablet moved over to the left side.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-18 13:27:29 +10:00
Marek Chalupa
a9f216ab47 add simple symbols leak checker
This patch adds simple script that compares libinput.sym file to the
functions that are marked by LIBINPUT_EXPORT. This script is added
to make check target.

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-13 10:20:44 +10:00
Peter Hutterer
2365f7d3d1 Merge branch 'master' into tablet-support
Added: udev-tag detection for the tablet.
libwacom assigns ID_INPUT_TABLET to all known devices but also
ID_INPUT_TOUCHPAD to all known devices with a touch interface. That's a bug
and should be fixed there but we can work around it by checking both and
making sure only one is set.

Conflicts:
	src/evdev.c
	test/misc.c
2015-02-10 15:23:38 +10:00
Peter Hutterer
b9e4638b9d test: fix a compiler warning about uninitialized variable
Flow is so this cannot be unset, we'd abort if we never get an event. The
compiler doesn't know that though.

In file included from tablet.c:35:0:
tablet.c: In function ‘motion’:
litest.h:202:45: warning: ‘last_reported_y’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
  ck_assert_int_lt((int)(a_ * 256), (int)(b_ * 256))
                                             ^
tablet.c:158:26: note: ‘last_reported_y’ was declared here
  double last_reported_x, last_reported_y;
                          ^
In file included from tablet.c:35:0:
litest.h:208:45: warning: ‘last_reported_x’ may be used uninitialized in this
function [-Wmaybe-uninitialized]
  ck_assert_int_gt((int)(a_ * 256), (int)(b_ * 256))
                                             ^
tablet.c:158:9: note: ‘last_reported_x’ was declared here
  double last_reported_x, last_reported_y;

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-10 11:15:54 +10:00
Peter Hutterer
f571ccc829 test: force the motion test to be axis events only
Ignore anything before the TABLET_AXIS event but make sure we get at least one
axis event after the proximity event.

After that, in the second loop change to use tablet_motion, it's confusing to
use tablet_proximity_in here (though it technically works since we never go
out of prox).

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-10 11:14:15 +10:00
Peter Hutterer
e3a43902f9 Introduce device groups to group logical devices together
Devices like Wacom tablets have multiple event nodes (touch, pad and stylus).
This requires some logical grouping, e.g. setting an Intuos 5 tablet
left-handed effectively turns it upside down. That then applies to both the
stylus and the touch device.

Merging the devices into one struct libinput_device is not feasable, it
complicates the API for little benefit. A caller would still need access to
all subdevices to get udev handles, etc. Some configuration options apply to
the whole device (left-handed) but some (may) only apply to a single subdevice
(calibration, natural scrolling).

Addressing this would make the libinput API unwieldly and hard to use.

Instead, add a device group concept. Each device is a member of a device
group - a singleton for most devices. Wacom tablets will have a single group
across multiple devices, allowing the caller to associate the devices together
if needed.

The API is intentionally very simple and requires the caller to keep track of
groups and which/how many devices are in it. The caller has more powerful
libraries available to do that than we have.

This patch does not address the actual merging of devices into the same
device group, it simply creates a new group for each new device.

[rebased on top of 0.10]
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-06 11:08:43 +10:00
Olivier Fourdan
f420c54a99 Fix an abort if the device speed is NaN
When using libinput with xf86-input-libinput, the device speed is
represented as a float passed via X properties.

If a buggy client gives a broken value, the conversions that occur
can cause the value of speed to be NaN (not a number), aka infinity.

In C, any comparison with NaN always gives false, whatever the value.

So that test in libinput_device_config_accel_set_speed():

   (speed < 1.0 || speed > 1.0)

will necessarily return FALSE, defeating the test of range.

However, since since any comparison with NaN is false, the
opposite assert() in accelerator_set_speed():

   (speed >= 1.0 && speed <= 1.0)

will be false as well, thus triggering the abort() and the crash of
the entire X server along with it.

The solution is to use the same construct in both routines, so that
it fails gracefully in libinput_device_config_accel_set_speed().

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-02-06 10:26:04 +10:00
Peter Hutterer
633d01d146 0.9.0
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iEYEABECAAYFAlTLBSIACgkQ4jt+cLRn8L+4NgCgmgMNoZnmHfNJooSdrRQxzs2t
 8c0An1jHFRAO+9/47m2l2tAzXV2RBaf6
 =b46e
 -----END PGP SIGNATURE-----

Merge tag '0.9.0' into tablet-support

0.9.0

Conflicts:
	test/litest.h
2015-02-05 15:05:36 +10:00
Peter Hutterer
26140aba23 test: switch event conversion tests to use litest devices
Makes the code use more commonly used paths, no real functional changes at
this point. This was using hand-crafted devices as it predates the
litest_add_for_device() helper.

For an upcoming patch to use the udev ID_INPUT_. tags the
event_conversion_key test requires this change: without it the device will be
tagged with ID_INPUT_KEY but not ID_INPUT_KEYBOARD. This could be fixed by
adding all normal keyboard keys to the uinput device but it's easier to just
re-use litest.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-04 08:14:08 +10:00
Peter Hutterer
154b3cf749 Don't init pointer acceleration on absolute devices
Note: touchpads have a different backend, we never get here in that case. This
only applies to true absolute pointer devices.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-03 10:56:38 +10:00
Peter Hutterer
2a95a8586d test: add pointer acceleration defaults test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
2015-02-03 10:43:48 +10:00
Peter Hutterer
4ec2947cc9 test: add per-device udev rule support
Don't rely on a magic version tag, instead let a device define a udev rule and
drop that into the udev runtime directory before the device is created.

There are a couple of caveats with this approach: first, since this changes
system-wide state it may cause issues on the device the test suite is run on.
This can be avoided if the udev rules have filter patterns that ensure only
test devices are affected.

Second, the check test suite aborts but it doesn't run the teardown() function
if a test fails. So far this wasn't a problem since uinput devices disappear
whenever we exit. The rules files will hang around though, so an unchecked
fixture was added to delete all litest-foo.rules files before and after a test
case starts. Unchecked fixtures are run regardless of the exit status of the
test but run in the same address space - i.e. no ck_assert() usage.

Also unchecked fixtures are only run once per test-case, not once per test
function. For us, that means they're only run once per device (we use the
devices as test case), i.e. if a test fails and the udev rule isn't tidied up,
the next test may be unpredictable. This shouldn't matter too much though.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-02-03 10:34:26 +10:00
Peter Hutterer
149f711fcc test: add tests for new lenovo touchpads
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-01-29 14:44:35 +10:00