If your touchpad/clitpad is recognized as an ALPS Dualpoint, like: 

$ dmesg |grep pms0
pms0: ALPS Dualpoint, version 0x6222

Please test the diff below and report me any breakage/improvement. It should
at least fix the "pms0: not in sync yet, discard input" error you may
have seen recently. 


Index: pms.c
===================================================================
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.22
diff -u -p -r1.22 pms.c
--- pms.c       4 Oct 2011 06:30:40 -0000       1.22
+++ pms.c       16 Oct 2011 12:48:00 -0000
@@ -39,6 +39,8 @@
 #include <dev/wscons/wsconsio.h>
 #include <dev/wscons/wsmousevar.h>
 
+#define DEBUG
+
 #ifdef DEBUG
 #define DPRINTF(x...)  do { printf(x); } while (0);
 #else
@@ -87,6 +89,7 @@ struct synaptics_softc {
 
 struct alps_softc {
        int model;
+       int mask;
        int version;
 
        int min_x, min_y;
@@ -141,28 +144,29 @@ static const u_int butmap[8] = {
 
 static const struct alps_model {
        int version;
+       int mask;
        int model;
 } alps_models[] = {
-       { 0x2021, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-       { 0x2221, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-       { 0x2222, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-       { 0x3222, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-       { 0x5212, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-       { 0x5321, ALPS_GLIDEPOINT },
-       { 0x5322, ALPS_GLIDEPOINT },
-       { 0x603b, ALPS_GLIDEPOINT },
-       { 0x6222, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-       { 0x6321, ALPS_GLIDEPOINT },
-       { 0x6322, ALPS_GLIDEPOINT },
-       { 0x6323, ALPS_GLIDEPOINT },
-       { 0x6324, ALPS_GLIDEPOINT },
-       { 0x6325, ALPS_GLIDEPOINT },
-       { 0x6326, ALPS_GLIDEPOINT },
-       { 0x633b, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
-       { 0x7301, ALPS_DUALPOINT },
-       { 0x7321, ALPS_GLIDEPOINT },
-       { 0x7322, ALPS_GLIDEPOINT },
-       { 0x7325, ALPS_GLIDEPOINT },
+       { 0x2021, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+       { 0x2221, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+       { 0x2222, 0xff, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+       { 0x3222, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+       { 0x5212, 0xff, ALPS_DUALPOINT | ALPS_PASSTHROUGH | ALPS_INTERLEAVED },
+       { 0x5321, 0xf8, ALPS_GLIDEPOINT },
+       { 0x5322, 0xf8, ALPS_GLIDEPOINT },
+       { 0x603b, 0xf8, ALPS_GLIDEPOINT },
+       { 0x6222, 0xcf, ALPS_DUALPOINT | ALPS_PASSTHROUGH | ALPS_INTERLEAVED },
+       { 0x6321, 0xf8, ALPS_GLIDEPOINT },
+       { 0x6322, 0xf8, ALPS_GLIDEPOINT },
+       { 0x6323, 0xf8, ALPS_GLIDEPOINT },
+       { 0x6324, 0x8f, ALPS_GLIDEPOINT },
+       { 0x6325, 0xef, ALPS_GLIDEPOINT },
+       { 0x6326, 0xf8, ALPS_GLIDEPOINT },
+       { 0x633b, 0xf8, ALPS_DUALPOINT | ALPS_PASSTHROUGH },
+       { 0x7301, 0xf8, ALPS_DUALPOINT },
+       { 0x7321, 0xf8, ALPS_GLIDEPOINT },
+       { 0x7322, 0xf8, ALPS_GLIDEPOINT },
+       { 0x7325, 0xcf, ALPS_GLIDEPOINT },
 #if 0
        { 0x7326, 0 },  /* XXX Uses unknown v3 protocol */
 #endif
@@ -1058,6 +1062,7 @@ alps_get_hwinfo(struct pms_softc *sc)
        for (i = 0; i < nitems(alps_models); i++)
                if (alps->version == alps_models[i].version) {
                        alps->model = alps_models[i].model;
+                       alps->mask = alps_models[i].mask;
                        return (0);
                }
 
@@ -1069,6 +1074,7 @@ int
 pms_enable_alps(struct pms_softc *sc)
 {
        struct alps_softc *alps = sc->alps;
+       struct wsmousedev_attach_args a;
        u_char resp[3];
 
        if (pms_set_resolution(sc, 0) ||
@@ -1141,6 +1147,13 @@ pms_enable_alps(struct pms_softc *sc)
                goto err;
        }
 
+       if (alps->model & ALPS_INTERLEAVED) {
+               a.accessops = &synaptics_pt_accessops;
+               a.accesscookie = sc;
+               sc->sc_pt_wsmousedev = config_found((void *)sc, &a,
+                   wsmousedevprint);
+       }
+
        return (1);
 
 err:
@@ -1183,19 +1196,34 @@ pms_ioctl_alps(struct pms_softc *sc, u_l
 int
 pms_sync_alps(struct pms_softc *sc, int data)
 {
+       struct alps_softc *alps = sc->alps;
+
        switch (sc->inputstate) {
        case 0:
-               if ((data & 0xf8) != 0xf8)      /* XXX model dependant? */
+               if ((data & alps->mask) != alps->mask)
                        return (-1);
                break;
        case 1:
        case 2:
        case 3:
        case 4:
-       case 5:
+               /* All but the first byte should have the highest bit at 0. */
                if ((data & 0x80) != 0)
                        return (-1);
                break;
+       case 5:
+               /* If we got a interleaved PS/2 packet process it. */
+               if ((data & 0x80) != 0) {
+                       if (alps->model & ALPS_INTERLEAVED &&
+                           (sc->packet[3] & 0x0f) == 0x0f) {
+                               synaptics_pt_proc(sc);
+
+                               sc->inputstate = 3;
+                               break;
+                       }
+                       return (-1);
+               }
+               break;
        }
 
        return (0);
@@ -1226,6 +1254,8 @@ pms_proc_alps(struct pms_softc *sc)
            ((sc->packet[3] & 4) ? WSMOUSE_BUTTON(2) : 0);
 
        if (alps->wsmode == WSMOUSE_NATIVE) {
+               DPRINTF("%s: x=%d, y=%d, z=%d\n", DEVNAME(sc), x, y, z);
+
                if (z == 127) {
                        /* DualPoint touchpads are not absolute. */
                        wsmouse_input(sc->sc_wsmousedev, buttons, x, y, 0, 0,
Index: pmsreg.h
===================================================================
RCS file: /cvs/src/sys/dev/pckbc/pmsreg.h,v
retrieving revision 1.5
diff -u -p -r1.5 pmsreg.h
--- pmsreg.h    4 Oct 2011 06:30:40 -0000       1.5
+++ pmsreg.h    16 Oct 2011 11:19:04 -0000
@@ -96,6 +96,7 @@
 #define ALPS_GLIDEPOINT                                (1 << 1)
 #define ALPS_DUALPOINT                         (1 << 2)
 #define ALPS_PASSTHROUGH                       (1 << 3)
+#define ALPS_INTERLEAVED                       (1 << 4)
 
 /* Resolutions */
 #define SYNAPTICS_RESOLUTION_X(r)              (((r) >> 16) & 0xff)

Reply via email to