Commit graph

1883 commits

Author SHA1 Message Date
Peter Hutterer
de3f1fa6fa Merge branch 'master' into tablet-support 2016-01-25 15:29:11 +10:00
Peter Hutterer
b6f59d0e3b gestures: average motion by active touches, not moved touches
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-25 12:51:29 +10:00
Peter Hutterer
71fcd387f7 gestures: jump straight to swipe for 3+ finger gestures on ST touchpads
The first/second variables are only needed for pinch, so we can skip them
here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-25 11:31:37 +10:00
Peter Hutterer
05bec98681 touchpad: remove unused variable
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-25 11:31:37 +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
25ab3d4615 touchpad: remove unused field multitap_last_time
Unused since d92ae62dad

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-25 08:28:43 +10:00
Peter Hutterer
6920a42fd4 tablet: fix potential null-pointer dereference
Found by coverity

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-22 18:08:44 +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
7899a6cf8d tools: add support for tablet relative events to the event-gui
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
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
108a191a3e tablet: add support for relative x/y motion deltas
Instead of an explicit tablet mode that device must be changed into, let the
caller decide which coordinates are preferred. The tablet mode may be
application-specific and usually depends on the tool as well.

This patch adds an interface to get a motion delta for the x/y axes in
pixel-like coordinates. libinput provides some magic to convert the tablet
data into something that resembles pixels from a mouse motion.
For unaccelerated relative motion, the caller should use the mm values from
the tablet and calculate deltas manually.

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
28205d6f29 touchpad: disable gestures for single-finger touchpads
No point trying to detect pinch gestures if we only have one set of
coordinates. This makes two-finger scrolling on ST touchpads more reactive.

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
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
14baf58e37 touchpad: don't try to unhover touches if nothing changed
If the touch hasn't updated, the distance hasn't changed so there is no need
to unhover.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-22 09:53:21 +10:00
Peter Hutterer
a4adea1646 Merge branch 'wip/3-finger-pinch-gesture' 2016-01-20 15:38:17 +10:00
Peter Hutterer
cab2c1640d doc: explain the gesture ambiguity for 2-slot touchpads
Not much we can do about this until we get SMBus/RMI4 in the kernel or better
touchpads in general but this way we can at least point to some official
explanation.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:13 +10:00
Peter Hutterer
83f3dbd180 gestures: if a finger is 20mm below the other one, assume a pinch gesture
Pure movement detection is quite unreliable when trying 3-finger pinch
gestures, and many gestures are misdetected as swipes. Before looking at the
motion, look at the constellation of the fingers. If one finger is 20mm below
the other one, assume they're in a pinch position.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:13 +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
8234814fe8 gestures: add support for three-finger pinch gestures
https://bugs.freedesktop.org/show_bug.cgi?id=92834

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
7d5c35ccd0 touchpad: check fake finger count for validity
Setting TRIPLETAP unsets DOUBLETAP, etc. This doesn't usually happen with
kernel devices, but every once in a while I get this wrong in a test and spend
hours debugging the code...

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
585deda799 gestures: pass the finger count into pinch events
Prep work for multifinger pinch gestures

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:12 +10:00
Peter Hutterer
c96d11e531 touchpad: constify a couple of helper functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:12 +10:00
Peter Hutterer
e510bef3f2 gestures: drop 2fg naming from the various states
When adding 3+ finger gestures, there isn't much specific state left that's
2-finger only.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 15:38:12 +10:00
Peter Hutterer
99287a5245 gestures: split direction check out into a helper function
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
Olivier Blin
ba062a61a9 gitignore: ignore compile script generated by automake >= 1.14
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 12:53:01 +10:00
Peter Hutterer
91a568d1a1 Merge branch 'master' into tablet-support 2016-01-19 12:02:51 +10:00
Peter Hutterer
999cbc8933 touchpad: drop the model detection - write-only value
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-18 16:44:28 +10:00
Peter Hutterer
f5200c5325 tablet: drop delta array, provided by the tablet_axis struct now
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-15 10:07:18 +10:00
Peter Hutterer
d524313d2b tablet: use a struct rather than a double array for axis values
Makes the code less generic, but more expressive. No visible functional
changes.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-15 10:07:18 +10:00
Peter Hutterer
b1d6c5aa54 tools: share the axis and tip code where appropriate
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-15 10:07:05 +10:00
Peter Hutterer
3e6579998a tools: get pressure/distance/tilt from a tip event too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-15 10:07:05 +10:00
Peter Hutterer
d5a07eb00b tablet: allow the various get_<axis> on tablet button events
There's no reason to prevent this for button events. Unlike the pointer
which is a relative device a tablet is (usually) a device with a lot of state.
Caller code that handles axes is likely shared between the various events,
treating button events separately here doesn't get us any benefit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Acked-by: Jason Gerecke <jason.gerecke@wacom.com>
2016-01-15 10:07:05 +10:00
Peter Hutterer
556aac04b5 touchpad: disable MT for elantech semi-mt touchpads
When three fingers are set down on the touchpad, one finger tends to get a 0/0
coordinate, triggering palm detection in the upper left corner. Handle this
like the jumping semi-mt touchpads and disable MT handling and instead
just rely on the x/y axis and the BTN_TOOL_* events.

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

This kernel patch is required:
https://lkml.org/lkml/2016/1/11/171

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2016-01-14 09:51:56 +10:00
Peter Hutterer
41cc9053dd doc: add section names to motion normalization subheaders
Otherwise the first word is used as section header and discarded from the
output.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-13 14:11:28 +10:00
Peter Hutterer
ea8fff291b touchpad: whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-13 14:11:28 +10:00
Peter Hutterer
52b8874ecc touchpad: drop outdated comment
Obsolete comment since 4ca70c813f, we rely on
the udev hwdb to set the resolution for us.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-12 12:16:25 +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
3c5483ac16 tablet: don't set a pressure offset of 0
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
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