touchpad: handle serial synaptics slot confusion on TRIPLETAP
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 16 Jul 2015 23:30:03 +0000 (09:30 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Wed, 22 Jul 2015 03:53:09 +0000 (13:53 +1000)
commitd4ceb671b95707f79676768a8b85d920f1c90cbb
tree435c5a054c079fa611bc7d874ce8fa105d2a917b
parentab016fd8ed84b58a8f9cabc958cd91ebb4110e57
touchpad: handle serial synaptics slot confusion on TRIPLETAP

Synatics touchpads only have 2 slots, but support TRIPLETAP and above. When
the third finger touches, the kernel may end the second slot and re-start it
with the coordinates of the third touch in the next frame. The event sequence
is something like:

ABS_MT_SLOT          0
ABS_MT_POSITION_X    4000
ABS_MT_POSITION_Y    4000
ABS_MT_PRESSURE      78
ABS_MT_SLOT          1
ABS_MT_TRACKING_ID   -1

ABS_X                4000
ABS_Y                4000
ABS_PRESSURE         78
BTN_TOOL_DOUBLETAP   0
BTN_TOOL_TRIPLETAP   1
--- SYN_REPORT (0) ----------
ABS_MT_SLOT          0
ABS_MT_POSITION_X    4000
ABS_MT_POSITION_Y    4000
ABS_MT_PRESSURE      78
ABS_MT_SLOT          1
ABS_MT_TRACKING_ID   55
ABS_MT_POSITION_X    2000
ABS_MT_POSITION_Y    2000
ABS_MT_PRESSURE      72

ABS_X                4000
ABS_Y                4000
ABS_PRESSURE         78
--- SYN_REPORT (0) ----------

libinput usually ignores any BTN_TOOL_* <= num_slots since we expect
that the slot values are valid. Make an exception for the serial synaptics
touchpads. If a touch has ended when the fake touch goes above active-slots
(but still within num-slots), move that touch back to UPDATE. This ensures the
right number of nfingers_down. When the touch restarts again in the next
frame, tp_begin_touch() will skip over re-initializing it because it's already
in UPDATE anyway.

Note that at this point this only handles the transition _to_ TRIPLETAP, not
from TRIPLETAP to DOUBLETAP. Need to wait for this to be seen in the wild
first.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Hallelujah-expressed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev-mt-touchpad.c
test/touchpad.c