Commit b0bb76920dedcf54ff87123c9b143a6222ef5db2

Authored by Hans de Goede
Committed by Greg Kroah-Hartman
1 parent 7b35ab6f00

Input: alps - v7: fix finger counting for > 2 fingers on clickpads

commit d27eb7931c98a1ebfc9b2fcc48939846bcbfc804 upstream.

Protocol v7 uses the middle / right button bits on clickpads to communicate
"location" information of a 3th touch (and possible 4th) touch on
clickpads.

Specifically when 3 touches are down, if one of the 3 touches is in the
left / right button area, this will get reported in the middle / right
button bits and the touchpad will still send a TWO type packet rather then
a MULTI type packet, so when this happens we must add the finger reported
in the button area to the finger count.

Likewise we must also add fingers reported this way to the finger count
when we get MULTI packets.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=86338
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 12 additions and 4 deletions Side-by-side Diff

drivers/input/mouse/alps.c
... ... @@ -933,6 +933,7 @@
933 933 unsigned char *p,
934 934 struct psmouse *psmouse)
935 935 {
  936 + struct alps_data *priv = psmouse->private;
936 937 unsigned char pkt_id;
937 938  
938 939 pkt_id = alps_get_packet_id_v7(p);
939 940  
... ... @@ -963,14 +964,21 @@
963 964  
964 965 alps_get_finger_coordinate_v7(f->mt, p, pkt_id);
965 966  
966   - f->left = (p[0] & 0x80) >> 7;
967   - f->right = (p[0] & 0x20) >> 5;
968   - f->middle = (p[0] & 0x10) >> 4;
969   -
970 967 if (pkt_id == V7_PACKET_ID_TWO)
971 968 f->fingers = alps_get_mt_count(f->mt);
972 969 else /* pkt_id == V7_PACKET_ID_MULTI */
973 970 f->fingers = 3 + (p[5] & 0x03);
  971 +
  972 + f->left = (p[0] & 0x80) >> 7;
  973 + if (priv->flags & ALPS_BUTTONPAD) {
  974 + if (p[0] & 0x20)
  975 + f->fingers++;
  976 + if (p[0] & 0x10)
  977 + f->fingers++;
  978 + } else {
  979 + f->right = (p[0] & 0x20) >> 5;
  980 + f->middle = (p[0] & 0x10) >> 4;
  981 + }
974 982  
975 983 /* Sometimes a single touch is reported in mt[1] rather then mt[0] */
976 984 if (f->fingers == 1 && f->mt[0].x == 0 && f->mt[0].y == 0) {