From bb3773090883409865a40e97a8cabb531fa00683 Mon Sep 17 00:00:00 2001 From: Igor Anokhin Date: Wed, 15 Apr 2020 13:47:51 +0300 Subject: [PATCH] os/darwin: use IOUSBDevice as darwin_device_class explicitly kIOUSBDeviceClassName define from IOUSBLib.h file was changed from IOUSBDevice to IOUSBHostDevice in macOS Catalina. In previous macOS versions, it was always defined as IOUSBDevice: ``` #define kIOUSBDeviceClassName "IOUSBDevice" ``` In macOS Catalina it looks as follows: ``` #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_14 #define kIOUSBDeviceClassName "IOUSBDevice" #define kIOUSBInterfaceClassName "IOUSBInterface" #else #define kIOUSBDeviceClassName kIOUSBHostDeviceClassName #define kIOUSBInterfaceClassName kIOUSBHostInterfaceClassName #endif /* MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_14 */ ``` By default, macOS Catalina uses IOUSBHostDevice. The problem is that using the IOUSBHostDevice class misses some devices. This has been described in 044a7ee commit. To work only with IOUSBDevice, darwin_device_class has been explicitly set to IOUSBDevice. Closes #693 For reference, here's the output of the 'listdevs' example before my changes: 05ac:027b (bus 128, device 2) path: 5 2109:0102 (bus 20, device 6) path: 4 05e3:0751 (bus 20, device 5) path: 1 1a40:0801 (bus 20, device 3) path: 2 0bda:8153 (bus 0, device 2) path: 3 2109:2817 (bus 20, device 1) path: 8 2109:0817 (bus 0, device 1) path: 4 And here's the output after my changes: 05ac:027b (bus 128, device 2) path: 5 2109:0102 (bus 20, device 6) path: 3.2.4 05e3:0751 (bus 20, device 5) path: 3.2.1 1a40:0801 (bus 20, device 3) path: 3.2 0bda:8153 (bus 0, device 2) path: 2.3 2109:2817 (bus 20, device 1) path: 3 2109:0817 (bus 0, device 1) path: 2 Closes #712 Signed-off-by: Nathan Hjelm --- libusb/os/darwin_usb.c | 2 +- libusb/version_nano.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index a1474ba3f..b1e45148f 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -68,7 +68,7 @@ static CFRunLoopSourceRef libusb_darwin_acfls = NULL; /* shutdown signal for eve static usbi_mutex_t darwin_cached_devices_lock = PTHREAD_MUTEX_INITIALIZER; static struct list_head darwin_cached_devices; -static const char *darwin_device_class = kIOUSBDeviceClassName; +static const char *darwin_device_class = "IOUSBDevice"; #define DARWIN_CACHED_DEVICE(a) (((struct darwin_device_priv *)usbi_get_device_priv((a)))->dev) diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 2b710bdda..b8305e30e 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11520 +#define LIBUSB_NANO 11521