summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorByron Han <han@apple.com>2020-11-17 16:57:57 -0800
committerByron Han <han@apple.com>2020-11-17 16:57:57 -0800
commit70a6b99fa5eff291bee88caedf1f418dfdd9d0ea (patch)
tree08719bea0c44b5504a82c3bbd74e09fefdabf939
parent78ee0c2a163c6858ada47c683bf60c487963f4f0 (diff)
downloadpyserial-git-70a6b99fa5eff291bee88caedf1f418dfdd9d0ea.tar.gz
implement patch from oskay
added call to get IOUSBHostDevice before falling back to IOUSBDevice (which has been removed on Big Sur on Apple Silicon
-rw-r--r--serial/tools/list_ports_osx.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/serial/tools/list_ports_osx.py b/serial/tools/list_ports_osx.py
index 0b73fa2..f6308c9 100644
--- a/serial/tools/list_ports_osx.py
+++ b/serial/tools/list_ports_osx.py
@@ -270,7 +270,11 @@ def comports(include_links=False):
if device:
info = list_ports_common.ListPortInfo(device)
# If the serial port is implemented by IOUSBDevice
- usb_device = GetParentDeviceByType(service, "IOUSBDevice")
+ # NOTE IOUSBDevice was deprecated as of 10.11 and finally on Apple Silicon
+ # devices has been completely removed. Thanks to @oskay for this patch.
+ usb_device = GetParentDeviceByType(service, "IOUSBHostDevice")
+ if not usb_device:
+ usb_device = GetParentDeviceByType(service, "IOUSBDevice")
if usb_device:
# fetch some useful informations from properties
info.vid = get_int_property(usb_device, "idVendor", kCFNumberSInt16Type)