else
usbi_warn (ctx, "could not retrieve device descriptor %.4x:%.4x: %s (%x). skipping device",
idVendor, idProduct, darwin_error_str (ret), ret);
- return -1;
+ return darwin_to_libusb (ret);
}
/* catch buggy hubs (which appear to be virtual). Apple's own USB prober has problems with these devices. */
/* not a valid device */
usbi_warn (ctx, "idProduct from iokit (%04x) does not match idProduct in descriptor (%04x). skipping device",
idProduct, libusb_le16_to_cpu (dev->dev_descriptor.idProduct));
- return -1;
+ return LIBUSB_ERROR_NO_DEVICE;
}
usbi_dbg ("cached device descriptor:");
dev->can_enumerate = 1;
- return 0;
+ return LIBUSB_SUCCESS;
}
static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t service,
usbi_mutex_lock(&darwin_cached_devices_lock);
do {
+ *cached_out = NULL;
+
list_for_each_entry(new_device, &darwin_cached_devices, list, struct darwin_cached_device) {
usbi_dbg("matching sessionID 0x%x against cached device with sessionID 0x%x", sessionID, new_device->session);
if (new_device->session == sessionID) {