Skip to content

unsafe_disable_usb_drive() cannot be undone #11394

Description

@bablokb

CircuitPython version and board name

Adafruit CircuitPython 10.3.1 on 2026-09-14; Raspberry Pi Pico with rp2040

Code/REPL

>>> import storage
>>> storage.unsafe_disable_usb_drive()
>>> storage.remount("/", readonly=True, disable_concurrent_write_protection=True)
Zurückverfolgung (jüngste Aufforderung zuletzt):
  Datei "<stdin>", Zeile 1, in <module>
RuntimeError: Der Pfad kann nicht neu gemountet werden, wenn er über USB sichtbar ist.

Behavior

I fail to enable the usb-drive again in normal read-write mode for the host. After disabling the drive, I can re-enable it with storage.enable_usb_drive(), but it is read-only for the host. The docs say:

If you call enable_usb_drive() after code.py starts or in the REPL, you can reverse the effect of a previous unsafe_disable_usb_drive(). The CIRCUITPY drive will reappear to the host, and become read-only again if it was previously read-only.

Before storage.unsafe_disable_usb_drive() it was read-write for the host, so I expect it to be read-write again?!

The RunTime error above is also an error: after storage.unsafe_disable_usb_drive() the drive is not visible via USB, so no need to bail out.

Description

No response

Additional information

Detected with 10.3.0 already, but nothing changed with 10.3.1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions