From 0c9f1c5f3ee736e94e1d4112a01909928319be59 Mon Sep 17 00:00:00 2001 From: "Gowtham Nanjukutty (XC-CP/ECC2.3)" Date: Fri, 22 May 2026 09:12:58 -0400 Subject: [PATCH] darwin: fix CDCACM device detection on macOS 12+ On macOS 12 and later, Apple replaced IOUSBDevice with IOUSBHostDevice in the USB host stack. When walking the IORegistry parent chain to find the USB device providing a serial port, the existing code only checked IOObjectConformsTo(parent, kIOUSBDeviceClassName). On macOS 12+, this check fails because the USB device node conforms to IOUSBHostDevice instead. Fix by also checking IOObjectConformsTo(parent, "IOUSBHostDevice"), so CDCACM device discovery works on both old and new macOS. Verified on macOS 26 (Tahoe, arm64) with a ValueCAN 4-2 (V2D805). --- platform/posix/darwin/cdcacmdarwin.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/posix/darwin/cdcacmdarwin.cpp b/platform/posix/darwin/cdcacmdarwin.cpp index ea322e60..da425590 100644 --- a/platform/posix/darwin/cdcacmdarwin.cpp +++ b/platform/posix/darwin/cdcacmdarwin.cpp @@ -108,8 +108,9 @@ void CDCACM::Find(std::vector& found) { releasers.emplace_back(parent); current = parent; // On old macOSes, IOUSBDevice is the type of the class we want - // On newer macOSes, IOUSBDevice may further be subclassed as IOUSBHostDevice - if(IOObjectConformsTo(parent, kIOUSBDeviceClassName)) { + // On macOS 12+, IOUSBHostDevice is the main USB device class (separate hierarchy from IOUSBDevice) + if(IOObjectConformsTo(parent, kIOUSBDeviceClassName) || + IOObjectConformsTo(parent, "IOUSBHostDevice")) { usb = parent; break; }