Apple's Mighty Mouse (patch)

From: Rui Paulo <rpaulo_at_fnop.net>
Date: Thu, 15 Mar 2007 01:57:35 +0000
Hi,

The attached patch makes the wheel work correctly with in Apple's Mighty 
Mouse.

Any comments?

-- 
Rui Paulo | PGP: F0E4 C7C7 1653 79B7 78DC  DD73 64FA B2C6 CF45 1F84

Index: ums.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/ums.c,v
retrieving revision 1.83
diff -u -r1.83 ums.c
--- ums.c	17 Jan 2007 03:50:45 -0000	1.83
+++ ums.c	15 Mar 2007 01:51:29 -0000
_at__at_ -266,8 +266,16 _at__at_
 		USB_ATTACH_ERROR_RETURN;
 	}
 
+	/* Apple's Mighty Mouse reports HUG_Z as horizontal scrolling and
+	   HUG_WHEEL as vertical scrolling. */
+	if (uaa->vendor == USB_VENDOR_APPLE &&
+	    uaa->product == USB_PRODUCT_APPLE_OPTICALM) {
+		hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP,
+			HUG_WHEEL), hid_input, &sc->sc_loc_z, &flags);
+		printf("mighty mouse\n");
+	}
 	/* try to guess the Z activator: first check Z, then WHEEL */
-	if (hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Z),
+	else if (hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Z),
 		       hid_input, &sc->sc_loc_z, &flags) ||
 	    hid_locate(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL),
 		       hid_input, &sc->sc_loc_z, &flags) ||
Index: usbdevs
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.288
diff -u -r1.288 usbdevs
--- usbdevs	27 Feb 2007 22:27:53 -0000	1.288
+++ usbdevs	15 Mar 2007 01:51:30 -0000
_at__at_ -688,6 +688,7 _at__at_
 product APPLE IPOD_08		0x1208	iPod '08'
 product APPLE IPODVIDEO		0x1209	iPod Video
 product APPLE IPODNANO		0x120a	iPod Nano
+product APPLE OPTICALM		0x0304	Apple Optical USB Mouse
 
 /* Arkmicro Technologies */
 product ARKMICRO ARK3116	0x0232	ARK3116 Serial
Received on Thu Mar 15 2007 - 00:57:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:06 UTC