From: Ondrej Zary <linux@rainbow-software.org>
To: Oliver Neukum <oliver@neukum.org>
Cc: linux-usb@vger.kernel.org, daniel.ritz@gmx.ch,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] [resend] usbtouchscreen: find input endpoint automatically
Date: Wed, 25 Nov 2009 23:15:27 +0100 [thread overview]
Message-ID: <200911252315.29395.linux@rainbow-software.org> (raw)
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>
--- 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
next reply other threads:[~2009-11-25 22:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 22:15 Ondrej Zary [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-11-30 12:06 [PATCH 2/3] [resend] usbtouchscreen: find input endpoint automatically Ondrej Zary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200911252315.29395.linux@rainbow-software.org \
--to=linux@rainbow-software.org \
--cc=daniel.ritz@gmx.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=oliver@neukum.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox