serialport-rs icon indicating copy to clipboard operation
serialport-rs copied to clipboard

Fix USB interface on macOS

Open parasyte opened this issue 1 year ago • 0 comments

When the usbportinfo-interface feature is enabled on macOS, the UsbPortInfo::interface is always None. A careful reading of https://developer.apple.com/library/archive/documentation/DeviceDrivers/Conceptual/USBBook/USBOverview/USBOverview.html#//apple_ref/doc/uid/TP40002644-BBIDGCHB indicates that device matching or interface matching needs to be considered on a per-application basis. This PR switches the class to IOUSBHostInterface when the feature is enabled, allowing the interface number to be returned.

I am not familiar with macOS, but this seems like a fair compromise without changing the serialport APIs to make a distinction between searching for devices and searching for interfaces.

parasyte avatar May 26 '24 08:05 parasyte