esp32s3 builtin serial prompt: mpremote connects but cp/ls not working
Description
I have got micropython prompt from this simple code.
"mpremote" connects and prompt works.
but mpremote cp or ls doesn't work, it would
be great if it works so full file management can be done.
I tried to run this from main.py and works as prompt
but file management results in some error...
import os
import machine
import sys
sys.path.extend(['/lib'])
# string indices in the default descriptor
i_str_manuf = 0x01
i_str_product = 0x02
i_str_serial = 0x03
# module ID (will be read from DIP switches)
module_id = 0x11
# make strings
str_module_id = f'{module_id:02x}'
str_unique_id = f'{int.from_bytes(machine.unique_id()):x}'
str_serial = f'{str_unique_id}_{str_module_id}'
str_product = f'proto_meter_{module_id:02x}'
str_manuf = 'TheStumbler'
mystrings = {}
mystrings[0] = None # need this for language
mystrings[i_str_manuf] = str_manuf
mystrings[i_str_product] = str_product
mystrings[i_str_serial] = str_serial
#for s in mystrings.items(): print(s)
usbdev = machine.USBDevice()
desc_dev = usbdev.BUILTIN_DEFAULT.desc_dev
desc_cfg = usbdev.BUILTIN_DEFAULT.desc_cfg
usbdev.active(False)
usbdev.builtin_driver = usbdev.BUILTIN_DEFAULT
usbdev.config(
desc_dev, desc_cfg, \
desc_strs=mystrings \
)
usbdev.active(True)
Code Size
No response
Implementation
I hope the MicroPython maintainers or community will implement this feature
Code of Conduct
Yes, I agree
mpremote on Mac OS X: allow env var or option in config file to select default serial port to use
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?