Only parse a "z == 127" packet as a relative Dualpoint stick packet if
the touchpad actually is a Dualpoint device.  The Glidepoint models
don't have a stick, and can report z == 127 for a very wide finger. If
such a packet is parsed as a stick packet, the mouse pointer will
typically jump to one corner of the screen.

Signed-off-by: Peter Osterlund <[EMAIL PROTECTED]>
---

 linux-petero/drivers/input/mouse/alps.c |   20 ++++++++++----------
 linux-petero/drivers/input/mouse/alps.h |    1 +
 2 files changed, 11 insertions(+), 10 deletions(-)

diff -puN drivers/input/mouse/alps.c~alps-glidepoint-has-no-stick 
drivers/input/mouse/alps.c
--- linux/drivers/input/mouse/alps.c~alps-glidepoint-has-no-stick       
2005-01-30 11:22:32.000000000 +0100
+++ linux-petero/drivers/input/mouse/alps.c     2005-01-30 11:22:32.000000000 
+0100
@@ -109,7 +109,8 @@ static void alps_process_packet(struct p
        y = (packet[4] & 0x7f) | ((packet[3] & 0x70)<<(7-4));
        z = packet[5];
 
-       if (z == 127) { /* DualPoint stick is relative, not absolute */
+       if ((priv->model == ALPS_MODEL_DUALPOINT) && (z == 127)) {
+               /* DualPoint stick, relative packet */
                if (x > 383)
                        x = x - 768;
                if (y > 255)
@@ -344,13 +345,13 @@ static int alps_tap_mode(struct psmouse 
 
 static int alps_reconnect(struct psmouse *psmouse)
 {
-       int model;
+       struct alps_data *priv = psmouse->private;
        unsigned char param[4];
 
-       if ((model = alps_get_model(psmouse)) < 0)
+       if ((priv->model = alps_get_model(psmouse)) < 0)
                return -1;
 
-       if (model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 1))
+       if (priv->model == ALPS_MODEL_DUALPOINT && 
alps_passthrough_mode(psmouse, 1))
                return -1;
 
        if (alps_get_status(psmouse, param))
@@ -364,7 +365,7 @@ static int alps_reconnect(struct psmouse
                return -1;
        }
 
-       if (model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 0))
+       if (priv->model == ALPS_MODEL_DUALPOINT && 
alps_passthrough_mode(psmouse, 0))
                return -1;
 
        return 0;
@@ -380,20 +381,19 @@ int alps_init(struct psmouse *psmouse)
 {
        struct alps_data *priv;
        unsigned char param[4];
-       int model;
 
        psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL);
        if (!priv)
                goto init_fail;
        memset(priv, 0, sizeof(struct alps_data));
 
-       if ((model = alps_get_model(psmouse)) < 0)
+       if ((priv->model = alps_get_model(psmouse)) < 0)
                goto init_fail;
 
        printk(KERN_INFO "ALPS Touchpad (%s) detected\n",
-               model == ALPS_MODEL_GLIDEPOINT ? "Glidepoint" : "Dualpoint");
+               priv->model == ALPS_MODEL_GLIDEPOINT ? "Glidepoint" : 
"Dualpoint");
 
-       if (model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 1))
+       if (priv->model == ALPS_MODEL_DUALPOINT && 
alps_passthrough_mode(psmouse, 1))
                goto init_fail;
 
        if (alps_get_status(psmouse, param)) {
@@ -412,7 +412,7 @@ int alps_init(struct psmouse *psmouse)
                goto init_fail;
        }
 
-       if (model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 0))
+       if (priv->model == ALPS_MODEL_DUALPOINT && 
alps_passthrough_mode(psmouse, 0))
                goto init_fail;
 
        psmouse->dev.evbit[LONG(EV_REL)] |= BIT(EV_REL);
diff -puN drivers/input/mouse/alps.h~alps-glidepoint-has-no-stick 
drivers/input/mouse/alps.h
--- linux/drivers/input/mouse/alps.h~alps-glidepoint-has-no-stick       
2005-01-30 11:22:32.000000000 +0100
+++ linux-petero/drivers/input/mouse/alps.h     2005-01-30 11:22:32.000000000 
+0100
@@ -15,6 +15,7 @@ int alps_detect(struct psmouse *psmouse,
 int alps_init(struct psmouse *psmouse);
 
 struct alps_data {
+       int model;                          /* Glidepoint or Dualpoint */
        int prev_fin;                       /* Finger bit from previous packet 
*/
 };
 
_

-- 
Peter Osterlund - [EMAIL PROTECTED]
http://web.telia.com/~u89404340
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to