summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@me.com>2013-08-26 20:40:52 -0600
committerNathan Hjelm <hjelmn@me.com>2013-08-26 20:40:52 -0600
commit52cdd1a5c91ea64908885bb4a83634cb03257728 (patch)
tree2eac18a218944380cb7740200429538ce6d66c64
parent7b14df40b00d82adeae99367f64076823c23684f (diff)
downloadlibusb-52cdd1a5c91ea64908885bb4a83634cb03257728.tar.gz
darwin: return libusb error codes instead of kernel error codes and fix
a bug introduced in the last commit.
-rw-r--r--libusb/os/darwin_usb.c8
-rw-r--r--libusb/version_nano.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index 933fcd7..889c62a 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -702,7 +702,7 @@ static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct da
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. */
@@ -710,7 +710,7 @@ static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct da
/* 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:");
@@ -730,7 +730,7 @@ static int darwin_cache_device_descriptor (struct libusb_context *ctx, struct da
dev->can_enumerate = 1;
- return 0;
+ return LIBUSB_SUCCESS;
}
static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t service,
@@ -758,6 +758,8 @@ static int darwin_get_cached_device(struct libusb_context *ctx, io_service_t ser
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) {
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 623a0bb..aa81a72 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10822
+#define LIBUSB_NANO 10823