On Fri, Oct 01, 2010 at 04:27:05PM +0600, Alexandr Shadchin wrote:
> On Thu, Sep 30, 2010 at 08:04:44PM -0400, Kenneth R Westerback wrote:
> > 
> > This is a bit too small. :-). I've copied mikeb@ in to ensure we
> > are not losing too much in translation.
> > 
> > The primary focus right now has to be to fix the regressions Ian@
> > and no doubt others are experiencing. If we can't fix those regressions
> > we will have to revert your diffs and figure out what was wrong
> > before putting them back into the tree. The philosophy here is to
> > commit early but un-commit quickly if something regresses. Especially
> > when Theo is completely buried in something and will neither respond
> > to queries about other stuff or suffer any lengthy periods of
> > breakage that would distract him.
> > 
> > We also face a bit of a deadline as the person who understands this
> > code and these devices the most (miod@) will shortly vanish for a
> > couple of months of moving. There would be reluctance to make big
> > changes in those months. Code cleanup and formatting, etc. would
> > be ideal for that time period.
> > 
> > But first, the regressions. Do you have enough information from
> > ian@ to suggest a test plan or code to tweak?
> > 
> > .... Ken
> 
> OK. This diff resolves Ian problem, Ian has already checked it out.

And it keeps my eeePC 1000HE working. Excellent!!

Anyone else have problems left after this diff? If not, then let's get it
in and go forward from here.

.... Ken

> 
> -- 
> Alexandr Shadchin
> 
> Index: pms.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.6
> diff -u -p -r1.6 pms.c
> --- pms.c     29 Sep 2010 19:39:18 -0000      1.6
> +++ pms.c     30 Sep 2010 19:47:12 -0000
> @@ -49,6 +49,7 @@ struct pms_softc {          /* driver status inf
>  #define PMS_STATE_ENABLED    1
>  #define PMS_STATE_SUSPENDED  2
>  
> +     int poll;
>       int intelli;
>       int inputstate;
>       u_int buttons, oldbuttons;      /* mouse button status */
> @@ -72,7 +73,9 @@ int pms_ioctl(void *, u_long, caddr_t, i
>  int  pms_enable(void *);
>  void pms_disable(void *);
>  
> -int  pms_setintellimode(pckbc_tag_t, pckbc_slot_t);
> +int  pms_cmd(struct pms_softc *, u_char *, int, u_char *, int);
> +
> +int  pms_setintellimode(struct pms_softc *sc);
>  
>  const struct wsmouse_accessops pms_accessops = {
>       pms_enable,
> @@ -81,7 +84,19 @@ const struct wsmouse_accessops pms_acces
>  };
>  
>  int
> -pms_setintellimode(pckbc_tag_t tag, pckbc_slot_t slot)
> +pms_cmd(struct pms_softc *sc, u_char *cmd, int len, u_char *resp, int 
> resplen)
> +{
> +     if (sc->poll) {
> +             return pckbc_poll_cmd(sc->sc_kbctag, sc->sc_kbcslot,
> +                 cmd, len, resplen, resp, 1);
> +     } else {
> +             return pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
> +                 cmd, len, resplen, 1, resp);
> +     }
> +}
> +
> +int
> +pms_setintellimode(struct pms_softc *sc)
>  {
>       u_char cmd[2], resp[1];
>       int i, res;
> @@ -90,13 +105,13 @@ pms_setintellimode(pckbc_tag_t tag, pckb
>       cmd[0] = PMS_SET_SAMPLE;
>       for (i = 0; i < 3; i++) {
>               cmd[1] = rates[i];
> -             res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
> +             res = pms_cmd(sc, cmd, 2, NULL, 0);
>               if (res)
>                       return (0);
>       }
>  
>       cmd[0] = PMS_SEND_DEV_ID;
> -     res = pckbc_enqueue_cmd(tag, slot, cmd, 1, 1, 1, resp);
> +     res = pms_cmd(sc, cmd, 1, resp, 1);
>       if (res || resp[0] != 3)
>               return (0);
>  
> @@ -191,11 +206,8 @@ pmsattach(parent, self, aux)
>       sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint);
>  
>       /* no interrupts until enabled */
> -     cmd[0] = PMS_DEV_DISABLE;
> -     res = pckbc_poll_cmd(pa->pa_tag, pa->pa_slot, cmd, 1, 0, NULL, 0);
> -     if (res)
> -             printf("pmsattach: disable error\n");
> -     pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 0);
> +     sc->poll = 1;
> +     pms_change_state(sc, PMS_STATE_DISABLED);
>  }
>  
>  int
> @@ -219,7 +231,7 @@ pmsactivate(struct device *self, int act
>  int
>  pms_change_state(struct pms_softc *sc, int newstate)
>  {
> -     u_char cmd[1];
> +     u_char cmd[1], resp[2];
>       int res;
>  
>       switch (newstate) {
> @@ -231,12 +243,13 @@ pms_change_state(struct pms_softc *sc, i
>  
>               pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 1);
>  
> -             pckbc_flush(sc->sc_kbctag, sc->sc_kbcslot);
> -             sc->intelli = pms_setintellimode(sc->sc_kbctag, sc->sc_kbcslot);
> +             cmd[0] = PMS_RESET;
> +             res = pms_cmd(sc, cmd, 1, resp, 2);
> +
> +             sc->intelli = pms_setintellimode(sc);
>  
>               cmd[0] = PMS_DEV_ENABLE;
> -             res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
> -                 cmd, 1, 0, 1, 0);
> +             res = pms_cmd(sc, cmd, 1, NULL, 0);
>               if (res)
>                       printf("pms_enable: command error\n");
>  #if 0
> @@ -265,18 +278,19 @@ pms_change_state(struct pms_softc *sc, i
>               }
>  #endif
>               sc->sc_state = newstate;
> +             sc->poll = 0;
>               break;
>       case PMS_STATE_DISABLED:
>  
>               /* FALLTHROUGH */
>       case PMS_STATE_SUSPENDED:
>               cmd[0] = PMS_DEV_DISABLE;
> -             res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
> -                 cmd, 1, 0, 1, 0);
> +             res = pms_cmd(sc, cmd, 1, NULL, 0);
>               if (res)
>                       printf("pms_disable: command error\n");
>               pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 0);
>               sc->sc_state = newstate;
> +             sc->poll = (newstate == PMS_STATE_SUSPENDED) ? 1 : 0;
>               break;
>       }
>       return 0;

Reply via email to