6.x fix for 90162 (was Re: usb/90162: [usb] [patch] Add support for
the MS Wireless USB Mouse)
Dorr H. Clark
dclark at engr.scu.edu
Mon Nov 20 18:01:38 UTC 2006
The following reply was made to PR usb/90162; it has been noted by GNATS.
From: "Dorr H. Clark" <dclark at engr.scu.edu>
To: bug-followup at FreeBSD.org, hm at FreeBSD.org
Cc:
Subject: 6.x fix for 90162 (was Re: usb/90162: [usb] [patch] Add support for
the MS Wireless USB Mouse)
Date: Mon, 20 Nov 2006 09:52:53 -0800
This change adds support for the Microsoft Wireless Notebook
Optical Mouse, which fixes 90162. The fix addresses the 3 problems
associated with this mouse: its misrepresentation as a uhid device,
invalid offsets for its buttons and x,y,z position coordinates,
and the phantom button click.
The first problem is resolved by bypassing hid_is_collection() and
reading the usb interface descriptor directly to detect a usb mouse.
The second problem is resolved by hard coding the offsets of the
mouse's buttons. The third problem is resolved by ignoring all
interrupts requests for that mouse with the first byte of ibuf
set to 0x14.
Cesar Philippidis
Hellmuth Michaelis
Engineers
Dorr H. Clark
Advisor
Graduate School of Engineering
Santa Clara University
(Note: This is a 6.x fix, we believe additional work is needed for a
backport to 5.x)
diff -uh usb.orig/ums.c usb/ums.c
--- usb.orig/ums.c Fri Nov 3 03:31:30 2006
+++ usb/ums.c Sun Nov 5 20:11:04 2006
@@ -188,8 +188,9 @@
if (err)
return (UMATCH_NONE);
- if (hid_is_collection(desc, size,
- HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE)))
+ if (id->bInterfaceClass == UICLASS_HID &&
+ id->bInterfaceSubClass == UISUBCLASS_BOOT &&
+ id->bInterfaceProtocol == UIPROTO_MOUSE)
ret = UMATCH_IFACECLASS;
else
ret = UMATCH_NONE;
@@ -320,6 +321,29 @@
USB_ATTACH_ERROR_RETURN;
}
+ /*
+ * The Microsoft Wireless Notebook Optical Mouse seems to be in
worse
+ * shape than the Wireless Intellimouse 2.0, as its X, Y, wheel,
and all
+ * of its other button positions are all off. It also reports
that it
+ * has two addional buttons and a tilt wheel.
+ */
+ if (uaa->vendor == USB_VENDOR_MICROSOFT &&
+ uaa->product == USB_PRODUCT_MICROSOFT_WLUSBMOUSE) {
+ sc->flags = UMS_Z;
+ sc->flags |= UMS_SPUR_BUT_UP;
+ sc->nbuttons = 3;
+ sc->sc_isize = 5;
+ sc->sc_iid = 0;
+
+ /* 1st byte of descriptor report contains garbage for this mouse */
+ sc->sc_loc_x.pos = 16;
+ sc->sc_loc_y.pos = 24;
+ sc->sc_loc_z.pos = 32;
+ sc->sc_loc_btn[0].pos = 8;
+ sc->sc_loc_btn[1].pos = 9;
+ sc->sc_loc_btn[2].pos = 10;
+ }
+
sc->sc_ep_addr = ed->bEndpointAddress;
sc->sc_disconnected = 0;
free(desc, M_TEMP);
@@ -457,12 +481,20 @@
* This should sort that.
* Currently it's the only user of UMS_T so use it as an
identifier.
* We probably should switch to some more official quirk.
+ *
+ * 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.
*/
if (sc->flags & UMS_T) {
if (sc->sc_iid) {
if (*ibuf++ == 0x02)
return;
}
+ } else if (sc->flags & UMS_SPUR_BUT_UP) {
+ DPRINTFN(5, ("ums_intr: #### ibuf[0] = %d ####\n", *ibuf));
+ if (*ibuf == 0x14)
+ return;
} else {
if (sc->sc_iid) {
if (*ibuf++ != sc->sc_iid)
diff -uh usb.orig/usb.h usb/usb.h
--- usb.orig/usb.h Fri Nov 3 03:31:30 2006
+++ usb/usb.h Thu Nov 2 16:33:52 2006
@@ -426,6 +426,7 @@
#define UICLASS_HID 0x03
#define UISUBCLASS_BOOT 1
#define UIPROTO_BOOT_KEYBOARD 1
+#define UIPROTO_MOUSE 2
#define UICLASS_PHYSICAL 0x05
diff -uh usb.orig/usbdevs usb/usbdevs
--- usb.orig/usbdevs Fri Nov 3 03:31:30 2006
+++ usb/usbdevs Fri Nov 3 03:45:25 2006
@@ -1182,6 +1182,7 @@
product MICROSOFT INTELLIEYE 0x0025 IntelliEye mouse
product MICROSOFT INETPRO2 0x002b Internet Keyboard Pro
product MICROSOFT MN110 0x007a 10/100 USB NIC
+product MICROSOFT WLUSBMOUSE 0x00b9 Wireless USB Mouse
/* Microtech products */
product MICROTECH SCSIDB25 0x0004 USB-SCSI-DB25
More information about the freebsd-usb
mailing list