]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] usbhid: automatically set HID_QUIRK_NOGET for keyboards and mice
authorAlan Stern <stern@rowland.harvard.edu>
Mon, 15 May 2006 18:49:04 +0000 (14:49 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 21 Jun 2006 22:04:10 +0000 (15:04 -0700)
It seems to be relatively common for USB keyboards and mice to dislike
being polled for reports.  Since there's no need to poll a keyboard or
a mouse, this patch (as685) automatically sets the HID_QUIRK_NOGET flag
for devices that advertise themselves as either sort of device with boot
protocol support.

This won't cure all the problems since some devices don't support the
boot protocol, but it's simple and easy and it should fix quite a few
problems.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/input/hid-core.c
drivers/usb/input/hid.h

index bb1f5211ff9d0608102520b9f6bb9f317aab77b8..061002fc66fcd7f37d1f657de52f36a7e862fb3e 100644 (file)
@@ -1797,6 +1797,14 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
                        (hid_blacklist[n].idProduct == le16_to_cpu(dev->descriptor.idProduct)))
                                quirks = hid_blacklist[n].quirks;
 
+       /* Many keyboards and mice don't like to be polled for reports,
+        * so we will always set the HID_QUIRK_NOGET flag for them. */
+       if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT) {
+               if (interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_KEYBOARD ||
+                       interface->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE)
+                               quirks |= HID_QUIRK_NOGET;
+       }
+
        if (quirks & HID_QUIRK_IGNORE)
                return NULL;
 
index 7efbfff8adde1b28f5594d104c27774d3be3a871..778e575de35230831bebbfaa983a555f3754b40b 100644 (file)
 
 #define USB_INTERFACE_CLASS_HID                3
 
+/*
+ * USB HID interface subclass and protocol codes
+ */
+
+#define USB_INTERFACE_SUBCLASS_BOOT    1
+#define USB_INTERFACE_PROTOCOL_KEYBOARD        1
+#define USB_INTERFACE_PROTOCOL_MOUSE   2
+
 /*
  * HID class requests
  */