summaryrefslogtreecommitdiffstats
path: root/usbmuxd
diff options
context:
space:
mode:
Diffstat (limited to 'usbmuxd')
-rw-r--r--usbmuxd/usb-linux.c12
-rw-r--r--usbmuxd/usb.h1
2 files changed, 10 insertions, 3 deletions
diff --git a/usbmuxd/usb-linux.c b/usbmuxd/usb-linux.c
index 6e99a95..9634d14 100644
--- a/usbmuxd/usb-linux.c
+++ b/usbmuxd/usb-linux.c
@@ -279,11 +279,19 @@ static int usb_discover(void)
usbmuxd_log(LL_WARNING, "Could not open device %d-%d: %d", bus, address, res);
continue;
}
- if((res = libusb_set_configuration(handle, USB_CONFIGURATION)) != 0) {
- usbmuxd_log(LL_WARNING, "Could not set configuration %d for device %d-%d: %d", USB_CONFIGURATION, bus, address, res);
+ int current_config = 0;
+ if((res = libusb_get_configuration(handle, &current_config)) != 0) {
+ usbmuxd_log(LL_WARNING, "Could not get configuration for device %d-%d: %d", bus, address, res);
libusb_close(handle);
continue;
}
+ if (current_config != devdesc.bNumConfigurations) {
+ if((res = libusb_set_configuration(handle, devdesc.bNumConfigurations)) != 0) {
+ usbmuxd_log(LL_WARNING, "Could not set configuration %d for device %d-%d: %d", devdesc.bNumConfigurations, bus, address, res);
+ libusb_close(handle);
+ continue;
+ }
+ }
if((res = libusb_claim_interface(handle, USB_INTERFACE)) != 0) {
usbmuxd_log(LL_WARNING, "Could not claim interface %d for device %d-%d: %d", USB_INTERFACE, bus, address, res);
libusb_close(handle);
diff --git a/usbmuxd/usb.h b/usbmuxd/usb.h
index d13d9ba..621ccb2 100644
--- a/usbmuxd/usb.h
+++ b/usbmuxd/usb.h
@@ -48,7 +48,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define PID_ITOUCH2G 0x1293
#define PID_IPHONE3GS 0x1294
-#define USB_CONFIGURATION 3
#define USB_INTERFACE 1
struct usb_device;