diff options
author | Ondrej Zary <linux@rainbow-software.org> | 2010-02-04 02:54:59 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-02-04 03:21:52 -0500 |
commit | f4a5e359c4bafc2269766ccd74256024160ed7ac (patch) | |
tree | 7d91348c8877c38f78be465faf34a72edfa26292 /drivers/input/touchscreen/usbtouchscreen.c | |
parent | fea4d14b69567e134e1838155a5dc857ebca70cb (diff) |
Input: usbtouchscreen - find input endpoint automatically
Find input enpoint automatically instead of assuming that the first one is
OK. This is needed for devices with multiple endpoints such as iNexio
where the first endpoint might be output.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen/usbtouchscreen.c')
-rw-r--r-- | drivers/input/touchscreen/usbtouchscreen.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c index 69be77118884..a2a82351a42f 100644 --- a/drivers/input/touchscreen/usbtouchscreen.c +++ b/drivers/input/touchscreen/usbtouchscreen.c | |||
@@ -1050,13 +1050,23 @@ static void usbtouch_free_buffers(struct usb_device *udev, | |||
1050 | kfree(usbtouch->buffer); | 1050 | kfree(usbtouch->buffer); |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | static struct usb_endpoint_descriptor * | ||
1054 | usbtouch_get_input_endpoint(struct usb_host_interface *interface) | ||
1055 | { | ||
1056 | int i; | ||
1057 | |||
1058 | for (i = 0; i < interface->desc.bNumEndpoints; i++) | ||
1059 | if (usb_endpoint_dir_in(&interface->endpoint[i].desc)) | ||
1060 | return &interface->endpoint[i].desc; | ||
1061 | |||
1062 | return NULL; | ||
1063 | } | ||
1053 | 1064 | ||
1054 | static int usbtouch_probe(struct usb_interface *intf, | 1065 | static int usbtouch_probe(struct usb_interface *intf, |
1055 | const struct usb_device_id *id) | 1066 | const struct usb_device_id *id) |
1056 | { | 1067 | { |
1057 | struct usbtouch_usb *usbtouch; | 1068 | struct usbtouch_usb *usbtouch; |
1058 | struct input_dev *input_dev; | 1069 | struct input_dev *input_dev; |
1059 | struct usb_host_interface *interface; | ||
1060 | struct usb_endpoint_descriptor *endpoint; | 1070 | struct usb_endpoint_descriptor *endpoint; |
1061 | struct usb_device *udev = interface_to_usbdev(intf); | 1071 | struct usb_device *udev = interface_to_usbdev(intf); |
1062 | struct usbtouch_device_info *type; | 1072 | struct usbtouch_device_info *type; |
@@ -1066,8 +1076,9 @@ static int usbtouch_probe(struct usb_interface *intf, | |||
1066 | if (id->driver_info == DEVTYPE_IGNORE) | 1076 | if (id->driver_info == DEVTYPE_IGNORE) |
1067 | return -ENODEV; | 1077 | return -ENODEV; |
1068 | 1078 | ||
1069 | interface = intf->cur_altsetting; | 1079 | endpoint = usbtouch_get_input_endpoint(intf->cur_altsetting); |
1070 | endpoint = &interface->endpoint[0].desc; | 1080 | if (!endpoint) |
1081 | return -ENXIO; | ||
1071 | 1082 | ||
1072 | usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); | 1083 | usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL); |
1073 | input_dev = input_allocate_device(); | 1084 | input_dev = input_allocate_device(); |