diff options
author | Jiri Kosina <jkosina@suse.cz> | 2007-05-14 03:57:40 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2007-10-14 08:47:26 -0400 |
commit | 86166b7bcda0bcb53525114fa1c87ac432be478e (patch) | |
tree | 1f6afc4c1c1d7a6dd88236f3c11fde61c1885b14 /drivers/hid/usbhid | |
parent | efc493f9d5463d933a64a2758fbe6d9bb8300cbb (diff) |
HID: add hidraw interface
hidraw is an interface that is going to obsolete hiddev one
day.
Many userland applications are using libusb instead of using
kernel-provided hiddev interface. This is caused by various
reasons - the HID parser in kernel doesn't handle all the
HID hardware on the planet properly, some devices might require
its own specific quirks/drivers, etc.
hiddev interface tries to do its best to parse all the received
reports properly, and presents only parsed usages into userspace.
This is however often not enough, and that's the reason why
many userland applications just don't use hiddev at all, and
rather use libusb to read raw USB events and process them on
their own.
Another drawback of hiddev is that it is USB-specific.
hidraw interface provides userspace readers with really raw HID
reports, no matter what the low-level transport layer is (USB/BT),
and gives the userland applications all the freedom to process
the HID reports in a way they wish to.
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/usbhid')
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 74b817d7968d..3a9563195850 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/hid.h> | 32 | #include <linux/hid.h> |
33 | #include <linux/hiddev.h> | 33 | #include <linux/hiddev.h> |
34 | #include <linux/hid-debug.h> | 34 | #include <linux/hid-debug.h> |
35 | #include <linux/hidraw.h> | ||
35 | #include "usbhid.h" | 36 | #include "usbhid.h" |
36 | 37 | ||
37 | /* | 38 | /* |
@@ -932,6 +933,8 @@ static void hid_disconnect(struct usb_interface *intf) | |||
932 | hidinput_disconnect(hid); | 933 | hidinput_disconnect(hid); |
933 | if (hid->claimed & HID_CLAIMED_HIDDEV) | 934 | if (hid->claimed & HID_CLAIMED_HIDDEV) |
934 | hiddev_disconnect(hid); | 935 | hiddev_disconnect(hid); |
936 | if (hid->claimed & HID_CLAIMED_HIDRAW) | ||
937 | hidraw_disconnect(hid); | ||
935 | 938 | ||
936 | usb_free_urb(usbhid->urbin); | 939 | usb_free_urb(usbhid->urbin); |
937 | usb_free_urb(usbhid->urbctrl); | 940 | usb_free_urb(usbhid->urbctrl); |
@@ -964,11 +967,13 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
964 | hid->claimed |= HID_CLAIMED_INPUT; | 967 | hid->claimed |= HID_CLAIMED_INPUT; |
965 | if (!hiddev_connect(hid)) | 968 | if (!hiddev_connect(hid)) |
966 | hid->claimed |= HID_CLAIMED_HIDDEV; | 969 | hid->claimed |= HID_CLAIMED_HIDDEV; |
970 | if (!hidraw_connect(hid)) | ||
971 | hid->claimed |= HID_CLAIMED_HIDRAW; | ||
967 | 972 | ||
968 | usb_set_intfdata(intf, hid); | 973 | usb_set_intfdata(intf, hid); |
969 | 974 | ||
970 | if (!hid->claimed) { | 975 | if (!hid->claimed) { |
971 | printk ("HID device not claimed by input or hiddev\n"); | 976 | printk ("HID device claimed by neither input, hiddev nor hidraw\n"); |
972 | hid_disconnect(intf); | 977 | hid_disconnect(intf); |
973 | return -ENODEV; | 978 | return -ENODEV; |
974 | } | 979 | } |
@@ -984,10 +989,16 @@ static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
984 | 989 | ||
985 | if (hid->claimed & HID_CLAIMED_INPUT) | 990 | if (hid->claimed & HID_CLAIMED_INPUT) |
986 | printk("input"); | 991 | printk("input"); |
987 | if (hid->claimed == (HID_CLAIMED_INPUT | HID_CLAIMED_HIDDEV)) | 992 | if ((hid->claimed & HID_CLAIMED_INPUT) && ((hid->claimed & HID_CLAIMED_HIDDEV) || |
993 | hid->claimed & HID_CLAIMED_HIDRAW)) | ||
988 | printk(","); | 994 | printk(","); |
989 | if (hid->claimed & HID_CLAIMED_HIDDEV) | 995 | if (hid->claimed & HID_CLAIMED_HIDDEV) |
990 | printk("hiddev%d", hid->minor); | 996 | printk("hiddev%d", hid->minor); |
997 | if ((hid->claimed & HID_CLAIMED_INPUT) && (hid->claimed & HID_CLAIMED_HIDDEV) && | ||
998 | (hid->claimed & HID_CLAIMED_HIDRAW)) | ||
999 | printk(","); | ||
1000 | if (hid->claimed & HID_CLAIMED_HIDRAW) | ||
1001 | printk("hidraw%d", ((struct hidraw*)hid->hidraw)->minor); | ||
991 | 1002 | ||
992 | c = "Device"; | 1003 | c = "Device"; |
993 | for (i = 0; i < hid->maxcollection; i++) { | 1004 | for (i = 0; i < hid->maxcollection; i++) { |