I have this as well and was looking at it yesterday.

This diff does seem to fix the issue for me, although both the reset and
pmsi_setintellimode still claim to fail if DEBUG is set, it doesn't make
any difference - the mouse works.

r1.3 was added to fix krw@'s laptop. Ken, can you try with this and see
if it still works? Also could you check if it works now with this but
without the reset part?

pms_change_state won't build with DEBUG because the function expects to
return something, although I don't see why it should return in those
cases (it'll break my machine when reset fails and it returns):


--- pms_intelli.c.orig  Sun Jul 25 23:52:46 2010
+++ pms_intelli.c       Sun Jul 25 23:53:31 2010
@@ -260,17 +260,13 @@
                res = pckbc_poll_cmd(sc->sc_kbctag, sc->sc_kbcslot,
                    cmd, 1, 2, resp, 1);
 #ifdef DEBUG
-               if (res || resp[0] != PMS_RSTDONE || resp[1] != 0) {
+               if (res || resp[0] != PMS_RSTDONE || resp[1] != 0)
                        printf("pmsi_change_state: reset error\n");
-                       return;
-               }
 #endif
                res = pmsi_setintellimode(sc->sc_kbctag, sc->sc_kbcslot, 0);
 #ifdef DEBUG
-               if (res) {
+               if (res)
                        printf("pmsi_change_state: error setting intelli 
mode\n");
-                       return;
-               }
 #endif
 
                cmd[0] = PMS_DEV_ENABLE;



On Sun, Jul 25, 2010 at 10:11:11PM +0000, Miod Vallat wrote:
> > This is due to revision 1.3 of sys/dev/pckbc/pms_intelli.c,
> > reverting it back to 1.2 fixes the problem.
> 
> Does the following diff help?
> 
> Miod
> 
> Index: pms_intelli.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pckbc/pms_intelli.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 pms_intelli.c
> --- pms_intelli.c     24 Jul 2010 10:35:34 -0000      1.3
> +++ pms_intelli.c     25 Jul 2010 22:10:33 -0000
> @@ -77,27 +77,31 @@ const struct wsmouse_accessops pmsi_acce
>       pmsi_disable,
>  };
>  
> -static int pmsi_setintellimode(pckbc_tag_t, pckbc_slot_t);
> +int  pmsi_setintellimode(pckbc_tag_t, pckbc_slot_t, int);
>  
> -static int
> -pmsi_setintellimode(tag, slot)
> -     pckbc_tag_t tag;
> -     pckbc_slot_t slot;
> +int
> +pmsi_setintellimode(pckbc_tag_t tag, pckbc_slot_t slot, int poll)
>  {
>       u_char cmd[2], resp[1];
>       int i, res;
> -     static u_char rates[] = {200, 100, 80};
> +     static const u_char rates[] = {200, 100, 80};
>  
>       cmd[0] = PMS_SET_SAMPLE;
>       for (i = 0; i < 3; i++) {
>               cmd[1] = rates[i];
> -             res = pckbc_poll_cmd(tag, slot, cmd, 2, 0, NULL, 0);
> +             if (poll)
> +                     res = pckbc_poll_cmd(tag, slot, cmd, 2, 0, NULL, 0);
> +             else
> +                     res = pckbc_enqueue_cmd(tag, slot, cmd, 2, 0, 0, NULL);
>               if (res)
>                       return (res);
>       }
>  
>       cmd[0] = PMS_SEND_DEV_ID;
> -     res = pckbc_poll_cmd(tag, slot, cmd, 1, 1, resp, 0);
> +     if (poll)
> +             res = pckbc_poll_cmd(tag, slot, cmd, 1, 1, resp, 0);
> +     else
> +             res = pckbc_enqueue_cmd(tag, slot, cmd, 1, 1, 0, resp);
>       if (res)
>               return (res);
>       if (resp[0] != 3)
> @@ -144,7 +148,7 @@ pmsiprobe(parent, match, aux)
>               return (0);
>       }
>  
> -     if ((res = pmsi_setintellimode(pa->pa_tag, pa->pa_slot))) {
> +     if ((res = pmsi_setintellimode(pa->pa_tag, pa->pa_slot, 1))) {
>  #ifdef DEBUG
>               printf("pmsiprobe: intellimode -> %d\n", res);
>  #endif
> @@ -182,7 +186,7 @@ pmsiattach(parent, self, aux)
>               return;
>       }
>  #endif
> -     res = pmsi_setintellimode(pa->pa_tag, pa->pa_slot);
> +     res = pmsi_setintellimode(pa->pa_tag, pa->pa_slot, 1);
>  #ifdef DEBUG
>       if (res) {
>               printf("pmsiattach: error setting intelli mode\n");
> @@ -257,14 +261,14 @@ pmsi_change_state(struct pmsi_softc *sc,
>                   cmd, 1, 2, resp, 1);
>  #ifdef DEBUG
>               if (res || resp[0] != PMS_RSTDONE || resp[1] != 0) {
> -                     printf("pmsiattach: reset error\n");
> +                     printf("pmsi_change_state: reset error\n");
>                       return;
>               }
>  #endif
> -             res = pmsi_setintellimode(sc->sc_kbctag, sc->sc_kbcslot);
> +             res = pmsi_setintellimode(sc->sc_kbctag, sc->sc_kbcslot, 0);
>  #ifdef DEBUG
>               if (res) {
> -                     printf("pmsiattach: error setting intelli mode\n");
> +                     printf("pmsi_change_state: error setting intelli 
> mode\n");
>                       return;
>               }
>  #endif
> @@ -273,18 +277,17 @@ pmsi_change_state(struct pmsi_softc *sc,
>               res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
>                   cmd, 1, 0, 1, 0);
>               if (res)
> -                     printf("pmsi_enable: command error\n");
> +                     printf("pmsi_change_state: command error\n");
>               sc->sc_state = newstate;
>               break;
>       case PMSI_STATE_DISABLED:
> -
>               /* FALLTHROUGH */
>       case PMSI_STATE_SUSPENDED:
>               cmd[0] = PMS_DEV_DISABLE;
>               res = pckbc_enqueue_cmd(sc->sc_kbctag, sc->sc_kbcslot,
>                   cmd, 1, 0, 1, 0);
>               if (res)
> -                     printf("pmsi_disable: command error\n");
> +                     printf("pmsi_change_state: command error\n");
>               pckbc_slot_enable(sc->sc_kbctag, sc->sc_kbcslot, 0);
>               sc->sc_state = newstate;
>               break;

Reply via email to