← index #17222Issue #7485
Related · medium · value 0.215
QUERY · ISSUE

esp32s3 builtin serial prompt: mpremote connects but cp/ls not working

openby emardopened 2025-04-30updated 2025-09-05
enhancementtools

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

CANDIDATE · ISSUE

mpremote with mount fails on ESP32

closedby peterhinchopened 2021-07-04updated 2022-02-07
tools

Re-installed mpremote today - tail end of pip3:

Successfully installed mpremote-0.0.5

ESP32 works OK, with ctrl-d resetting the ESP uneventfully if there is no mount.

With a mount, ctrl-d kills mpremote. In the following, when the REPL appeared I pressed ctrl-d:

>>> [adminpete@capybara]: ~/temp
$ mpremote mount .
Local directory . is mounted at /remote
Connected to MicroPython at /dev/ttyUSB0
Use Ctrl-] to exit this shell
>
MicroPython v1.16 on 2021-06-28; ESP32 module with ESP32
Type "help()" for more information.
>>> 
MPY: soft reboot
Traceback (most recent call last):
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/main.py", line 452, in main
    do_repl(pyb, args)
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/main.py", line 332, in do_repl
    do_repl_main_loop(
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/main.py", line 259, in do_repl_main_loop
    pyb.soft_reset_with_mount(console_out_write)
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/pyboardextended.py", line 612, in soft_reset_with_mount
    self.exec_(fs_hook_code)
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/pyboard.py", line 465, in exec_
    ret, ret_err = self.exec_raw(command, data_consumer=data_consumer)
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/pyboard.py", line 456, in exec_raw
    self.exec_raw_no_follow(command)
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/pyboard.py", line 453, in exec_raw_no_follow
    raise PyboardError("could not exec command (response: %r)" % data)
mpremote.pyboard.PyboardError: could not exec command (response: b'R\x01')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/adminpete/.local/bin/mpremote", line 8, in <module>
    sys.exit(main())
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/main.py", line 455, in main
    do_disconnect(pyb)
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/main.py", line 208, in do_disconnect
    pyb.umount_local()
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/pyboardextended.py", line 620, in umount_local
    self.exec_('uos.umount("/remote")')
  File "/home/adminpete/.local/lib/python3.8/site-packages/mpremote/pyboard.py", line 467, in exec_
    raise PyboardError("exception", ret, ret_err)
mpremote.pyboard.PyboardError: ('exception', b'', b'Traceback (most recent call last):\r\n  File "<stdin>", line 1, in <module>\r\nOSError: [Errno 22] EINVAL\r\n')

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