diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2008-11-14 06:03:47 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2008-11-14 08:10:01 -0500 |
commit | 131d3a7a009d56a96cc7117b4e9d0c90c2e2a1dc (patch) | |
tree | 9427510362e77d167d2646a7e5e25438dc0e2d23 /drivers/hid | |
parent | 62a56582e01b1c5139b235004548e233201df9aa (diff) |
HID: don't grab devices with no input
Some devices have no input interrupt endpoint. These won't be handled
by usbhid, but currently they are not refused and reside on hid bus.
Perform this checking earlier so that we refuse to control such
a device early enough (and not pass it to the hid bus at all).
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/usbhid/hid-core.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index f0339aefc798..d746bf8284dd 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -849,12 +849,6 @@ static int usbhid_start(struct hid_device *hid) | |||
849 | } | 849 | } |
850 | } | 850 | } |
851 | 851 | ||
852 | if (!usbhid->urbin) { | ||
853 | err_hid("couldn't find an input interrupt endpoint"); | ||
854 | ret = -ENODEV; | ||
855 | goto fail; | ||
856 | } | ||
857 | |||
858 | init_waitqueue_head(&usbhid->wait); | 852 | init_waitqueue_head(&usbhid->wait); |
859 | INIT_WORK(&usbhid->reset_work, hid_reset); | 853 | INIT_WORK(&usbhid->reset_work, hid_reset); |
860 | setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid); | 854 | setup_timer(&usbhid->io_retry, hid_retry_timeout, (unsigned long) hid); |
@@ -948,15 +942,26 @@ static struct hid_ll_driver usb_hid_driver = { | |||
948 | 942 | ||
949 | static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) | 943 | static int hid_probe(struct usb_interface *intf, const struct usb_device_id *id) |
950 | { | 944 | { |
945 | struct usb_host_interface *interface = intf->cur_altsetting; | ||
951 | struct usb_device *dev = interface_to_usbdev(intf); | 946 | struct usb_device *dev = interface_to_usbdev(intf); |
952 | struct usbhid_device *usbhid; | 947 | struct usbhid_device *usbhid; |
953 | struct hid_device *hid; | 948 | struct hid_device *hid; |
949 | unsigned int n, has_in = 0; | ||
954 | size_t len; | 950 | size_t len; |
955 | int ret; | 951 | int ret; |
956 | 952 | ||
957 | dbg_hid("HID probe called for ifnum %d\n", | 953 | dbg_hid("HID probe called for ifnum %d\n", |
958 | intf->altsetting->desc.bInterfaceNumber); | 954 | intf->altsetting->desc.bInterfaceNumber); |
959 | 955 | ||
956 | for (n = 0; n < interface->desc.bNumEndpoints; n++) | ||
957 | if (usb_endpoint_is_int_in(&interface->endpoint[n].desc)) | ||
958 | has_in++; | ||
959 | if (!has_in) { | ||
960 | dev_err(&intf->dev, "couldn't find an input interrupt " | ||
961 | "endpoint\n"); | ||
962 | return -ENODEV; | ||
963 | } | ||
964 | |||
960 | hid = hid_allocate_device(); | 965 | hid = hid_allocate_device(); |
961 | if (IS_ERR(hid)) | 966 | if (IS_ERR(hid)) |
962 | return PTR_ERR(hid); | 967 | return PTR_ERR(hid); |