Skip site navigation (1)Skip section navigation (2)
Date:      Fri,  9 Nov 2007 09:59:38 +0200 (EET)
From:      Nikos Ntarmos <ntarmos@ceid.upatras.gr>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   usb/117938: [Patch] Adding support for MS WL Natural and MS WL Optical (1008) mice
Message-ID:  <20071109075938.32B4D3F410@ace.netcins.ceid.upatras.gr>
Resent-Message-ID: <200711091130.lA9BU1Cf012391@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         117938
>Category:       usb
>Synopsis:       [Patch] Adding support for MS WL Natural and MS WL Optical (1008) mice
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 09 11:30:00 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Nikos Ntarmos
>Release:        FreeBSD 7.0-BETA1 i386
>Organization:
NetCInS Lab., C.E.I.D., U. of Patras, Greece
>Environment:
System: FreeBSD ace.netcins.ceid.upatras.gr 7.0-BETA1 FreeBSD 7.0-BETA1 #2: Wed Oct 31 23:48:50 EET 2007 ntarmos@ace.netcins.ceid.upatras.gr:/opt/src/sys/i386/compile/ACE i386


	
>Description:
Some of the newer MS keyboard/mouse bundles act in even more mysterious
ways than their predecessors; they connect to the system via a composite
usb device and although both devices register as HID-class devices, the
keyboard presents a KEYBOARD protocol but the corresponding mouse has
its protocol and subclass fields zeroed-out. Due to this oddity, ukbd
succesfully attaches to the keyboard port but the mouse is claimed by
uhid and is therefore rendered unusable. This holds for (at least) the
MS Natural Desktop Pro and the MS Optical Desktop (v1008) bundles.
>How-To-Repeat:
Plug in any of teh two above bundles. The keyboard is succesfully
claimed by ukbd but you only get a uhid device for the mouse.
	
>Fix:

	

--- more-ms-mice.patch begins here ---
Index: ums.c
===================================================================
RCS file: /opt/freebsd/cvs/src/sys/dev/usb/ums.c,v
retrieving revision 1.96
diff -u -r1.96 ums.c
--- ums.c	25 Jul 2007 06:43:06 -0000	1.96
+++ ums.c	9 Nov 2007 07:50:12 -0000
@@ -197,9 +197,19 @@
 	if (err)
 		return (UMATCH_NONE);
 
+	/**
+	 * Some of the newer Microsoft keyborad-mouse bundles use a composite USB
+	 * approach, where both devices have an interface class of HID, but then
+	 * only the keyboard presents a KEYBOARD protocol, while the mouse has the
+	 * coresponding fields zeroed-out. AFAIK all such devices need the
+	 * UQ_MS_BAD_CLASS quirk to function correctly, while that quirk is solely
+	 * in use by mice, so I'm using it to identify such devices and have ums
+	 * attach to them.
+	 */
 	if (id->bInterfaceClass == UICLASS_HID &&
-	    id->bInterfaceSubClass == UISUBCLASS_BOOT &&
-	    id->bInterfaceProtocol == UIPROTO_MOUSE)
+			((id->bInterfaceSubClass == UISUBCLASS_BOOT &&
+			  id->bInterfaceProtocol == UIPROTO_MOUSE) ||
+			 usbd_get_quirks(uaa->device)->uq_flags & UQ_MS_BAD_CLASS))
 		ret = UMATCH_IFACECLASS;
 	else
 		ret = UMATCH_NONE;
@@ -487,6 +497,12 @@
 	 * UPDATE: This problem affects the M$ Wireless Notebook Optical Mouse,
 	 * too. However, the leading byte for this mouse is normally 0x11,
 	 * and the phantom mouse click occurs when its 0x14.
+	 *
+	 * UPDATE: This problem also affects the MS Wireless Optical Mouse
+	 * (Model 1008) and MS Wireless Natural Mouse 4000, only that the bogus
+	 * byte alternates between 0x11 (normal mode) and 0x05. For these mice the
+	 * bogus byte translates to an x-axis movement as oppose to a phantom
+	 * click as above.
 	 */
 	if (sc->flags & UMS_T) {
 		if (sc->sc_iid) {
@@ -495,7 +511,7 @@
 		}
 	} else if (sc->flags & UMS_SPUR_BUT_UP) {
 		DPRINTFN(5, ("ums_intr: #### ibuf[0] =3D %d ####\n", *ibuf));
-		if (*ibuf == 0x14 || *ibuf == 0x15)
+		if (*ibuf == 0x05 || *ibuf == 0x14 || *ibuf == 0x15)
 			return;
 	} else {
 		if (sc->sc_iid) {
Index: usb_quirks.c
===================================================================
RCS file: /opt/freebsd/cvs/src/sys/dev/usb/usb_quirks.c,v
retrieving revision 1.63
diff -u -r1.63 usb_quirks.c
--- usb_quirks.c	22 Jul 2007 15:59:45 -0000	1.63
+++ usb_quirks.c	8 Nov 2007 15:56:33 -0000
@@ -84,6 +84,10 @@
  { USB_VENDOR_HP, USB_PRODUCT_HP_1220C,		    ANY,   { UQ_BROKEN_BIDIR }},
  { USB_VENDOR_XEROX, USB_PRODUCT_XEROX_WCM15,	    ANY,   { UQ_BROKEN_BIDIR }},
  /* MS keyboards do weird things */
+ { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLNATMOUSE,
+   ANY, { UQ_MS_BAD_CLASS | UQ_MS_LEADING_BYTE }},
+ { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLOPTMOUSE,
+   ANY, { UQ_MS_BAD_CLASS | UQ_MS_LEADING_BYTE }},
  { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLNOTEBOOK,
    ANY, { UQ_MS_BAD_CLASS | UQ_MS_LEADING_BYTE }},
  { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLNOTEBOOK2,
Index: usbdevs
===================================================================
RCS file: /opt/freebsd/cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.328
diff -u -r1.328 usbdevs
--- usbdevs	5 Oct 2007 07:26:39 -0000	1.328
+++ usbdevs	8 Nov 2007 15:57:15 -0000
@@ -1637,6 +1637,8 @@
 product MICROSOFT MN510		0x006e	MN510 Wireless
 product MICROSOFT MN110		0x007a	10/100 USB NIC
 product MICROSOFT WLINTELLIMOUSE 0x008c	Wireless Optical IntelliMouse
+product MICROSOFT WLNATMOUSE	0x071d	Wireless Natural Mouse 4000
+product MICROSOFT WLOPTMOUSE	0x00f9	Wireless Optical Mouse (Model 1008)
 product MICROSOFT WLNOTEBOOK	0x00b9	Wireless Optical Mouse (Model 1023)
 product MICROSOFT WLNOTEBOOK2	0x00e1	Wireless Optical Mouse 3000 (Model 1056)
 product MICROSOFT WLUSBMOUSE	0x00b9	Wireless USB Mouse
--- more-ms-mice.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071109075938.32B4D3F410>