diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2013-03-18 16:31:02 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2013-03-18 16:31:02 +0000 |
commit | ff4f9028becde0972564773c443094b5bc9d4163 (patch) | |
tree | b3b3826ebef19cd217f8c1fd2a6babdd89d49c2c /sys/dev/pckbc/pms.c | |
parent | 66b44e51a4f88ad6da132adfc8ca3f292e344e26 (diff) |
Once we've detected an elantech touchpad, stop probing for other hardware
versions. Fixes a problem reported by Peter J. Philipp where the pms driver
spits out "not in sync yet" messages after attaching to elantech v2 hardware.
Fix tested by me on v3 hardware, and by Peter on v2 hardware.
ok mpi@ shadchin@
Diffstat (limited to 'sys/dev/pckbc/pms.c')
-rw-r--r-- | sys/dev/pckbc/pms.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/dev/pckbc/pms.c b/sys/dev/pckbc/pms.c index c36562409d9..8e4a29efca5 100644 --- a/sys/dev/pckbc/pms.c +++ b/sys/dev/pckbc/pms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pms.c,v 1.36 2013/03/16 11:14:47 stsp Exp $ */ +/* $OpenBSD: pms.c,v 1.37 2013/03/18 16:31:01 stsp Exp $ */ /* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */ /*- @@ -118,6 +118,7 @@ struct elantech_softc { #define ELANTECH_F_2FINGER_PACKET 0x04 #define ELANTECH_F_HW_V1_OLD 0x08 + int hw_version; int min_x, min_y; int max_x, max_y; @@ -1714,6 +1715,10 @@ pms_enable_elantech_v1(struct pms_softc *sc) struct elantech_softc *elantech = sc->elantech; int i; + /* Check if a different hardware version has been detected. */ + if (elantech && elantech->hw_version != 0 && elantech->hw_version != 1) + return (0); + if (elantech_knock(sc)) goto err; @@ -1736,6 +1741,8 @@ pms_enable_elantech_v1(struct pms_softc *sc) for (i = 0; i < nitems(sc->elantech->parity); i++) sc->elantech->parity[i] = sc->elantech->parity[i & (i - 1)] ^ 1; + elantech->hw_version = 1; + return (1); err: @@ -1754,6 +1761,10 @@ pms_enable_elantech_v2(struct pms_softc *sc) { struct elantech_softc *elantech = sc->elantech; + /* Check if a different hardware version has been detected. */ + if (elantech && elantech->hw_version != 0 && elantech->hw_version != 2) + return (0); + if (elantech_knock(sc)) goto err; @@ -1773,6 +1784,8 @@ pms_enable_elantech_v2(struct pms_softc *sc) } else if (elantech_set_absolute_mode_v2(sc)) goto err; + elantech->hw_version = 2; + return (1); err: @@ -1791,6 +1804,10 @@ pms_enable_elantech_v3(struct pms_softc *sc) { struct elantech_softc *elantech = sc->elantech; + /* Check if a different hardware version has been detected. */ + if (elantech && elantech->hw_version != 0 && elantech->hw_version != 3) + return (0); + if (elantech_knock(sc)) goto err; @@ -1810,6 +1827,8 @@ pms_enable_elantech_v3(struct pms_softc *sc) } else if (elantech_set_absolute_mode_v3(sc)) goto err; + elantech->hw_version = 3; + return (1); err: |