mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-30 15:53:22 -05:00
Input: elantench - fix misreporting trackpoint coordinates
commit be896bd3b72b44126c55768f14c22a8729b0992e upstream. Some firmwares occasionally report bogus data from trackpoint, with X or Y displacement being too large (outside of [-127, 127] range). Let's drop such packets so that we do not generate jumps. Signed-off-by: Phoenix Huang <[email protected]> Tested-by: Yufei Du <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Dmitry Torokhov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
ce4bec0a54
commit
17ec1c6b45
1 changed files with 13 additions and 0 deletions
|
|
@ -517,6 +517,19 @@ static void elantech_report_trackpoint(struct psmouse *psmouse,
|
|||
case 0x16008020U:
|
||||
case 0x26800010U:
|
||||
case 0x36808000U:
|
||||
|
||||
/*
|
||||
* This firmware misreport coordinates for trackpoint
|
||||
* occasionally. Discard packets outside of [-127, 127] range
|
||||
* to prevent cursor jumps.
|
||||
*/
|
||||
if (packet[4] == 0x80 || packet[5] == 0x80 ||
|
||||
packet[1] >> 7 == packet[4] >> 7 ||
|
||||
packet[2] >> 7 == packet[5] >> 7) {
|
||||
elantech_debug("discarding packet [%6ph]\n", packet);
|
||||
break;
|
||||
|
||||
}
|
||||
x = packet[4] - (int)((packet[1]^0x80) << 1);
|
||||
y = (int)((packet[2]^0x80) << 1) - packet[5];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue