linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: check for HID_QUIRK_IGNORE during probing
@ 2010-05-23 18:47 Jindrich Makovicka
  2010-05-25 20:53 ` Jindrich Makovicka
  0 siblings, 1 reply; 5+ messages in thread
From: Jindrich Makovicka @ 2010-05-23 18:47 UTC (permalink / raw)
  To: linux-input

[-- Attachment #1: Type: text/plain, Size: 630 bytes --]

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@gmail.com>

-- 
Jindrich Makovicka

[-- Attachment #2: hid-core.c.diff --]
[-- Type: text/x-patch, Size: 1090 bytes --]

--- 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);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-05-31  8:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-23 18:47 [PATCH] HID: check for HID_QUIRK_IGNORE during probing Jindrich Makovicka
2010-05-25 20:53 ` Jindrich Makovicka
2010-05-25 22:41   ` Bastien Nocera
2010-05-26  6:24     ` Jindrich Makovicka
2010-05-31  8:01       ` Jindrich Makovicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).