Skip to content

Commit

Permalink
tools/mpremote: Add support for rfc2217, serial over TCP.
Browse files Browse the repository at this point in the history
Signed-off-by: Jos Verlinde <[email protected]>
  • Loading branch information
Josverl authored and dpgeorge committed Sep 29, 2023
1 parent 88ecc78 commit 58c2c50
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion docs/reference/mpremote.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ The full list of supported commands are:
command output)
- ``port:<path>``: connect to the device with the given path (the first column
from the ``connect list`` command output
- ``rfc2217://<host>:<port>``: connect to the device using serial over TCP
(e.g. a networked serial port based on RFC2217)
- any valid device name/path, to connect to that device

**Note:** Instead of using the ``connect`` command, there are several
Expand All @@ -109,7 +111,7 @@ The full list of supported commands are:

**Note:** The ``auto`` option will only detect USB serial ports, i.e. a serial
port that has an associated USB VID/PID (i.e. CDC/ACM or FTDI-style
devices). Other types of serial ports
devices). Other types of serial ports will not be auto-detected.

.. _mpremote_command_disconnect:

Expand Down
4 changes: 3 additions & 1 deletion tools/mpremote/mpremote/transport_serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def __init__(self, device, baudrate=115200, wait=0, exclusive=True):
delayed = False
for attempt in range(wait + 1):
try:
if os.name == "nt":
if device.startswith("rfc2217://"):
self.serial = serial.serial_for_url(device, **serial_kwargs)
elif os.name == "nt":
self.serial = serial.Serial(**serial_kwargs)
self.serial.port = device
portinfo = list(serial.tools.list_ports.grep(device)) # type: ignore
Expand Down

0 comments on commit 58c2c50

Please sign in to comment.