On Mon, Apr 11, 2016 at 11:23:57PM +0200, Martin Pieuchot wrote:
> On 10/04/16(Sun) 23:33, Mike Larkin wrote:
> > 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.
> 
> I wonder if this isn't a race.  I though that pckbd_enable() was called
> by the wscons(4) layer when resuming.  Does your keyboard also stays 
> disable when you suspend and resume in console?

It's not my keyboard; it's reported to fix a bunch of HP machines of various
models. 

wskbd_enable (calls pckbd_enable) does not appear to be called from
wskbd_activate, perhaps just calling wskbd_enable from there would be
better? (as a matter of fact, wskbd_activate doesn't really do much at
all except set sc_dying=1, and I'm not sure where that gets reset.)

> 
> > 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.
> 
> BTW any reason for not calling pckbd_enable() here?
> 
> > 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