Skip to content

Commit

Permalink
darwin: ignore root hub simulation devices
Browse files Browse the repository at this point in the history
This commit fixes #108. In the 10.11.0 release it can take up to 1
second to query the configuration of one of Apple's root hub
simulation devices. Since the devices are not usable anyway go ahead
and mark them as unconfigured.

Signed-off-by: Nathan Hjelm <hjelmn@me.com>
  • Loading branch information
hjelmn committed Oct 9, 2015
1 parent 960a6e7 commit 5e45e07
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion libusb/os/darwin_usb.c
Expand Up @@ -570,6 +570,14 @@ static int darwin_check_configuration (struct libusb_context *ctx, struct darwin
return LIBUSB_ERROR_OTHER; /* no configurations at this speed so we can't use it */
}

/* checking the configuration of a root hub simulation takes ~1 s in 10.11. the device is
not usable anyway */
if (0x05ac == dev->dev_descriptor.idVendor && 0x8005 == dev->dev_descriptor.idProduct) {
usbi_dbg ("ignoring configuration on root hub simulation");
dev->active_config = 0;
return 0;
}

/* find the first configuration */
kresult = (*darwin_device)->GetConfigurationDescriptorPtr (darwin_device, 0, &configDesc);
dev->first_config = (kIOReturnSuccess == kresult) ? configDesc->bConfigurationValue : 1;
Expand Down Expand Up @@ -1275,7 +1283,7 @@ static int darwin_release_interface(struct libusb_device_handle *dev_handle, int
if (kresult != kIOReturnSuccess)
usbi_warn (HANDLE_CTX (dev_handle), "Release: %s", darwin_error_str(kresult));

cInterface->interface = IO_OBJECT_NULL;
cInterface->interface = (usb_interface_t **) IO_OBJECT_NULL;

return darwin_to_libusb (kresult);
}
Expand Down
2 changes: 1 addition & 1 deletion libusb/version_nano.h
@@ -1 +1 @@
#define LIBUSB_NANO 11013
#define LIBUSB_NANO 11014

0 comments on commit 5e45e07

Please sign in to comment.