]>
Commit | Line | Data |
---|---|---|
5bdb2afd GKH |
1 | From d27eb7931c98a1ebfc9b2fcc48939846bcbfc804 Mon Sep 17 00:00:00 2001 |
2 | From: Hans de Goede <hdegoede@redhat.com> | |
3 | Date: Thu, 18 Dec 2014 09:55:14 -0800 | |
4 | Subject: Input: alps - v7: fix finger counting for > 2 fingers on clickpads | |
5 | ||
6 | From: Hans de Goede <hdegoede@redhat.com> | |
7 | ||
8 | commit d27eb7931c98a1ebfc9b2fcc48939846bcbfc804 upstream. | |
9 | ||
10 | Protocol v7 uses the middle / right button bits on clickpads to communicate | |
11 | "location" information of a 3th touch (and possible 4th) touch on | |
12 | clickpads. | |
13 | ||
14 | Specifically when 3 touches are down, if one of the 3 touches is in the | |
15 | left / right button area, this will get reported in the middle / right | |
16 | button bits and the touchpad will still send a TWO type packet rather then | |
17 | a MULTI type packet, so when this happens we must add the finger reported | |
18 | in the button area to the finger count. | |
19 | ||
20 | Likewise we must also add fingers reported this way to the finger count | |
21 | when we get MULTI packets. | |
22 | ||
23 | BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=86338 | |
24 | Signed-off-by: Hans de Goede <hdegoede@redhat.com> | |
25 | Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> | |
26 | Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> | |
27 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
28 | ||
29 | --- | |
30 | drivers/input/mouse/alps.c | 16 ++++++++++++---- | |
31 | 1 file changed, 12 insertions(+), 4 deletions(-) | |
32 | ||
33 | --- a/drivers/input/mouse/alps.c | |
34 | +++ b/drivers/input/mouse/alps.c | |
35 | @@ -933,6 +933,7 @@ static int alps_decode_packet_v7(struct | |
36 | unsigned char *p, | |
37 | struct psmouse *psmouse) | |
38 | { | |
39 | + struct alps_data *priv = psmouse->private; | |
40 | unsigned char pkt_id; | |
41 | ||
42 | pkt_id = alps_get_packet_id_v7(p); | |
43 | @@ -963,15 +964,22 @@ static int alps_decode_packet_v7(struct | |
44 | ||
45 | alps_get_finger_coordinate_v7(f->mt, p, pkt_id); | |
46 | ||
47 | - f->left = (p[0] & 0x80) >> 7; | |
48 | - f->right = (p[0] & 0x20) >> 5; | |
49 | - f->middle = (p[0] & 0x10) >> 4; | |
50 | - | |
51 | if (pkt_id == V7_PACKET_ID_TWO) | |
52 | f->fingers = alps_get_mt_count(f->mt); | |
53 | else /* pkt_id == V7_PACKET_ID_MULTI */ | |
54 | f->fingers = 3 + (p[5] & 0x03); | |
55 | ||
56 | + f->left = (p[0] & 0x80) >> 7; | |
57 | + if (priv->flags & ALPS_BUTTONPAD) { | |
58 | + if (p[0] & 0x20) | |
59 | + f->fingers++; | |
60 | + if (p[0] & 0x10) | |
61 | + f->fingers++; | |
62 | + } else { | |
63 | + f->right = (p[0] & 0x20) >> 5; | |
64 | + f->middle = (p[0] & 0x10) >> 4; | |
65 | + } | |
66 | + | |
67 | /* Sometimes a single touch is reported in mt[1] rather then mt[0] */ | |
68 | if (f->fingers == 1 && f->mt[0].x == 0 && f->mt[0].y == 0) { | |
69 | f->mt[0].x = f->mt[1].x; |