alistair23-linux/drivers/input/mouse
Daniel Kurtz 4dc772d274 Input: synaptics - process finger (<=3) transitions
Synaptics image sensor touchpads track 5 fingers, but only report 2.
This patch attempts to deal with some idiosyncrasies of these touchpads:

 * When there are 3 or more fingers, only two are reported.
 * The touchpad tracks the 5 fingers in slot[0] through slot[4].
 * It always reports the lowest and highest valid slots in SGM and AGM
   packets, respectively.
 * The number of fingers is only reported in the SGM packet.  However,
   the number of fingers can change either before or after an AGM
   packet.
 * Thus, if an SGM reports a different number of fingers than the last
   SGM, it is impossible to tell whether the intervening AGM corresponds
   to the old number of fingers or the new number of fingers.
 * For example, when going from 2->3 fingers, it is not possible to tell
   whether tell AGM contains slot[1] (old 2nd finger) or slot[2] (new
   3rd finger).
 * When fingers are added one at at time, from 1->2->3, it is possible to
   track which slots are contained in the SGM and AGM packets:
     1 finger:  SGM = slot[0], no AGM
     2 fingers: SGM = slot[0], AGM = slot[1]
     3 fingers: SGM = slot[0], AGM = slot[2]
 * It is also possible to track which slot is contained in the SGM when 1
   of 2 fingers is removed.  This is because the touchpad sends a special
   (0,0,0) AGM packet whenever all fingers are removed except slot[0]:
     Last AGM == (0,0,0): SGM contains slot[1]
     Else: SGM contains slot[0]
 * However, once there are 3 fingers, if exactly 1 finger is removed, it
   is impossible to tell which 2 slots are contained in SGM and AGM.
   The (SGM,AGM) could be (0,1), (0,2), or (1,2). There is no way to know.
 * Similarly, if two fingers are simultaneously removed (3->1), then it
   is only possible to know if SGM still contains slot[0].
 * Since it is not possible to reliably track which slot is being
   reported, we invalidate the tracking_id every time the number of
   fingers changes until this ambiguity is resolved when:
     a) All fingers are removed.
     b) 4 or 5 fingers are touched, generates an AGM-CONTACT packet.
     c) All fingers are removed except slot[0].  In this special case, the
        ambiguity is resolved since by the (0,0,0) AGM packet.

Behavior of the driver:

When 2 or more fingers are present on the touchpad, the kernel reports
up to two MT-B slots containing the position data for two of the fingers
reported by the touchpad.  If the identity of a finger cannot be tracked
when the number-of-fingers changes, the corresponding MT-B slot will be
invalidated (track_id set to -1), and a new track_id will be assigned in
a subsequent input event report.

The driver always reports the total number of fingers using one of the
EV_KEY/BTN_TOOL_*TAP events. This could differ from the number of valid
MT-B slots for two reasons:
 a) There are more than 2 fingers on the pad.
 b) During ambiguous number-of-fingers transitions, the correct track_id
    for one or both of the slots cannot be determined, so the slots are
    invalidated.

Thus, this is a hybrid singletouch/MT-B scheme. Userspace can detect
this behavior by noting that the driver supports more EV_KEY/BTN_TOOL_*TAP
events than its maximum EV_ABS/ABS_MT_SLOT.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Acked-by: Chase Douglas <chase.douglas@canonical.com>
Acked-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-08-23 23:08:24 -07:00
..
alps.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2010-05-05 07:53:18 -07:00
alps.h Input: ALPS - add interleaved protocol support (Dell E6x00 series) 2009-12-15 22:15:25 -08:00
amimouse.c m68k: amiga - Mouse platform device conversion 2010-05-26 19:51:09 +02:00
appletouch.c Input: appletouch - remove extra KERN_DEBUG use from dprintk 2010-10-31 07:16:00 -07:00
atarimouse.c input/atari: Fix mouse movement and button mapping 2011-05-19 18:19:12 +02:00
bcm5974.c Fix common misspellings 2011-03-31 11:26:23 -03:00
elantech.c Input: elantech - remove support for proprietary X driver 2011-05-16 22:48:43 -07:00
elantech.h Input: elantech - export pressure and width when supported 2011-05-16 22:48:36 -07:00
gpio_mouse.c Input: update author email for gpio_mouse, at32psif, and atmel-wm97xx 2011-06-29 00:26:02 -07:00
hgpk.c Input: hgpk - fix powersave mode 2010-11-15 01:33:59 -08:00
hgpk.h Input: hgpk - extend jumpiness detection 2010-11-11 22:21:24 -08:00
inport.c Input: remove CVS keywords 2008-05-20 12:17:39 -04:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
lifebook.c Input: lifebook - make dmi callback functions return 1 2011-07-13 00:08:15 -07:00
lifebook.h Input: psmouse - do not carry DMI data around 2009-12-03 23:25:36 -08:00
logibm.c Input: remove CVS keywords 2008-05-20 12:17:39 -04:00
logips2pp.c Input: psmouse - small formatting changes to better follow coding style 2010-05-19 11:31:51 -07:00
logips2pp.h Input: psmouse - use boolean type 2009-09-10 22:11:38 -07:00
Makefile Input: add new driver for Sentelic Finger Sensing Pad 2009-08-19 21:46:09 -07:00
maplemouse.c maple: input: fix up maple mouse driver 2009-04-27 09:22:31 +09:00
pc110pad.c Input: switch to input_abs_*() access functions 2010-08-02 20:29:56 -07:00
psmouse-base.c Input: hgpk - support GlideSensor and PenTablet modes 2010-11-11 22:21:15 -08:00
psmouse.h Input: psmouse - ignore parity error for basic protocols 2010-04-19 00:50:42 -07:00
pxa930_trkball.c Input: remove unneeded version.h includes 2011-06-27 12:42:54 -07:00
rpcmouse.c [ARM] acorn,ebsa110,footbridge,integrator,sa1100: Convert asm/io.h to linux/io.h 2009-03-25 10:21:35 +00:00
sentelic.c Input: remove unneeded version.h includes 2011-06-27 12:42:54 -07:00
sentelic.h Input: psmouse - use boolean type 2009-09-10 22:11:38 -07:00
sermouse.c Input: remove CVS keywords 2008-05-20 12:17:39 -04:00
synaptics.c Input: synaptics - process finger (<=3) transitions 2011-08-23 23:08:24 -07:00
synaptics.h Input: synaptics - process finger (<=3) transitions 2011-08-23 23:08:24 -07:00
synaptics_i2c.c Fix common misspellings 2011-03-31 11:26:23 -03:00
touchkit_ps2.c Update broken web addresses in the kernel. 2010-10-18 11:03:14 +02:00
touchkit_ps2.h Input: psmouse - use boolean type 2009-09-10 22:11:38 -07:00
trackpoint.c Input: return -ENOMEM in select drivers when memory allocation fails 2010-10-13 07:49:23 -07:00
trackpoint.h Input: psmouse - use boolean type 2009-09-10 22:11:38 -07:00
vsxxxaa.c Fix common misspellings 2011-03-31 11:26:23 -03:00