On Mon, Sep 02, 2013 at 06:51:36PM +0200, Stefan Sperling wrote:
> On Mon, Sep 02, 2013 at 02:32:50PM +0200, Martin Pieuchot wrote:
> > You might also rely on the fact that if you have a "sc->synaptics"
> > already allocated to try harder.  Because in this case you know
> > that you have a synaptic touchpad.
> 
> That works. Here's a simpler diff that fixes my issue, too.
> 

Maybe it makes sense to try to increase the response time

Index: pckbc.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.36
diff -u -p -r1.36 pckbc.c
--- pckbc.c     23 May 2013 18:29:51 -0000      1.36
+++ pckbc.c     2 Sep 2013 18:24:19 -0000
@@ -616,7 +616,7 @@ pckbc_poll_cmd1(struct pckbc_internal *t
 
        while (cmd->responseidx < cmd->responselen) {
                if (cmd->flags & KBC_CMDFLAG_SLOW)
-                       i = 100; /* 10s ??? */
+                       i = 1000; /* 100s ??? */
                else
                        i = 10; /* 1s ??? */
                while (i--) {


or

Index: pckbc.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/pckbc.c,v
retrieving revision 1.36
diff -u -p -r1.36 pckbc.c
--- pckbc.c     23 May 2013 18:29:51 -0000      1.36
+++ pckbc.c     2 Sep 2013 18:28:43 -0000
@@ -144,8 +144,8 @@ pckbc_poll_data1(bus_space_tag_t iot, bu
        int i;
        u_char stat;
 
-       /* polls for ~100ms */
-       for (i = 100; i; i--, delay(1000)) {
+       /* polls for ~1s */
+       for (i = 100; i; i--, delay(10000)) {
                stat = bus_space_read_1(iot, ioh_c, 0);
                if (stat & KBS_DIB) {
                        register u_char c;



> Index: pms.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
> retrieving revision 1.45
> diff -u -p -r1.45 pms.c
> --- pms.c     16 Jul 2013 08:11:39 -0000      1.45
> +++ pms.c     2 Sep 2013 16:44:48 -0000
> @@ -937,15 +937,38 @@ pms_enable_synaptics(struct pms_softc *s
>       struct synaptics_softc *syn = sc->synaptics;
>       struct wsmousedev_attach_args a;
>       u_char resp[3];
> -     int mode;
> +     int mode, i;
>  
>       if (pms_set_resolution(sc, 0) ||
>           pms_set_resolution(sc, 0) ||
>           pms_set_resolution(sc, 0) ||
>           pms_set_resolution(sc, 0) ||
>           pms_get_status(sc, resp) ||
> -         resp[1] != SYNAPTICS_ID_MAGIC)
> -             goto err;
> +         resp[1] != SYNAPTICS_ID_MAGIC) {
> +             if (sc->synaptics == NULL)
> +                     goto err;
> +             /* 
> +              * Some synaptics touchpads don't resume quickly.
> +              * Retry a few times.
> +              */
> +             for (i = 10; i > 0; --i) {
> +                     printf("%s: device not resuming, retrying\n",
> +                         DEVNAME(sc));
> +                     pms_reset(sc);
> +                     if (pms_set_resolution(sc, 0) ||
> +                         pms_set_resolution(sc, 0) ||
> +                         pms_set_resolution(sc, 0) ||
> +                         pms_set_resolution(sc, 0) ||
> +                         pms_get_status(sc, resp) ||
> +                         resp[1] == SYNAPTICS_ID_MAGIC)
> +                             break;
> +                     delay(100000);
> +             }
> +             if (i == 0) {
> +                     printf("%s: lost device\n", DEVNAME(sc));
> +                     goto err;
> +             }
> +     }
>  
>       if (sc->synaptics == NULL) {
>               sc->synaptics = syn = malloc(sizeof(struct synaptics_softc),
> 

-- 
Alexandr Shadchin

Reply via email to