[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#166550: [patch] X misparses the EXPS/2 mouse protocol.



Subject: [patch] X misparses the EXPS/2 mouse protocol.
Package: xserver-xfree86
Severity: normal

To make a long story short, X is wrong in how it parses the wheel data
for EXPS/2 protocol mice.

0xF and 0x1 are used to indicate the first wheel, and 0xE and 0x2 for
the second wheel.
(Yes, I have real hardware which generates this.)

diff -ur build-tree/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c build-tree.mine/xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c
--- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c	2001-12-19 11:05:22.000000000 -0500
+++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c	2002-10-26 18:56:12.000000000 -0400
@@ -1423,7 +1423,12 @@
 		      (pBuf[3] & 0x20) >> 1;        /* button 5 */
 	    dx = (pBuf[0] & 0x10) ?    pBuf[1]-256  :  pBuf[1];
 	    dy = (pBuf[0] & 0x20) ?  -(pBuf[2]-256) : -pBuf[2];
-	    dz = (pBuf[3] & 0x08) ? (pBuf[3] & 0x0f) - 16 : (pBuf[3] & 0x0f);
+	    switch (pBuf[3] & 0x0F) {
+		case 0x01: dz = 1; break;
+		case 0x0f: dz = -1; break;
+		case 0x02: dw = 1; break;
+		case 0x0e: dw = -1; break;
+	    }
 	    break;
 
 	case PROT_MMPS2:	/* MouseMan+ PS/2 */

-- 
	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.

It's also your right to f*ck up your own version of Linux, but you're
not getting close to mine.

                Linus

Attachment: pgpdV1S6qS2W6.pgp
Description: PGP signature


Reply to: