From 6a2cebf82866b593ce97d79b1b70ad08ea19c02b Mon Sep 17 00:00:00 2001 From: aljazkonec1 Date: Tue, 24 Nov 2026 16:44:40 +0100 Subject: [PATCH] darwin: read the port number as "usb-port-number" on macOS 26 macOS 26 renamed the IORegistry port number property of the parent port from "port" to "usb-port-number". The darwin backend read only "port", so libusb_get_port_numbers() returned no ports on macOS 26, and XLink named every USB device "0." (bus 0, no ports). Read "port" first, so macOS 15 and older work as before, and read "usb-port-number" when "port" is missing. Upstream libusb fixed the same problem in a409dbb68 (issues #1661, #1700, release v1.0.30) with a check of the running macOS version; this fork has no get_running_version(). --- libusb/os/darwin_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index 3f3a35af9..478ac6119 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -957,7 +957,9 @@ static bool get_device_port (io_service_t service, UInt8 *port) { kresult = IORegistryEntryGetParentEntry (service, kIOServicePlane, &parent); if (kIOReturnSuccess == kresult) { - ret = get_ioregistry_value_data (parent, CFSTR("port"), 1, port); + /* macOS 15 and older name the port number property "port", macOS 26 names it "usb-port-number". */ + ret = get_ioregistry_value_data (parent, CFSTR("port"), 1, port) || + get_ioregistry_value_data (parent, CFSTR("usb-port-number"), 1, port); IOObjectRelease (parent); }