From a57625b601b491a37f0ea42e7f7e63032a268d23 Mon Sep 17 00:00:00 2001 From: Mike Larkin Date: Thu, 14 Apr 2016 07:06:04 +0000 Subject: 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. --- sys/dev/pckbc/pckbd.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'sys/dev/pckbc') 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); @@ -182,6 +183,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) -- cgit v1.2.3