NetBSD Problem Report #44980

From martijnb@bigbird.dohd.org  Tue May 17 21:30:34 2011
Return-Path: <martijnb@bigbird.dohd.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 8D66163B8AC
	for <gnats-bugs@gnats.netbsd.org>; Tue, 17 May 2011 21:30:34 +0000 (UTC)
Message-Id: <20110517210930.GA2039@atlas.pienjo.invalid>
Date: Tue, 17 May 2011 23:09:30 +0200
From: martijn.van.buul@gmail.com
Reply-To: martijn.van.buul@gmail.com
To: gnats-bugs@gnats.NetBSD.org
Subject: Z-axis not working for Microsoft Comfort Mouse 6000 (includes fix)

>Number:         44980
>Category:       kern
>Synopsis:       ums(4): Z-axis not working for Microsoft Comfort Mouse 6000(+fix)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 17 21:35:00 +0000 2011
>Last-Modified:  Wed May 18 06:40:02 +0000 2011
>Originator:     martijn.van.buul@gmail.com
>Release:        NetBSD 5.99.51
>Organization:

>Environment:


System: NetBSD atlas.pienjo.invalid 5.99.51 NetBSD 5.99.51 (GENERIC) #4: Tue May 17 22:05:46 CEST 2011 martijnb@atlas.pienjo.invalid:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	The "Microsoft Comfort Mouse 6000" (5 buttons, scroll wheel) reports
	to have a Z- and W-axis, but these aren't working properly. The 
	location of these controls in the report is wrong.

	Additionally, the mouse reports to have a W-axis, but there's no
	physical wheel tilt control.

	From dmesg:

uhidev0: Microsoft Comfort Mouse 6000, rev 2.00/0.44, addr 4, iclass 3/1
uhidev0: 28 report ids
ums0 at uhidev0 reportid 16: 5 buttons, W and Z dirs

	Usbdevs:

port 4 addr 4: low speed, power 100 mA, config 1, Comfort Mouse 6000(0x077d), Microsoft(0x045e), rev 0.44

>How-To-Repeat:
	Connect a Microsoft Comfort Mouse, notice how the Z-axis reports bogus
	data, while the scrollwheel is ignored.

>Fix:
	Apparently, a sibling of this mouse (the "Wireless Laser Mouse 6000")
	has similar problems, and a workaround was already present in 
	sys/dev/usb/ums.c. I have continued that pattern.

	The mouse sends out 7-byte records. Buttons are mapped on bits 0-5
	of the first byte; X axis (16 bits) is mapped on bytes 1 and 2;
        Y axis is mapped on bytes 3 and 4. Byte 5 corresponds to wheel
	up/down movements, byte 6 is always zero on my mouse, and assumed
	to be scroll wheel tilt on models supporting this.

	The product ID of this mouse (0x077d) wasn't present in usbdevs
	yet, and should probably be added.

	Patch with -current:

Index: ums.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/ums.c,v
retrieving revision 1.81
diff -u -r1.81 ums.c
--- ums.c	3 Nov 2010 22:34:24 -0000	1.81
+++ ums.c	17 May 2011 20:11:54 -0000
@@ -295,6 +295,22 @@
 			sc->sc_loc_w.pos = sc->sc_loc_z.pos + 8;
 	}

+	/*
+ 	 * The Microsoft Comfort Mouse 6000 reports bad positions for
+	 * the wheel and wheel tilt controls. Wheel control is confirmed
+	 * to be at byte 5, tilt is assumed to be at byte 6. Fix this 
+	 * if necessary.
+	 */
+
+        /* XXX: Using hardcoded product ID, mouse is not in usbdevs yet */
+	if (uha->uaa->vendor == USB_VENDOR_MICROSOFT &&
+	    uha->uaa->product == 0x77d) {
+		if ((sc->flags & UMS_Z) && sc->sc_loc_z.pos == 0)
+			sc->sc_loc_z.pos = 40;
+		if ((sc->flags & UMS_W) && sc->sc_loc_w.pos == 0)
+			sc->sc_loc_w.pos = sc->sc_loc_z.pos + 8;
+	}
+
 	/* figure out the number of buttons */
 	for (i = 1; i <= MAX_BUTTONS; i++)
 		if (!hid_locate(desc, size, HID_USAGE2(HUP_BUTTON, i),

>Audit-Trail:
From: Julian Fagir <gnrp@komkon2.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/44980: Z-axis not working for Microsoft Comfort Mouse 6000
 (includes fix)
Date: Wed, 18 May 2011 00:04:14 +0200

 Hi,

 > 	The "Microsoft Comfort Mouse 6000" (5 buttons, scroll wheel) reports
 > 	to have a Z- and W-axis, but these aren't working properly. The 
 > 	location of these controls in the report is wrong.
 > 
 > 	Additionally, the mouse reports to have a W-axis, but there's no
 > 	physical wheel tilt control.
 this problem is similar to the one I had with the Microsoft Natural Wireless
 6000, see misc/44634. There seem to be more mice like that, or is it only the
 6000-series of Microsoft?

 Regards, Julian

From: Martijn van Buul <martijn.van.buul@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/44980: Z-axis not working for Microsoft Comfort Mouse 6000
 (includes fix)
Date: Wed, 18 May 2011 08:26:21 +0200

 On 18 May 2011 00:05, Julian Fagir <gnrp@komkon2.de> wrote:
 > =A0this problem is similar to the one I had with the Microsoft Natural Wi=
 reless
 > =A06000, see misc/44634. There seem to be more mice like that, or is it o=
 nly the
 > =A06000-series of Microsoft?
 >
 > =A0Regards, Julian

 Possibly.

 After submitting this bug I realised that my wife carries a small
 wireless Microsoft mouse in her laptop bag, and lo and behold: It
 suffers from the same problem, even though it doesn't carry the "6000"
 name: it's a "wireless notebook optical mouse 3000", but uses the same
 vendor- and product id as your mouse. While I haven't tested it yet,
 i'm sure the fix would've worked.

 So yes, maybe there *is* something wrong with recent Microsoft mice,
 and it's not just incidental. The difference between my "Comfort Mouse
 6000" and the others seems to be the width of the X- and Y- axis. On
 the "Wireless optical mouse" it's 8 bits, on the "Comfort mouse 6000"
 it's 16 bits - but in both cases the correct location of the Z axis
 would be "directly following the Y axis". I rewrote the existing patch
 to reflect this; instead of using a fixed location it uses the data
 for the Y channel to calculate the right position. (see below, this
 patch makes both my mice work)

 It would be nice if these mice could be identified in a different way
 besides their vendor/product ID. There might be more.

 Index: ums.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvsroot/src/sys/dev/usb/ums.c,v
 retrieving revision 1.81
 diff -u -r1.81 ums.c
 --- ums.c	3 Nov 2010 22:34:24 -0000	1.81
 +++ ums.c	18 May 2011 06:25:40 -0000
 @@ -282,15 +282,19 @@
  	}

  	/*
 -	 * The Microsoft Wireless Laser Mouse 6000 v2.0 reports a bad
 -	 * position for the wheel and wheel tilt controls -- should be
 -	 * in bytes 3 & 4 of the report.  Fix this if necessary.
 +	 * Several Microsoft mice report a bad position for the wheel
 +	 * and tilt controls -- depending on the size of the X- and Y-
 +	 * control it should either be in bytes 3&4 or 5&6. Fix this
 +	 * if necessary.
  	 */
  	if (uha->uaa->vendor =3D=3D USB_VENDOR_MICROSOFT &&
  	    (uha->uaa->product =3D=3D USB_PRODUCT_MICROSOFT_24GHZ_XCVR10 ||
 -	     uha->uaa->product =3D=3D USB_PRODUCT_MICROSOFT_24GHZ_XCVR20)) {=09
 +	     uha->uaa->product =3D=3D USB_PRODUCT_MICROSOFT_24GHZ_XCVR20 ||
 +	     uha->uaa->product =3D=3D 0x077d ||
 +	     uha->uaa->product =3D=3D 0x00e1)) {=09
  		if ((sc->flags & UMS_Z) && sc->sc_loc_z.pos =3D=3D 0)
 -			sc->sc_loc_z.pos =3D 24;
 +			sc->sc_loc_z.pos =3D sc->sc_loc_y.pos +
 +			    sc->sc_loc_y.size;
  		if ((sc->flags & UMS_W) && sc->sc_loc_w.pos =3D=3D 0)
  			sc->sc_loc_w.pos =3D sc->sc_loc_z.pos + 8;
  	}

From: Martijn van Buul <martijn.van.buul@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/44980
Date: Wed, 18 May 2011 08:33:33 +0200

 Urgh, why do I still trust webmail clients.

 Index: ums.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/usb/ums.c,v
 retrieving revision 1.81
 diff -u -r1.81 ums.c
 --- ums.c	3 Nov 2010 22:34:24 -0000	1.81
 +++ ums.c	18 May 2011 06:33:33 -0000
 @@ -282,15 +282,19 @@
  	}

  	/*
 -	 * The Microsoft Wireless Laser Mouse 6000 v2.0 reports a bad
 -	 * position for the wheel and wheel tilt controls -- should be
 -	 * in bytes 3 & 4 of the report.  Fix this if necessary.
 +	 * Several Microsoft mice report a bad position for the wheel
 +	 * and tilt controls -- depending on the size of the X- and Y-
 +	 * control it should either be in bytes 3&4 or 5&6. Fix this
 +	 * if necessary.
  	 */
  	if (uha->uaa->vendor == USB_VENDOR_MICROSOFT &&
  	    (uha->uaa->product == USB_PRODUCT_MICROSOFT_24GHZ_XCVR10 ||
 -	     uha->uaa->product == USB_PRODUCT_MICROSOFT_24GHZ_XCVR20)) {	
 +	     uha->uaa->product == USB_PRODUCT_MICROSOFT_24GHZ_XCVR20 ||
 +	     uha->uaa->product == 0x077d || 
 +	     uha->uaa->product == 0x00e1)) {	
  		if ((sc->flags & UMS_Z) && sc->sc_loc_z.pos == 0)
 -			sc->sc_loc_z.pos = 24;
 +			sc->sc_loc_z.pos = sc->sc_loc_y.pos + 
 +			    sc->sc_loc_y.size;
  		if ((sc->flags & UMS_W) && sc->sc_loc_w.pos == 0)
  			sc->sc_loc_w.pos = sc->sc_loc_z.pos + 8;
  	}

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.