From 9a719f40725b292db7aa87134204ced085ccb762 Mon Sep 17 00:00:00 2001 From: Dean Gardiner Date: Tue, 9 May 2023 00:39:22 +1200 Subject: [PATCH] fix: USB-JTAG-Serial PID detection error --- esptool/loader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esptool/loader.py b/esptool/loader.py index eb6402369..ba8b7f5bd 100644 --- a/esptool/loader.py +++ b/esptool/loader.py @@ -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 {}, "