> Date: Sun, 10 Apr 2016 23:33:59 -0700 > From: Mike Larkin <mlar...@azathoth.net> > > Please test this diff on all machines that you can successfully (today) > resume with 'zzz'. Please make sure that after resume, the keyboard > still works. > > This diff re-enables the keyboard on resume. Previously, we were re-enabling > the keyboard *controller* but apparently on some machines (notably the HP > 4530s) the keyboard itself resumes in 'disabled' state and requires a > re-enable. > > Keyboards are finicky, and this diff requires widespread testing before it > can go in, to ensure no regressions. Please let me know if you have keyboard > issues after resume.
FWIW, I think this is fairly low-risk. You should probably only do this if the keyboard is actually enabled. Which means, only if sc_enabled is set. I also wonder if we also need the pckbd_set_xtscancode() call. That shouldn't keep you from committing this as a first step though. Also, you should always call config_activate_children(), not just only in the DVACT_RESUME case. > Index: dev/pckbc/pckbd.c > =================================================================== > RCS file: /cvs/src/sys/dev/pckbc/pckbd.c,v > retrieving revision 1.42 > diff -u -p -a -u -r1.42 pckbd.c > --- dev/pckbc/pckbd.c 4 May 2015 09:33:46 -0000 1.42 > +++ dev/pckbc/pckbd.c 11 Apr 2016 06:24:06 -0000 > @@ -123,13 +123,14 @@ static int pckbd_is_console(pckbc_tag_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); > @@ -181,6 +182,29 @@ static int pckbd_decode(struct pckbd_int > 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: > + /* > + * 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); > + rv = config_activate_children(self, act); > + break; > + } > + > + return (rv); > +} > > int > pckbd_set_xtscancode(pckbc_tag_t kbctag, pckbc_slot_t kbcslot, > >