← index #8485PR #10057
Likely Duplicate · medium · value 1.421
QUERY · ISSUE

mpremote on Mac OS X: allow env var or option in config file to select default serial port to use

openby javiercanadillasopened 2022-04-03updated 2025-09-05
enhancementtools

I'm using Mac OS X, and I'm struggling to get mpremote to do anything more than giving me a REPL.

This is the list of devices I get when trying to connect to an ESP32 DevKitC1 board:

mpremote connect list
/dev/cu.BLTH None 0000:0000 None None
/dev/cu.Bluetooth-Incoming-Port None 0000:0000 None None
/dev/cu.usbserial-0001 0001 10c4:ea60 Silicon Labs CP2102 USB to UART Bridge Controller

Issuing mpremote connect /dev/cu.usbserial-0001 connects to the board and gives me a REPL back. But any other command (fs, run, exec...) won't work as mpremote always assume that the device is has to connect to is the first in the previous list (/dev/cu.BLTH in my case).

As mpremote CLI syntax does not seem to allow specifying both the serial port to use and the action to perform (imagine something like mpremote -D /dev/cu.usbserial-001 fs ls), would it be possible to consider a shell env var à la ampy (or minicom) to tell it what serial port to use?

CANDIDATE · PULL REQUEST

mpremote: only auto connect to serial device with USB VID/PID

mergedby mogensonopened 2022-11-22updated 2022-11-27
tools

On MacOS and Windows there are a few default serial devices that are returned by serial.tools.list_ports.comports(). For example on MacOS:

{'description': 'n/a',
 'device': '/dev/cu.Bluetooth-Incoming-Port',
 'hwid': 'n/a',
 'interface': None,
 'location': None,
 'manufacturer': None,
 'name': 'cu.Bluetooth-Incoming-Port',
 'pid': None,
 'product': None,
 'serial_number': None,
 'vid': None}

{'description': 'n/a',
 'device': '/dev/cu.wlan-debug',
 'hwid': 'n/a',
 'interface': None,
 'location': None,
 'manufacturer': None,
 'name': 'cu.wlan-debug',
 'pid': None,
 'product': None,
 'serial_number': None,
 'vid': None}

Users of mpremote most likely do not want to connect to these ports. It would be desireable if mpremote did not select this ports when using the auto connect behavior. These serial ports do not have USB VID or PID values and serial ports for Micropython boards with FTDI/serial-to- USB adaptors or native USB CDC/ACM support do.

Check for the presence of a USB VID / PID int value when selecting a serial port to auto connect to. All serial ports will still be listed by the list command and can still be selected by name when connecting.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied