diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2016-04-14 07:06:04 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2016-04-14 07:06:04 +0000 |
commit | a57625b601b491a37f0ea42e7f7e63032a268d23 (patch) | |
tree | 237ee0270ef780108d7b1587cdb75c93eaa003e9 /sys/dev/pckbc | |
parent | 9a51b0e7eb49be04049010d6b98ffa106e258530 (diff) |
Re-enable pckbd on resume (similar to what we do on boot). Fixes problems
on (at least) various HP laptops that previously had no working keyboard
after resuming from 'zzz'.
Reported by Aleksandar Lakic, who also verified several versions of the
diff during development, thanks.
discussed with miod and kettenis, tested by many others on tech@ - thanks.
Diffstat (limited to 'sys/dev/pckbc')
-rw-r--r-- | sys/dev/pckbc/pckbd.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/sys/dev/pckbc/pckbd.c b/sys/dev/pckbc/pckbd.c index 6bd4ed52f13..4b9bdfedde4 100644 --- a/sys/dev/pckbc/pckbd.c +++ b/sys/dev/pckbc/pckbd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pckbd.c,v 1.42 2015/05/04 09:33:46 mpi Exp $ */ +/* $OpenBSD: pckbd.c,v 1.43 2016/04/14 07:06:03 mlarkin Exp $ */ /* $NetBSD: pckbd.c,v 1.24 2000/06/05 22:20:57 sommerfeld Exp $ */ /*- @@ -123,13 +123,14 @@ static int pckbd_is_console(pckbc_tag_t, pckbc_slot_t); int pckbdprobe(struct device *, void *, void *); void pckbdattach(struct device *, struct device *, void *); +int pckbdactivate(struct device *, int); struct cfattach pckbd_ca = { sizeof(struct pckbd_softc), pckbdprobe, pckbdattach, NULL, - NULL + pckbdactivate }; int pckbd_enable(void *, int); @@ -183,6 +184,33 @@ static int pckbd_led_encode(int); struct pckbd_internal pckbd_consdata; int +pckbdactivate(struct device *self, int act) +{ + struct pckbd_softc *sc = (struct pckbd_softc *)self; + int rv = 0; + u_char cmd[1]; + + switch(act) { + case DVACT_RESUME: + if (sc->sc_enabled) { + /* + * Some keyboards are not enabled after a reset, + * so make sure it is enabled now. + */ + cmd[0] = KBC_ENABLE; + (void) pckbc_poll_cmd(sc->id->t_kbctag, + sc->id->t_kbcslot, cmd, 1, 0, NULL, 0); + /* XXX - also invoke pckbd_set_xtscancode() too? */ + } + break; + } + + rv = config_activate_children(self, act); + + return (rv); +} + +int pckbd_set_xtscancode(pckbc_tag_t kbctag, pckbc_slot_t kbcslot, struct pckbd_internal *id) { |