aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/mouse/alps.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 35a49bf57227..49e62201bb6b 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -938,18 +938,36 @@ static int alps_decode_packet_v7(struct alps_fields *f,
938 return 0; 938 return 0;
939 if (pkt_id == V7_PACKET_ID_UNKNOWN) 939 if (pkt_id == V7_PACKET_ID_UNKNOWN)
940 return -1; 940 return -1;
941 /*
942 * NEW packets are send to indicate a discontinuity in the finger
943 * coordinate reporting. Specifically a finger may have moved from
944 * slot 0 to 1 or vice versa. INPUT_MT_TRACK takes care of this for
945 * us.
946 *
947 * NEW packets have 3 problems:
948 * 1) They do not contain middle / right button info (on non clickpads)
949 * this can be worked around by preserving the old button state
950 * 2) They do not contain an accurate fingercount, and they are
951 * typically send when the number of fingers changes. We cannot use
952 * the old finger count as that may mismatch with the amount of
953 * touch coordinates we've available in the NEW packet
954 * 3) Their x data for the second touch is inaccurate leading to
955 * a possible jump of the x coordinate by 16 units when the first
956 * non NEW packet comes in
957 * Since problems 2 & 3 cannot be worked around, just ignore them.
958 */
959 if (pkt_id == V7_PACKET_ID_NEW)
960 return 1;
941 961
942 alps_get_finger_coordinate_v7(f->mt, p, pkt_id); 962 alps_get_finger_coordinate_v7(f->mt, p, pkt_id);
943 963
944 if (pkt_id == V7_PACKET_ID_TWO || pkt_id == V7_PACKET_ID_MULTI) { 964 f->left = (p[0] & 0x80) >> 7;
945 f->left = (p[0] & 0x80) >> 7; 965 f->right = (p[0] & 0x20) >> 5;
946 f->right = (p[0] & 0x20) >> 5; 966 f->middle = (p[0] & 0x10) >> 4;
947 f->middle = (p[0] & 0x10) >> 4;
948 }
949 967
950 if (pkt_id == V7_PACKET_ID_TWO) 968 if (pkt_id == V7_PACKET_ID_TWO)
951 f->fingers = alps_get_mt_count(f->mt); 969 f->fingers = alps_get_mt_count(f->mt);
952 else if (pkt_id == V7_PACKET_ID_MULTI) 970 else /* pkt_id == V7_PACKET_ID_MULTI */
953 f->fingers = 3 + (p[5] & 0x03); 971 f->fingers = 3 + (p[5] & 0x03);
954 972
955 return 0; 973 return 0;