On Mon, Apr 11, 2016 at 04:02:34PM +0200, Mark Kettenis wrote:
> > Date: Sun, 10 Apr 2016 23:33:59 -0700
> > From: Mike Larkin <[email protected]>
> > 
> > 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 was trying to find out when and under what conditions that gets set
earlier and ran into a maze. I'll give it another shot.

> 
> 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.

I took the bits out of the reset path, I'll look again to see if I missed
setxtscancode and add that.

> 
> Also, you should always call config_activate_children(), not just only
> in the DVACT_RESUME case.

Thanks for spotting that ; the original version of the diff I was cooking
had this, but I was removing some debug printfs and looks like I got over
zealous.

-ml

> 
> 
> > 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,
> > 
> > 

Reply via email to