[PATCH] HID: check for HID_QUIRK_IGNORE during probing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While the hardcoded ignore list is checked in usbhid_probe(), the
user supplied ignore flags are not. Thus, the IGNORE quirk (0x0004)
cannot be used to stop usbhid from binding devices like iBuddy, which
has been recently removed from the ignore list due to product ID
conflict.

This patch adds the user quirk check to usb_probe(), and makes
usb_probe() return -ENODEV when HID_QUIRK_IGNORE bit is set.

With the patch, iBuddy works properly using libusb when the following
option is added to modprobe.d:

options usbhid quirks=0x1130:0x0002:0x0004

Signed-off-by: Jindrich Makovicka <makovick@xxxxxxxxx>

-- 
Jindrich Makovicka
--- hid-core.c.orig	2010-05-16 23:17:36.000000000 +0200
+++ hid-core.c	2010-05-23 20:23:28.471259245 +0200
@@ -864,8 +864,7 @@ static int usbhid_parse(struct hid_devic
 	quirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor),
 			le16_to_cpu(dev->descriptor.idProduct));
 
-	if (quirks & HID_QUIRK_IGNORE)
-		return -ENODEV;
+	WARN_ON(quirks & HID_QUIRK_IGNORE);
 
 	/* Many keyboards and mice don't like to be polled for reports,
 	 * so we will always set the HID_QUIRK_NOGET flag for them. */
@@ -1098,6 +1097,7 @@ static int usbhid_probe(struct usb_inter
 	struct usb_device *dev = interface_to_usbdev(intf);
 	struct usbhid_device *usbhid;
 	struct hid_device *hid;
+	u32 quirks = 0;
 	unsigned int n, has_in = 0;
 	size_t len;
 	int ret;
@@ -1114,6 +1114,12 @@ static int usbhid_probe(struct usb_inter
 		return -ENODEV;
 	}
 
+	quirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor),
+			le16_to_cpu(dev->descriptor.idProduct));
+
+	if (quirks & HID_QUIRK_IGNORE)
+		return -ENODEV;
+
 	hid = hid_allocate_device();
 	if (IS_ERR(hid))
 		return PTR_ERR(hid);

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux