Skip to content

allow storage.disable_usb_drive() and .enable_usb_drive() after boot.py#11124

Open
dhalbert wants to merge 2 commits into
adafruit:mainfrom
dhalbert:enable-disable-usb-drive-later
Open

allow storage.disable_usb_drive() and .enable_usb_drive() after boot.py#11124
dhalbert wants to merge 2 commits into
adafruit:mainfrom
dhalbert:enable-disable-usb-drive-later

Conversation

@dhalbert

@dhalbert dhalbert commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Allows storage.disable_usb_drive() and .enable_usb_drive() to be called from code.py or from the REPL.

Disabling the USB drive at that time makes the LUN for CIRCUITPY be "not ready", and makes CIRCUITPY read/write to code or to the REPL. This allows user-code file writes, or file writes from the REPL. REPL access will be useful for serial-based code editors and file uploaders.

Re-enabling the USB drive makes the LUN ready again, and makes it read-only again, assuming it was mounted that way. The host computer will find it.

Tested on Linux, Windows 11, and macOS 26.6 beta 5.

Tagging @urfdvw and @makermelissa for interest for code editors.

@dhalbert
dhalbert requested a review from tannewt July 16, 2026 11:26

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a kwarg to emphasize the risk of data corruption?

Comment thread shared-bindings/storage/__init__.c Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User-initiated Python write access to CIRCUITPY

2 participants