Skip to content

Commit

Permalink
fix: USB-JTAG-Serial PID detection error
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzeman committed May 8, 2023
1 parent 5892496 commit 9a719f4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions esptool/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,14 @@ def _get_pid(self):
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 {}, "
Expand Down

0 comments on commit 9a719f4

Please sign in to comment.