fix: USB-JTAG-Serial PID detection error

This commit is contained in:
Dean Gardiner
2023-05-09 00:39:22 +12:00
parent 58924960ba
commit 9a719f4072

View File

@@ -494,12 +494,14 @@ class ESPLoader(object):
if active_port.startswith("/dev/") and os.path.islink(active_port):
active_port = os.path.realpath(active_port)
active_ports = [active_port]
# The "cu" (call-up) device has to be used for outgoing communication on MacOS
if sys.platform == "darwin" and "tty" in active_port:
active_port = [active_port, active_port.replace("tty", "cu")]
active_ports.append(active_port.replace("tty", "cu"))
ports = list_ports.comports()
for p in ports:
if p.device in active_port:
if p.device in active_ports:
return p.pid
print(
"\nFailed to get PID of a device on {}, "