public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Zephaniah E\. Hull" <warp@babylon.d2dc.net>
To: vojtech@suse.cz
Cc: linux-kernel@vger.kernel.org
Subject: [patch] Problem with mousedev.c
Date: Sat, 26 Oct 2002 21:05:38 -0400	[thread overview]
Message-ID: <20021027010538.GA1690@babylon.d2dc.net> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1016 bytes --]

To make a long story short, mousedev.c does not properly implement the
EXPS/2 protocol, specificly dealing with the wheel.

The lower 8 bits of the 4th byte are supposed to be 0x1 or 0xf to
indicate movement of the first wheel, and 0x2 or 0xe for the second
wheel.

Attached is a patch to correct this.

This does not get my two wheel mouse working perfectly yet, sadly that
will take a bit of a hack, and I'm not sure where the best place to put
it is yet, but this gets it back to generating correct data.

Zephaniah E. Hull.
(Debian GPM maintainer.)

-- 
	1024D/E65A7801 Zephaniah E. Hull <warp@babylon.d2dc.net>
	   92ED 94E4 B1E6 3624 226D  5727 4453 008B E65A 7801
	    CCs of replies from mailing lists are requested.

  Yes, Java is so bulletproofed that to a C programmer it feels like
being in a straightjacket, but it's a really comfy and warm
straightjacket, and the world would be a safer place if everyone was
straightjacketed most of the time.        -- Overheard in the SDM.

[-- Attachment #1.2: hid.diff --]
[-- Type: text/plain, Size: 1799 bytes --]

diff -ur linux/drivers/input/mousedev.c linux.mine/drivers/input/mousedev.c
--- linux/drivers/input/mousedev.c	2001-09-30 15:26:05.000000000 -0400
+++ linux.mine/drivers/input/mousedev.c	2002-10-26 18:20:19.000000000 -0400
@@ -62,7 +62,7 @@
 	struct fasync_struct *fasync;
 	struct mousedev *mousedev;
 	struct mousedev_list *next;
-	int dx, dy, dz, oldx, oldy;
+	int dw, dx, dy, dz, oldx, oldy;
 	signed char ps2[6];
 	unsigned long buttons;
 	unsigned char ready, buffer, bufsiz;
@@ -117,6 +117,7 @@
 						case REL_X:	list->dx += value; break;
 						case REL_Y:	list->dy -= value; break;
 						case REL_WHEEL:	if (list->mode) list->dz -= value; break;
+						case REL_HWHEEL: if (list->mode == 2) list->dw -= value; break;
 					}
 					break;
 
@@ -260,9 +261,22 @@
 	list->bufsiz = off + 3;
 
 	if (list->mode == 2) {
-		list->ps2[off + 3] = (list->dz > 7 ? 7 : (list->dz < -7 ? -7 : list->dz));
-		list->dz -= list->ps2[off + 3];
-		list->ps2[off + 3] = (list->ps2[off + 3] & 0x0f) | ((list->buttons & 0x18) << 1);
+		if (!list->dz && !list->dw) {
+			list->ps2[off + 3] = 0;
+		} else if (list->dw > 0) {
+			list->ps2[off + 3] = 0x2;
+			list->dw--;
+		} else if (list->dw < 0) {
+			list->ps2[off + 3] = 0xe;
+			list->dw++;
+		} else if (list->dz > 0) {
+			list->ps2[off + 3] = 0x1;
+			list->dz--;
+		} else if (list->dz < 0) {
+			list->ps2[off + 3] = 0xf;
+			list->dz++;
+		}
+		list->ps2[off + 3] |= (list->buttons & 0x18) << 1;
 		list->bufsiz++;
 	}
 	
@@ -272,7 +286,7 @@
 		list->bufsiz++;
 	}
 
-	if (!list->dx && !list->dy && (!list->mode || !list->dz)) list->ready = 0;
+	if (!list->dx && !list->dy && (!list->mode || !list->dz) && ((list->mode != 2) || !list->dw)) list->ready = 0;
 	list->buffer = list->bufsiz;
 }
 

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2002-10-27  0:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-27  1:05 Zephaniah E. Hull [this message]
2002-10-28 13:27 ` [patch] Problem with mousedev.c Petr Vandrovec
2002-10-28 17:00   ` Zephaniah E. Hull
2002-10-28 17:40 ` Vojtech Pavlik
2002-10-30 15:32   ` Zephaniah E. Hull
2002-10-30 15:59     ` Vojtech Pavlik
2002-10-30 16:04       ` Zephaniah E. Hull
2002-10-30 16:11         ` Vojtech Pavlik
2002-10-30 16:21           ` Zephaniah E. Hull
  -- strict thread matches above, loose matches on Subject: below --
2002-10-30 16:46 Petr Vandrovec
2002-10-30 18:37 ` Zephaniah E. Hull

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=20021027010538.GA1690@babylon.d2dc.net \
    --to=warp@babylon.d2dc.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox