Darwin: Use Release instead of IODestroyPlugInInterface
authorNathan Hjelm <hjelmn@me.com>
Sat, 29 Sep 2012 04:13:09 +0000 (22:13 -0600)
committerPete Batard <pete@akeo.ie>
Wed, 31 Oct 2012 22:59:02 +0000 (22:59 +0000)
* This avoids stopping IOServices associated with a device
* Closes #54

libusb/os/darwin_usb.c
libusb/version_nano.h

index 65b889f..187ccfc 100644 (file)
@@ -247,9 +247,8 @@ static usb_device_t **usb_get_next_device (io_iterator_t deviceIterator, UInt32
 
   (void)(*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(DeviceInterfaceID),
                                           (LPVOID)&device);
-
-  (*plugInInterface)->Stop(plugInInterface);
-  IODestroyPlugInInterface (plugInInterface);
+  /* Use release instead of IODestroyPlugInInterface to avoid stopping IOServices associated with this device */
+  (*plugInInterface)->Release (plugInInterface);
 
   /* get the location from the device */
   if (locationp)
@@ -1134,7 +1133,8 @@ static int darwin_claim_interface(struct libusb_device_handle *dev_handle, int i
                                               CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID),
                                               (LPVOID)&cInterface->interface);
   /* We no longer need the intermediate plug-in */
-  IODestroyPlugInInterface (plugInInterface);
+  /* Use release instead of IODestroyPlugInInterface to avoid stopping IOServices associated with this device */
+  (*plugInInterface)->Release (plugInInterface);
   if (kresult || !cInterface->interface) {
     usbi_err (HANDLE_CTX (dev_handle), "QueryInterface: %s", darwin_error_str(kresult));
     return darwin_to_libusb (kresult);
index 6f53f83..771be77 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 10582
+#define LIBUSB_NANO 10583