diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2021-11-11 21:58:54 -0800 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2021-11-11 21:58:54 -0800 |
commit | efe6f16c6faf724882ddaba2eda8830a87bcc2b2 (patch) | |
tree | ab5a4ac8c5b917b07af95c866770659f330b7f2b /drivers/input/mouse | |
parent | a02dcde595f7cbd240ccd64de96034ad91cffc40 (diff) | |
parent | 744d0090a5f6dfa4c81b53402ccdf08313100429 (diff) |
Merge branch 'next' into for-linus
Prepare input updates for 5.16 merge window.
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/elantech.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 2d0bc029619f..956d9cd34796 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c @@ -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]; |