public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [patch] Problem with mousedev.c
@ 2002-10-30 16:46 Petr Vandrovec
  2002-10-30 18:37 ` Zephaniah E. Hull
  0 siblings, 1 reply; 11+ messages in thread
From: Petr Vandrovec @ 2002-10-30 16:46 UTC (permalink / raw)
  To: Zephaniah E. Hull; +Cc: linux-kernel

On 30 Oct 02 at 10:32, Zephaniah E. Hull wrote:
> 
> The first is the URL for the documentation in question? This seems
> inconsistent with what I remember reading in the past, but can't seem to
> find anymore.

http://www.microsoft.com/hwdev/tech/input/mcompat.asp
http://www.microsoft.com/hwdev/tech/input/5b_wheel.asp

and maybe other interesting links from
http://www.microsoft.com/hwdev/tech/input/default.asp.
 
                                    Best regards,
                                        Petr Vandrovec
                                        vandrove@vc.cvut.cz
                                        

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [patch] Problem with mousedev.c
@ 2002-10-27  1:05 Zephaniah E. Hull
  2002-10-28 13:27 ` Petr Vandrovec
  2002-10-28 17:40 ` Vojtech Pavlik
  0 siblings, 2 replies; 11+ messages in thread
From: Zephaniah E. Hull @ 2002-10-27  1:05 UTC (permalink / raw)
  To: vojtech; +Cc: linux-kernel


[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-10-30 18:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-30 16:46 [patch] Problem with mousedev.c Petr Vandrovec
2002-10-30 18:37 ` Zephaniah E. Hull
  -- strict thread matches above, loose matches on Subject: below --
2002-10-27  1:05 Zephaniah E. Hull
2002-10-28 13:27 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox