diff options
author | Linus Walleij <triad@df.lth.se> | 2012-11-13 23:14:03 +0100 |
---|---|---|
committer | Linus Walleij <triad@df.lth.se> | 2012-11-13 23:14:03 +0100 |
commit | d76ae6e8ede659fd4bd13908798d3c5c86c1f1d4 (patch) | |
tree | 4a2a6a92345bb9a66c0b0a84caf5cef3464c4ca2 | |
parent | be4a1b25d1bf8df0f9ae15d7aa0a89d2877120cd (diff) | |
download | libmtp-d76ae6e8ede659fd4bd13908798d3c5c86c1f1d4.tar.gz |
Patch from Will Preston to fix setup of descriptor.
Signed-off-by: Linus Walleij <triad@df.lth.se>
-rw-r--r-- | src/libusb1-glue.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libusb1-glue.c b/src/libusb1-glue.c index f71ae8c..c038d19 100644 --- a/src/libusb1-glue.c +++ b/src/libusb1-glue.c @@ -1673,11 +1673,22 @@ static int init_ptp_usb(PTPParams* params, PTP_USB* ptp_usb, libusb_device* dev) * Check if the config is set to something else than what we want * to use. Only set the configuration if we absolutely have to. * Also do not bail out if we fail. + * + * Note that Darwin will not set the configuration for vendor-specific + * devices so we need to go in and set it. */ ret = libusb_get_active_config_descriptor(dev, &config); if (ret != LIBUSB_SUCCESS) { perror("libusb_get_active_config_descriptor(1) failed"); - return -1; + fprintf(stderr, "no active configuration, trying to set configuration\n"); + if (libusb_set_configuration(device_handle, ptp_usb->config) != LIBUSB_SUCCESS) { + perror("libusb_set_configuration() failed, continuing anyway..."); + } + ret = libusb_get_active_config_descriptor(dev, &config); + if (ret != LIBUSB_SUCCESS) { + perror("libusb_get_active_config_descriptor(2) failed"); + return -1; + } } if (config->bConfigurationValue != ptp_usb->config) { fprintf(stderr, "desired configuration different from current, trying to set configuration\n"); |