diff options
author | Stefan Sperling <stsp@cvs.openbsd.org> | 2013-09-03 09:29:36 +0000 |
---|---|---|
committer | Stefan Sperling <stsp@cvs.openbsd.org> | 2013-09-03 09:29:36 +0000 |
commit | 45ecba9b39bab8c2dc04838892f6e1891193d7a3 (patch) | |
tree | bb8f4a3ef16f3c957e5f9a069e95fd5f72334f49 /sys/dev/pckbc | |
parent | 9bca93eb8a6a42e42ff6e3c4dbf9ad981af9d565 (diff) |
When /dev/wsmouse is opened right after resume, some synaptics touchpads
are still taking time to wake up. So make the pms(4) driver wait a little
longer before giving up on them. Fixes mouse after resume on my x130e TP.
ok mpi, earlier versions tested by weerd with no regressions seen
Diffstat (limited to 'sys/dev/pckbc')
-rw-r--r-- | sys/dev/pckbc/pms.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/sys/dev/pckbc/pms.c b/sys/dev/pckbc/pms.c index c7ad4ab766c..4a995c92541 100644 --- a/sys/dev/pckbc/pms.c +++ b/sys/dev/pckbc/pms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pms.c,v 1.46 2013/09/03 07:37:58 mpi Exp $ */ +/* $OpenBSD: pms.c,v 1.47 2013/09/03 09:29:35 stsp Exp $ */ /* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */ /*- @@ -273,6 +273,7 @@ void pms_proc_elantech_v2(struct pms_softc *); void pms_proc_elantech_v3(struct pms_softc *); void pms_proc_elantech_v4(struct pms_softc *); +int synaptics_knock(struct pms_softc *); int synaptics_set_mode(struct pms_softc *, int); int synaptics_query(struct pms_softc *, int, int *); int synaptics_get_hwinfo(struct pms_softc *); @@ -937,12 +938,9 @@ synaptics_sec_proc(struct pms_softc *sc) } int -pms_enable_synaptics(struct pms_softc *sc) +synaptics_knock(struct pms_softc *sc) { - struct synaptics_softc *syn = sc->synaptics; - struct wsmousedev_attach_args a; u_char resp[3]; - int mode; if (pms_set_resolution(sc, 0) || pms_set_resolution(sc, 0) || @@ -950,7 +948,38 @@ pms_enable_synaptics(struct pms_softc *sc) pms_set_resolution(sc, 0) || pms_get_status(sc, resp) || resp[1] != SYNAPTICS_ID_MAGIC) - goto err; + return (-1); + + return (0); +} + +int +pms_enable_synaptics(struct pms_softc *sc) +{ + struct synaptics_softc *syn = sc->synaptics; + struct wsmousedev_attach_args a; + int mode, i; + + if (synaptics_knock(sc)) { + if (sc->synaptics == NULL) + goto err; + /* + * Some synaptics touchpads don't resume quickly. + * Retry a few times. + */ + for (i = 10; i > 0; --i) { + printf("%s: device not resuming, retrying\n", + DEVNAME(sc)); + pms_reset(sc); + if (synaptics_knock(sc) == 0) + break; + delay(100000); + } + if (i == 0) { + printf("%s: lost device\n", DEVNAME(sc)); + goto err; + } + } if (sc->synaptics == NULL) { sc->synaptics = syn = malloc(sizeof(struct synaptics_softc), |