All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Osterlund <petero2@telia.com>
To: linux-kernel@vger.kernel.org
Cc: Dmitry Torokhov <dtor_core@ameritech.net>,
	Vojtech Pavlik <vojtech@suse.cz>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH 3/4] Fix "pointer jumps to corner of screen" problem on ALPS Glidepoint touchpads.
Date: 30 Jan 2005 11:35:12 +0100	[thread overview]
Message-ID: <m3vf9f8asf.fsf_-_@telia.com> (raw)
In-Reply-To: <m3zmyr8avm.fsf@telia.com>

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 <petero2@telia.com>
---

 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 - petero2@telia.com
http://web.telia.com/~u89404340

  reply	other threads:[~2005-01-30 10:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-30 10:31 [PATCH 1/4] Make mousedev.c report all events to user space immediately Peter Osterlund
2005-01-30 10:33 ` [PATCH 2/4] Enable hardware tapping for ALPS touchpads Peter Osterlund
2005-01-30 10:35   ` Peter Osterlund [this message]
2005-01-30 10:36     ` [PATCH 4/4] Add support for Synaptics touchpad scroll wheels Peter Osterlund
2005-02-04 13:20       ` Vojtech Pavlik
2005-02-03 11:18     ` [PATCH 3/4] Fix "pointer jumps to corner of screen" problem on ALPS Glidepoint touchpads Giuseppe Bilotta
2005-02-03 22:06       ` Peter Osterlund
2005-02-04 13:19     ` Vojtech Pavlik
2005-02-04 13:16 ` [PATCH 1/4] Make mousedev.c report all events to user space immediately Vojtech Pavlik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3vf9f8asf.fsf_-_@telia.com \
    --to=petero2@telia.com \
    --cc=akpm@osdl.org \
    --cc=dtor_core@ameritech.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.