Skip to content

SD card mounted in code.py is not writable from USB even when storage.mount(..., readonly=True) #10657

@dhalbert

Description

@dhalbert

SD card presented via USB should be writable via below, but is still read-only. I thought I tested this 🤦 .

import board
import sdcardio
import storage
import os

cs = board.D10

READONLY=True
try:
    sdcard = sdcardio.SDCard(board.SPI(), cs, baudrate=24_000_000)
    vfs = storage.VfsFat(sdcard)

    storage.mount(vfs, "/sd", readonly=READONLY)
    print(f"SD card mounted readonly={READONLY} at /sd")
    print("Contents:", os.listdir("/sd"))
except Exception as e:
    print("SD mount failed:", e)

while True:
    pass

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions