[PATCH] usbhid quirks for macbook(pro) (was: Re: Fwd: Re:[linux-usb-devel] usb initialization order (usbhid vs. appletouch))

From: Soeren Sonnenburg
Date: Sat Dec 09 2006 - 01:56:31 EST


On Mon, 2006-10-30 at 05:12 -0500, Joseph Fannin wrote:
> On Sat, Oct 28, 2006 at 10:27:46PM +0200, Soeren Sonnenburg wrote:
> > On Sat, 2006-10-28 at 20:55 +0200, Oliver Neukum wrote:
> > > > From: Sergey Vlasov <vsu@xxxxxxxxxxx>
> > > > Subject: usbhid: Add HID_QUIRK_IGNORE_MOUSE flag
> > > >
> > > > Some HID devices by Apple have both keyboard and mouse interfaces; the
> > > > keyboard interface is handled by usbhid, but the mouse (really
> > > > touchpad) interface must be handled by the separate 'appletouch'
> > > > driver. Using HID_QUIRK_IGNORE will make hiddev ignore both
> > > > interfaces, therefore a new quirk flag to ignore only the mouse
> > > > interface is required.
>
> The appletouch driver doesn't work properly on the MacBook
> (non-Pro). It claims the device, and sort of functions, but is
> basically unusable.
>
> If this goes in, and blacklists the MacBook touchpad too, Macbook
> users will be unhappy. I think the MacBook and the -Pro use the same
> IDs, though, which makes a problem for this patch until appletouch is
> fixed on MacBooks.

ok, this patch was now in the mactel svn repository since about a month
and I've never ever seen a report about it failing. Also I asked on the
mailinglist for anyone having problems with that and got no answer,
execpt Joseph, the problem you have been seeing might have been that
one:

http://www.mail-archive.com/mactel-linux-devel@xxxxxxxxxxxxxxxxxxxxx/msg00129.html

I would therefore hope it can be applied and thus appear in .20. I am
attaching the version that is now in mactel-svn (which also includes
geyser4 support).

Soeren
--
Sometimes, there's a moment as you're waking, when you become aware of
the real world around you, but you're still dreaming.
diff -uNr linux-2.6.19/drivers/usb/input/hid-core.c linux-2.6.19-mactel/drivers/usb/input/hid-core.c
--- linux-2.6.19/drivers/usb/input/hid-core.c 2006-11-29 22:57:37.000000000 +0100
+++ linux-2.6.19-mactel/drivers/usb/input/hid-core.c 2006-11-30 09:20:49.000000000 +0100
@@ -1627,6 +1627,16 @@

#define USB_VENDOR_ID_APPLE 0x05ac
#define USB_DEVICE_ID_APPLE_MIGHTYMOUSE 0x0304
+#define USB_DEVICE_ID_APPLE_GEYSER_ANSI 0x0214
+#define USB_DEVICE_ID_APPLE_GEYSER_ISO 0x0215
+#define USB_DEVICE_ID_APPLE_GEYSER_JIS 0x0216
+#define USB_DEVICE_ID_APPLE_GEYSER3_ANSI 0x0217
+#define USB_DEVICE_ID_APPLE_GEYSER3_ISO 0x0218
+#define USB_DEVICE_ID_APPLE_GEYSER3_JIS 0x0219
+#define USB_DEVICE_ID_APPLE_GEYSER4_ANSI 0x021A
+#define USB_DEVICE_ID_APPLE_GEYSER4_ISO 0x021B
+#define USB_DEVICE_ID_APPLE_GEYSER4_JIS 0x021C
+#define USB_DEVICE_ID_APPLE_IR 0x8240

#define USB_VENDOR_ID_CHERRY 0x046a
#define USB_DEVICE_ID_CHERRY_CYMOTION 0x0023
@@ -1794,17 +1804,21 @@

{ USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION, HID_QUIRK_CYMOTION },

- { USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN },
- { USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN },
- { USB_VENDOR_ID_APPLE, 0x0214, HID_QUIRK_POWERBOOK_HAS_FN },
- { USB_VENDOR_ID_APPLE, 0x0215, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
- { USB_VENDOR_ID_APPLE, 0x0216, HID_QUIRK_POWERBOOK_HAS_FN },
- { USB_VENDOR_ID_APPLE, 0x0217, HID_QUIRK_POWERBOOK_HAS_FN },
- { USB_VENDOR_ID_APPLE, 0x0218, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
- { USB_VENDOR_ID_APPLE, 0x0219, HID_QUIRK_POWERBOOK_HAS_FN },
- { USB_VENDOR_ID_APPLE, 0x021B, HID_QUIRK_POWERBOOK_HAS_FN },
- { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN },
- { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN },
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, 0x020E, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, 0x020F, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, 0x030A, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+ { USB_VENDOR_ID_APPLE, 0x030B, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE},
+
+ { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE },

{ USB_VENDOR_ID_PANJIT, 0x0001, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_PANJIT, 0x0002, HID_QUIRK_IGNORE },
@@ -1903,6 +1917,10 @@
if (quirks & HID_QUIRK_IGNORE)
return NULL;

+ if ((quirks & HID_QUIRK_IGNORE_MOUSE) &&
+ (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE))
+ return NULL;
+
if (usb_get_extra_descriptor(interface, HID_DT_HID, &hdesc) &&
(!interface->desc.bNumEndpoints ||
usb_get_extra_descriptor(&interface->endpoint[0], HID_DT_HID, &hdesc))) {
diff -uNr linux-2.6.19/drivers/usb/input/hid.h linux-2.6.19-mactel/drivers/usb/input/hid.h
--- linux-2.6.19/drivers/usb/input/hid.h 2006-11-29 22:57:37.000000000 +0100
+++ linux-2.6.19-mactel/drivers/usb/input/hid.h 2006-11-30 09:21:18.000000000 +0100
@@ -261,6 +261,7 @@
#define HID_QUIRK_POWERBOOK_FN_ON 0x00002000
#define HID_QUIRK_INVERT_HWHEEL 0x00004000
#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD 0x00008000
+#define HID_QUIRK_IGNORE_MOUSE 0x00010000

/*
* This is the global environment of the parser. This information is