static int parse_configuration(struct libusb_context *ctx,
struct libusb_config_descriptor *config, unsigned char *buffer,
- int host_endian)
+ int size, int host_endian)
{
int i;
int r;
- int size;
size_t tmp;
struct usb_descriptor_header header;
struct libusb_interface *usb_interface;
usbi_parse_descriptor(buffer, "bbwbbbbb", config, host_endian);
- size = config->wTotalLength;
if (config->bNumInterfaces > USB_MAXINTERFACES) {
usbi_err(ctx, "too many interfaces (%d)", config->bNumInterfaces);
if (r < 0)
goto err;
- r = parse_configuration(dev->ctx, _config, buf, host_endian);
+ r = parse_configuration(dev->ctx, _config, buf, r, host_endian);
if (r < 0) {
usbi_err(dev->ctx, "parse_configuration failed with error %d", r);
goto err;
if (r < 0)
goto err;
- r = parse_configuration(dev->ctx, _config, buf, host_endian);
+ r = parse_configuration(dev->ctx, _config, buf, r, host_endian);
if (r < 0) {
usbi_err(dev->ctx, "parse_configuration failed with error %d", r);
goto err;
struct darwin_device_priv *priv = (struct darwin_device_priv *)dev->os_priv;
IOUSBConfigurationDescriptorPtr desc;
IOReturn kresult;
+ int ret;
if (!priv || !priv->device)
return LIBUSB_ERROR_OTHER;
*host_endian = 0;
}
- return darwin_to_libusb (kresult);
+ ret = darwin_to_libusb (kresult);
+ if (ret != LIBUSB_SUCCESS)
+ return ret;
+
+ return len;
}
/* check whether the os has configured the device */