diff options
author | Stefan Hagen <sdk@cvs.openbsd.org> | 2022-07-23 05:55:17 +0000 |
---|---|---|
committer | Stefan Hagen <sdk@cvs.openbsd.org> | 2022-07-23 05:55:17 +0000 |
commit | f82fa7c59386ac7cf540ebc9b4ee9eb26e488979 (patch) | |
tree | 262a3bd569bbffb5b66fe7a7b55ea50398df47ca /sys/dev | |
parent | 4baa8b5169d98cdc4f2412a722514fa1c1aa467c (diff) |
Discard relative movement packets outside of [-127, 127] range to
prevent cursor jumps when using the trackpoint on some lenovo laptops.
Known affected models:
- Lenovo Thinkpad X13 Gen1
- Lenovo Thinkpad T14(s)
- Lenovo Thinkpad E15 Gen3
- Lenovo A475
With help from stsp@
OK stsp@ miod@ deraadt@ bru@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pckbc/pms.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/pckbc/pms.c b/sys/dev/pckbc/pms.c index 0fc2910860e..42121347c3a 100644 --- a/sys/dev/pckbc/pms.c +++ b/sys/dev/pckbc/pms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pms.c,v 1.96 2022/04/06 18:59:30 naddy Exp $ */ +/* $OpenBSD: pms.c,v 1.97 2022/07/23 05:55:16 sdk Exp $ */ /* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */ /*- @@ -2610,6 +2610,16 @@ pms_proc_elantech_v4(struct pms_softc *sc) case ELANTECH_PKT_TRACKPOINT: if (sc->sc_dev_enable & PMS_DEV_SECONDARY) { + /* + * This firmware misreport coordinates for trackpoint + * occasionally. Discard packets outside of [-127, 127] range + * to prevent cursor jumps. + */ + if (sc->packet[4] == 0x80 || sc->packet[5] == 0x80 || + sc->packet[1] >> 7 == sc->packet[4] >> 7 || + sc->packet[2] >> 7 == sc->packet[5] >> 7) + return; + x = sc->packet[4] - 0x100 + (sc->packet[1] << 1); y = sc->packet[5] - 0x100 + (sc->packet[2] << 1); buttons = butmap[sc->packet[0] & 7]; |