diff options
author | Bastien Nocera <hadess@hadess.net> | 2010-04-16 12:19:50 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-04-19 07:11:43 -0400 |
commit | b5e5a37e36cd4d355b875665312d7aaae4e5833c (patch) | |
tree | 0c78a6367e115004ef5ebb237d3bc14d63e93d9d | |
parent | 75c28df87eb6d8e1389af67f26fbe2394e28385e (diff) |
HID: add HID_QUIRK_HIDDEV_FORCE and HID_QUIRK_NO_IGNORE
Add two quirks to make it possible for usbhid module options to
override whether a device is ignored (HID_QUIRK_NO_IGNORE) and
whether to connect a hiddev device (HID_QUIRK_HIDDEV_FORCE).
Passing HID_QUIRK_NO_IGNORE for your device means that it will
not be ignored by the HID layer, even if present in a blacklist.
HID_QUIRK_HIDDEV_FORCE will force the creation of a hiddev for that
device, making it accessible from user-space.
Tested with an Apple IR Receiver, switching it from using appleir
to using lirc's macmini driver.
Signed-off-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r-- | drivers/hid/hid-core.c | 4 | ||||
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 1 | ||||
-rw-r--r-- | include/linux/hid.h | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 8617aa97a9c8..468c6c2d4ad5 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1168,6 +1168,8 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask) | |||
1168 | unsigned int i; | 1168 | unsigned int i; |
1169 | int len; | 1169 | int len; |
1170 | 1170 | ||
1171 | if (hdev->quirks & HID_QUIRK_HIDDEV_FORCE) | ||
1172 | connect_mask |= (HID_CONNECT_HIDDEV_FORCE | HID_CONNECT_HIDDEV); | ||
1171 | if (hdev->bus != BUS_USB) | 1173 | if (hdev->bus != BUS_USB) |
1172 | connect_mask &= ~HID_CONNECT_HIDDEV; | 1174 | connect_mask &= ~HID_CONNECT_HIDDEV; |
1173 | if (hid_hiddev(hdev)) | 1175 | if (hid_hiddev(hdev)) |
@@ -1757,7 +1759,7 @@ int hid_add_device(struct hid_device *hdev) | |||
1757 | 1759 | ||
1758 | /* we need to kill them here, otherwise they will stay allocated to | 1760 | /* we need to kill them here, otherwise they will stay allocated to |
1759 | * wait for coming driver */ | 1761 | * wait for coming driver */ |
1760 | if (hid_ignore(hdev)) | 1762 | if (!(hdev->quirks & HID_QUIRK_NO_IGNORE) && hid_ignore(hdev)) |
1761 | return -ENODEV; | 1763 | return -ENODEV; |
1762 | 1764 | ||
1763 | /* XXX hack, any other cleaner solution after the driver core | 1765 | /* XXX hack, any other cleaner solution after the driver core |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 9cd61a52e9e3..245aef0de8f2 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -1143,6 +1143,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * | |||
1143 | hid->vendor = le16_to_cpu(dev->descriptor.idVendor); | 1143 | hid->vendor = le16_to_cpu(dev->descriptor.idVendor); |
1144 | hid->product = le16_to_cpu(dev->descriptor.idProduct); | 1144 | hid->product = le16_to_cpu(dev->descriptor.idProduct); |
1145 | hid->name[0] = 0; | 1145 | hid->name[0] = 0; |
1146 | hid->quirks = usbhid_lookup_quirk(hid->vendor, hid->product); | ||
1146 | if (intf->cur_altsetting->desc.bInterfaceProtocol == | 1147 | if (intf->cur_altsetting->desc.bInterfaceProtocol == |
1147 | USB_INTERFACE_PROTOCOL_MOUSE) | 1148 | USB_INTERFACE_PROTOCOL_MOUSE) |
1148 | hid->type = HID_TYPE_USBMOUSE; | 1149 | hid->type = HID_TYPE_USBMOUSE; |
diff --git a/include/linux/hid.h b/include/linux/hid.h index b1344ec4b7fc..f1f2b6f0d1c4 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -308,11 +308,13 @@ struct hid_item { | |||
308 | #define HID_QUIRK_NOTOUCH 0x00000002 | 308 | #define HID_QUIRK_NOTOUCH 0x00000002 |
309 | #define HID_QUIRK_IGNORE 0x00000004 | 309 | #define HID_QUIRK_IGNORE 0x00000004 |
310 | #define HID_QUIRK_NOGET 0x00000008 | 310 | #define HID_QUIRK_NOGET 0x00000008 |
311 | #define HID_QUIRK_HIDDEV_FORCE 0x00000010 | ||
311 | #define HID_QUIRK_BADPAD 0x00000020 | 312 | #define HID_QUIRK_BADPAD 0x00000020 |
312 | #define HID_QUIRK_MULTI_INPUT 0x00000040 | 313 | #define HID_QUIRK_MULTI_INPUT 0x00000040 |
313 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 | 314 | #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 |
314 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 | 315 | #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 |
315 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 | 316 | #define HID_QUIRK_NO_INIT_REPORTS 0x20000000 |
317 | #define HID_QUIRK_NO_IGNORE 0x40000000 | ||
316 | 318 | ||
317 | /* | 319 | /* |
318 | * This is the global environment of the parser. This information is | 320 | * This is the global environment of the parser. This information is |