]>
Commit | Line | Data |
---|---|---|
1 | From 128f757596a32ae23fe61711883f6210e1d90bd0 Mon Sep 17 00:00:00 2001 | |
2 | From: Mike Frysinger <vapier@gentoo.org> | |
3 | Date: Thu, 24 Apr 2008 02:00:15 -0400 | |
4 | Subject: [PATCH] call usb_set_configuration() before usb_claim_interface() | |
5 | ||
6 | --- | |
7 | src/ftdi.c | 10 ++++++++++ | |
8 | 1 files changed, 10 insertions(+), 0 deletions(-) | |
9 | ||
10 | diff --git a/src/ftdi.c b/src/ftdi.c | |
11 | index 043d24a..56fea0c 100644 | |
12 | --- a/src/ftdi.c | |
13 | +++ b/src/ftdi.c | |
14 | @@ -341,6 +341,7 @@ int ftdi_usb_get_strings(struct ftdi_context * ftdi, struct usb_device * dev, | |
15 | \param dev libusb usb_dev to use | |
16 | ||
17 | \retval 0: all fine | |
18 | + \retval -3: unable to config device | |
19 | \retval -4: unable to open device | |
20 | \retval -5: unable to claim device | |
21 | \retval -6: reset failed | |
22 | @@ -359,6 +360,15 @@ int ftdi_usb_open_dev(struct ftdi_context *ftdi, struct usb_device *dev) | |
23 | detach_errno = errno; | |
24 | #endif | |
25 | ||
26 | + if (usb_set_configuration(ftdi->usb_dev, dev->config[0].bConfigurationValue)) { | |
27 | + usb_close (ftdi->usb_dev); | |
28 | + if (detach_errno == EPERM) { | |
29 | + ftdi_error_return(-8, "inappropriate permissions on device!"); | |
30 | + } else { | |
31 | + ftdi_error_return(-3, "unable to set usb configuration. Make sure ftdi_sio is unloaded!"); | |
32 | + } | |
33 | + } | |
34 | + | |
35 | if (usb_claim_interface(ftdi->usb_dev, ftdi->interface) != 0) { | |
36 | usb_close (ftdi->usb_dev); | |
37 | if (detach_errno == EPERM) { | |
38 | -- | |
39 | 1.5.5 | |
40 |