Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[PATCH 2/3] usbtouchscreen: find input endpoint automatically

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


linux at rainbow-software

Nov 23, 2009, 2:04 AM

Post #1 of 1 (121 views)
Permalink
[PATCH 2/3] 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 [at] rainbow-software>

--- linux-source-2.6.31/drivers/input/touchscreen/usbtouchscreen.c.1 2009-11-23 10:30:14.000000000 +0100
+++ linux-source-2.6.31/drivers/input/touchscreen/usbtouchscreen.c 2009-11-23 10:57:14.000000000 +0100
@@ -882,17 +882,25 @@ static int usbtouch_probe(struct usb_int
struct usbtouch_usb *usbtouch;
struct input_dev *input_dev;
struct usb_host_interface *interface;
- struct usb_endpoint_descriptor *endpoint;
+ struct usb_endpoint_descriptor *endpoint = NULL;
struct usb_device *udev = interface_to_usbdev(intf);
struct usbtouch_device_info *type;
int err = -ENOMEM;
+ int i;

/* some devices are ignored */
if (id->driver_info == DEVTYPE_IGNORE)
return -ENODEV;

interface = intf->cur_altsetting;
- endpoint = &interface->endpoint[0].desc;
+ /* find first input endpoint */
+ for (i = 0; i < interface->desc.bNumEndpoints; i++)
+ if (usb_endpoint_dir_in(&interface->endpoint[i].desc)) {
+ endpoint = &interface->endpoint[i].desc;
+ break;
+ }
+ if (!endpoint)
+ return -ENXIO;

usbtouch = kzalloc(sizeof(struct usbtouch_usb), GFP_KERNEL);
input_dev = input_allocate_device();


--
Ondrej Zary
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.