Skip to content

Commit 538c9e2

Browse files
committed
mpremote/transport_serial: Update ESPxxx detection for USB-CDC ports.
ref: #9659 (comment) Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
1 parent 062e82a commit 538c9e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tools/mpremote/mpremote/transport_serial.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
from .console import VT_ENABLED
4141
from .transport import TransportError, TransportExecError, Transport
4242

43+
VID_ESPRESSIF = 0x303A # Espressif Incorporated
44+
4345

4446
class SerialTransport(Transport):
4547
fs_hook_mount = "/remote" # MUST match the mount point in fs_hook_code
@@ -71,7 +73,10 @@ def __init__(self, device, baudrate=115200, wait=0, exclusive=True, timeout=None
7173
self.serial = serial.Serial(**serial_kwargs)
7274
self.serial.port = device
7375
portinfo = list(serial.tools.list_ports.grep(device)) # type: ignore
74-
if portinfo and portinfo[0].manufacturer != "Microsoft":
76+
if portinfo and (
77+
getattr(portinfo[0], "vid", 0) == VID_ESPRESSIF
78+
or getattr(portinfo[0], "manufacturer", "") != "Microsoft"
79+
):
7580
# ESP8266/ESP32 boards use RTS/CTS for flashing and boot mode selection.
7681
# DTR False: to avoid using the reset button will hang the MCU in bootloader mode
7782
# RTS False: to prevent pulses on rts on serial.close() that would POWERON_RESET an ESPxx

0 commit comments

Comments
 (0)