Commit graph

1460 commits

Author SHA1 Message Date
Peter Hutterer
ae41aa146d Merge branch 'master' into tablet-support 2016-01-27 13:54:00 +10:00
Peter Hutterer
cba2278c3a touchpad: add a config option to disable tap-and-drag
There are a number of use-cases where tapping may be desirable, but
tap-and-drag is not, e.g. where tapping is used to select multiple items in a
list. Having tap-and-drag on hinders this, and the nature of the interaction
means it cannot be detected based on timeouts, movement thresholds, etc.

Provide an option instead to turn tap-an-drag off. Tap-and-drag remains
enabled by default (though tapping is disabled by default).

For the touchpad tap state diagram, the new option disables the transition
from state TOUCH to state TAPPED and releases the button immediately instead.
This means that multitap-and-drag is disabled too since we now just loop
around in the single-tap state for multitap.

It also makes tapping more responsive - we don't have to wait for the timeout
before we know whether it's a tap event. The first touch time is noted, we now
send the button press with the time of the first touch and the release with
the time of the release. This ensures a realistic time diff between the two
events.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.netto>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-27 10:03:28 +10:00
Peter Hutterer
de3f1fa6fa Merge branch 'master' into tablet-support 2016-01-25 15:29:11 +10:00
Peter Hutterer
f0fa09c73f Merge branch 'wip/disable-semi-mt-gestures'
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-25 11:31:35 +10:00
Peter Hutterer
a6b43386d6 test: fix uninitialized variable
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-22 18:06:01 +10:00
Peter Hutterer
f5a60d1d82 test: shut up coverity warnings
Coverity claims they're used uninitialized which isn't true. The condition
that guards it's use also guards its initialization.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-22 18:04:41 +10:00
Peter Hutterer
7f16a8818d test: rename the tap tests suite name to "tap:..."
Better than just having one single suite

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-22 17:38:14 +10:00
Peter Hutterer
7164d6eff5 tablet: hook up relative motion events
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-22 16:16:55 +10:00
Peter Hutterer
342bc51016 touchpad: disable MT for all semi-mt devices
Synaptics, Elantech and Alps semi-mt devices all have issues with reporting
correct MT data, even the bounding box which semi-mt devices are supposed to
report is wrong.

Synaptics devices have massive jumps with two fingers down. Elantech devices
may open slots without coordinate data. Alps devices may send 0/0 coordinates
as initial slot position.

All these may be addressable with specific quirks, but the actual benefit is
largely restricted to better palm detection (though even with quirks this is
unlikely to work) and support for pinch gestures (again, lack of coordinates
makes supporting those hard anyway).

Elantech: https://bugs.freedesktop.org/show_bug.cgi?id=93583
Alps: https://bugzilla.redhat.com/show_bug.cgi?id=1295073

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-22 11:50:45 +10:00
Peter Hutterer
d19307f20d test: when moving 2 fingers, move them in the same frame
More accurate representation of what we actually want to do. Plus it avoids
weird test case failures in semi-mt where we always pick the t/l and b/r
touches for the bounding box. That is the proper behavior for semi-mt, but
it's not for the tests where we expect simultaneous finger movement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-22 11:37:51 +10:00
Peter Hutterer
a4adea1646 Merge branch 'wip/3-finger-pinch-gesture' 2016-01-20 15:38:17 +10:00
Peter Hutterer
f129c09adb test: add more gesture tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:13 +10:00
Peter Hutterer
d9e1b2603e test: change semi-mt 2fg scroll test to use two-finger movement
As we implement more gestures, we will drop two-finger scrolling performed by
only a single finger movement.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:13 +10:00
Peter Hutterer
1280d638a2 test: rearrange fingers for gesture tests
Prep work for the coming patch, arrange the fingers horizontally rather than
vertically.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:13 +10:00
Peter Hutterer
ff2ee2c681 test: run pinch gesture tests for 2-slot touchpads
Some of the 2-slot touchpads don't do gestures though (e.g. semi-mt) so skip
those.

And change the movement granularity for the pinch and spread tests so we stay
under one degree angle for lower-resolution touchpads too.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:13 +10:00
Peter Hutterer
f8d4c87e13 test: remove a wait loop from the usec gesture test
We know we (should) have events when we get here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:13 +10:00
Peter Hutterer
02ca5556b4 test: remove leftover debug_trace statement
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:12 +10:00
Peter Hutterer
82335b0ab9 test: fix compiler warning
litest-selftest.c: In function ‘litest_ptr_eq_notrigger’:
litest-selftest.c:172:10: warning: initialization makes integer from pointer
without a cast [-Wint-conversion]
  int c = NULL;
          ^
litest-selftest.c:173:10: warning: initialization makes integer from pointer
without a cast [-Wint-conversion]
  int d = NULL;
          ^

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 12:56:35 +10:00
Peter Hutterer
91a568d1a1 Merge branch 'master' into tablet-support 2016-01-19 12:02:51 +10:00
Peter Hutterer
988cfda42c evdev: only reject devices with missing MT x/y if they're MT devices
A fake MT device may have ABS_MT_POSITION_X but not Y. In this case we don't
care, because we don't handle those axes anyway.

http://bugs.freedesktop.org/show_bug.cgi?id=93474

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-12 09:07:36 +10:00
Peter Hutterer
1a99977ca0 tablet: a tip event can replace an axis event
When we're only dealing with BTN_TOUCH we can make the tip event independent
of the axis event. Now that we handle pressure thresholds to trigger tip state
this does not work, we'd have to send an axis event with the new pressure and
then a tip event. Since the pressure triggers the tip event this seems
disconnected.

Make the tip event officially capable of carrying axes. A caller can then
decide how to forward this to the next layer.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-11 15:17:46 +10:00
Peter Hutterer
96fbf84862 tablet: add pressure threshold handling
On tablets with ABS_PRESSURE use a pressure value to determine tip state, not
BTN_TOUCH. This enables us (down the road) to have device-specific pressure
thresholds. For now we use a 5% default for all devices.

The threshold is a range, if we go past the upper range we initiate the tip
down, if we go below the lower range we release the tip again.

This affects two current tests:
* Once we have pressure offsets and pressure thresholds, we're biased towards
pressure. So we can only check that distance is zero when there is a pressure
value, not the other way round.
* When the pressure threshold is exceeded on proximity in with a nonzero
distance, we can only warn and handle the pressure as normal. Since this is a
niche case anyway anything fancier is likely unnecessary.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-11 15:17:46 +10:00
Peter Hutterer
8d79b718fd test: fix a bunch of tablet tests for pressure threshold introduction
Preparation work for a pressure threshold where we can't just send a BTN_TOUCH
and expect it to trigger the tip event. So the event sequence now needs to
resemble the right order so the threshold will be triggered.

In some cases requires processing an axis event before the tip event. That
behavior will be changed in a follow-up commit.

It also requires that all tablets set ABS_PRESSURE on proximity in.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-11 15:17:46 +10:00
Caibin Chen
b3f11180e3 touchpad: fix DWT pairing for Macbook Pro 2015
Label internal keyboards through the udev hwdb and only pair the internal
(usb) Apple touchpads with those keyboards labelled as such.

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

Co-authored-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-11 10:11:32 +10:00
Peter Hutterer
0b124a1a5d tablet: insert "STATE" into proximity/tip states
Makes it even longer, but at least it's consistent with button and key state.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-06 11:02:40 +10:00
Peter Hutterer
6098655cfa test: fix a bunch of tablet tests to assume, rather than wait for events
litest_wait_for_event_of_type() skips all other events in the queue before the
one we want. This isn't appropriate in most cases, and unless we're dealing
with timeouts we should assume that a certain sequence triggered a specific
event rather than waiting some time for it to trigger.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 13:22:53 +10:00
Peter Hutterer
77c1c75a64 test: use the litest_axis_set_value helper
Should've been part of 2f481ba4a2 during rebasing.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 09:53:21 +10:00
Peter Hutterer
3a16203a34 test: add two more tests for correct button sequence on proximity
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 09:15:36 +10:00
Peter Hutterer
2f481ba4a2 tablet: handle custom proximity handling
For the puck/lens cursor tool we need to artificially reduce proximity
detection. These tools are usually used in a relative mode (i.e. like a mouse)
and thus require lifting and resetting the tool multiple times to move across
the screen. The tablets' distance detection goes too far, requiring the user
to lift the device several cm on every move. This is uncomfortable.

Introduce an artificial distance threshold for the devices with the default
value taken from the X.Org wacom driver. If a tool is in proximity but outside
of this range, fake proximity events accordingly.

If a button was pressed while we were out of range we discard that event and
send it later when we enter proximity again.

This is the simple implementation that only takes one proximity out value (the
one from the wacom driver) and applies it to all. Those devices that support a
button/lens tool and have a different default threshold are well out of date.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

[rebased, tests updated for new axis percentage behavior (8d76734f)]

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 09:15:36 +10:00
Peter Hutterer
cd36b44b9b tablet: invert tilt axes when left-handed is enabled
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 08:08:06 +10:00
Peter Hutterer
cbb9e9e809 tablet: add libinput_tablet_tool_is_unique()
For checking if a tablet tool can be uniquely identified by libinput. In
practice this means checking for a nonzero serial number, but let's not
restrict ourselves to allowing just that.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-23 07:55:11 +10:00
Peter Hutterer
aaac47d442 test: add litest_axis_set_value helper function
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-23 07:33:11 +10:00
Peter Hutterer
beee8403e9 test: move litest_assert_ macros and helpers up to the rest of the defines
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-21 10:55:36 +10:00
Peter Hutterer
aaea4a63ec tablet: add tilt tests
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-21 09:47:31 +10:00
Peter Hutterer
f96ee412df tablet: reduce event deltas to only apply to the wheel
Part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Only the rel wheel has true delta events, everything else is a delta
calculated by libinput based on the previous position. Since we supply that
position to the callers anyway, they can determine that delta themselves
where needed.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
828ca69c77 tablet: rename libinput_tablet_tool_has_axis into an axis-specific API set
Part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Note that this commit drops the ability to check whether a tablet has an x or
y axis. If it doesn't, libinput won't initialize the tablet anyway so this was
superfluous already.

Likewise with the tilt axes - either we have x and y tilt or we have neither,
so separate checks for tilt_x and tilt_y is unnecessary.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
e5a33086bc tablet: rename axis_get_value into an axis-specific API set
Second part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Note that this commit drops the ability to get the absolute value from a
relative wheel. The previous API always returned 0 for this case, it is not
needed anymore.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
5c9c481047 tablet: rename axis_has_changed into an axis-specific API set
First part of the big revamp to get rid of libinput_tablet_tool_axis and
replace it with a set of axis-specific APIs.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Lyude <cpaul@redhat.com>
2015-12-21 07:59:00 +10:00
Peter Hutterer
30df66d0a6 evdev: drain any pending evdev events on a device
open_restricted() doesn't always mean 'open the fd'. When the X server uses
systemd-logind, the fd is opened once before PreInit and then kept open across
devices being disabled and enabled through the protocol.

When the device is re-enabled and libinput_path_add_device is called for the
device, we may have events pending on the fd, leaking information that we
should just ignore.

There's also the potential of inconsistent state. The kernel updates the
device state whenever it processes an event, the evdev ioctls return that
state. If events are pending, the state we see is newer than the events we
process immediately after initialization. That can lead to confusion.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2015-12-18 10:10:01 +10:00
Peter Hutterer
67b92adee7 test: modernise the tablet tool serial tests a bit
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-16 09:03:18 +10:00
Peter Hutterer
50f4caf1b8 test: use proper proximity events in tablet serial test
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-16 09:03:15 +10:00
Peter Hutterer
db852ef0db tablet: support tool-specific pressure offsets
If a tool wears out, it may have a pre-loaded pressure offset. In that case,
even when the tool is not physically in contact with the tablet surface it
will send pressure events.

Use automatic pressure offset detection, similar to what the X.Org wacom
driver does. On proximity-in, check the pressure and if the distance is above
50% of the range and the pressure is nonzero but below 20% of the range, use
that value as pressure offset.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Ping Cheng <pingc@wacom.com>
2015-12-15 08:21:39 +10:00
Peter Hutterer
09456ebf23 test: add pressure axes to proximity in for the bamboo and the cintiq
Required for pressure offset testing

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-15 08:08:16 +10:00
Peter Hutterer
6261e4e61f Merge branch 'master' into tablet-support 2015-12-14 12:44:05 +10:00
Peter Hutterer
f0a57fc97a test: change tablet matrix test to use absolute x/y values
Prep work for dropping delta coordinates.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 10:31:40 +10:00
Peter Hutterer
72249f8a16 test: fix test for tablet rel wheel discrete deltas
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 10:29:42 +10:00
Peter Hutterer
c7533b753d test: fix copy/paste error in motion_delta_partial
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:49:57 +10:00
Peter Hutterer
1a34401137 test: set default axis values for all tablet devices
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:27:59 +10:00
Peter Hutterer
a4ac2bebb3 test: extend sendfile from 4kB to 40kB
The file is already larger than 4k, so we ended up truncating the file for the
tests. This went unnoticed until recent additions that ended up truncating it
halfway through an assignment.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 08:25:56 +10:00
Peter Hutterer
727d184230 test: change extra axes to take a percentage as well
And change them to doubles, we need more granularity when the range is only
0-100.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2015-12-14 07:44:57 +10:00