From: Nathan Hjelm Date: Thu, 22 Jul 2021 05:12:19 +0000 (-0600) Subject: darwin: only attempt to auto-detach driver is one is active X-Git-Tag: upstream/1.0.25~48 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2522b3a4a88f42b7719db68260700c215bc8148;p=platform%2Fupstream%2Flibusb.git darwin: only attempt to auto-detach driver is one is active This commit improves the auto-detach code so that it doesn't attempt to detach a kernel driver if none exists. This will avoid extra info/warning output on the failed detach. Closes #960 Signed-off-by: Nathan Hjelm --- diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index 85ca1e8..319289b 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -2490,7 +2490,7 @@ static int darwin_attach_kernel_driver (struct libusb_device_handle *dev_handle, static int darwin_capture_claim_interface(struct libusb_device_handle *dev_handle, uint8_t iface) { enum libusb_error ret; - if (dev_handle->auto_detach_kernel_driver) { + if (dev_handle->auto_detach_kernel_driver && darwin_kernel_driver_active(dev_handle, iface)) { ret = darwin_detach_kernel_driver (dev_handle, iface); if (ret != LIBUSB_SUCCESS) { usbi_info (HANDLE_CTX (dev_handle), "failed to auto-detach the kernel driver for this device, ret=%d", ret); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 8dd74ce..0e73473 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11643 +#define LIBUSB_NANO 11644