Skip to content

Commit fe888a9

Browse files
paligregkh
authored andcommitted
Input: alps - ignore bad data on Dell Latitudes E6440 and E7440
commit a7ef82a upstream. Sometimes on Dell Latitude laptops psmouse/alps driver receive invalid ALPS protocol V3 packets with bit7 set in last byte. More often it can be reproduced on Dell Latitude E6440 or E7440 with closed lid and pushing cover above touchpad. If bit7 in last packet byte is set then it is not valid ALPS packet. I was told that ALPS devices never send these packets. It is not know yet who send those packets, it could be Dell EC, bug in BIOS and also bug in touchpad firmware... With this patch alps driver does not process those invalid packets, but instead of reporting PSMOUSE_BAD_DATA, getting into out of sync state, getting back in sync with the next byte and spam dmesg we return PSMOUSE_FULL_PACKET. If driver is truly out of sync we'll fail the checks on the next byte and report PSMOUSE_BAD_DATA then. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Tested-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c34120a commit fe888a9

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

‎drivers/input/mouse/alps.c‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,12 +1077,27 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
10771077
}
10781078

10791079
/* Bytes 2 - pktsize should have 0 in the highest bit */
1080-
if ((priv->proto_version < ALPS_PROTO_V5) &&
1080+
if (priv->proto_version < ALPS_PROTO_V5 &&
10811081
psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize &&
10821082
(psmouse->packet[psmouse->pktcnt - 1] & 0x80)) {
10831083
psmouse_dbg(psmouse, "refusing packet[%i] = %x\n",
10841084
psmouse->pktcnt - 1,
10851085
psmouse->packet[psmouse->pktcnt - 1]);
1086+
1087+
if (priv->proto_version == ALPS_PROTO_V3 &&
1088+
psmouse->pktcnt == psmouse->pktsize) {
1089+
/*
1090+
* Some Dell boxes, such as Latitude E6440 or E7440
1091+
* with closed lid, quite often smash last byte of
1092+
* otherwise valid packet with 0xff. Given that the
1093+
* next packet is very likely to be valid let's
1094+
* report PSMOUSE_FULL_PACKET but not process data,
1095+
* rather than reporting PSMOUSE_BAD_DATA and
1096+
* filling the logs.
1097+
*/
1098+
return PSMOUSE_FULL_PACKET;
1099+
}
1100+
10861101
return PSMOUSE_BAD_DATA;
10871102
}
10881103

0 commit comments

Comments
 (0)