Skip to content

Broaden read-only filesystem messaging to cover non-host-mounted cases (refs #460)#506

Merged
makermelissa merged 1 commit into
circuitpython:mainfrom
makermelissa-piclaw:fix/issue-460-broader-readonly-message
Jun 5, 2026
Merged

Broaden read-only filesystem messaging to cover non-host-mounted cases (refs #460)#506
makermelissa merged 1 commit into
circuitpython:mainfrom
makermelissa-piclaw:fix/issue-460-broader-readonly-message

Conversation

@makermelissa-piclaw
Copy link
Copy Markdown
Contributor

Summary

Refs #460 — the read-only filesystem dialog from PR #498 misdiagnoses
a real-world case the original reporter flagged: a board connected
to a USB power-only source (no host has CIRCUITPY mounted)
still hits the dialog and is told to disconnect a host that isn't
there.

This PR is a messaging fix only — the detection logic is
unchanged. It does not close #460; the underlying
"board-side filesystem stays locked while USB MSC is enabled even
when no host is using it" behavior is a firmware-side concern that
will be tracked separately.

What changed

js/script.js

Connect-time read-only notice:

Filesystem is read-only — you can browse files, but saving will fail until USB Mass Storage is released. [How to fix].

Filesystem is read-only — you can browse files, but saving will fail while USB Mass Storage is enabled on the board. [How to fix].

Save-failure dialog:

The board's filesystem is locked, usually because CIRCUITPY is mounted on a computer over USB.

The board's filesystem is in read-only mode for web workflow. This happens whenever USB Mass Storage is enabled on the board (the default for most CircuitPython boards), whether or not a host computer is actively using it.

Reordered the fix list (boot.py disable comes first now, because
the alternate "just unplug USB" remedy only helps the smaller
subset of users where a host actually has it mounted), and added
a heads-up paragraph:

Heads up: disabling USB Mass Storage in boot.py means the
CIRCUITPY drive won't appear on a host computer either — you'll
edit through web workflow only. Many makers use a button or pin
check in boot.py to choose between the two modes at startup.

That note is the missing piece for the dual-workflow case the
original reporter (#460) called out: they work on the same project
both at the bench (Mu over USB) and deployed (web workflow), and
the previous dialog's only fix recommendation forced them to pick one.

js/common/web-file-transfer.js

The _writeProtectedError().hint string (used as the fallback
when the editor doesn't render the dialog itself) is updated to
match the new framing — points at USB MSC being enabled, doesn't
assert host involvement.

Why not just close #460 with this?

The dialog is now accurate, but the underlying board behavior
(filesystem stays write-protected while USB MSC is enabled, even
on power-only connections) is still surprising and arguably wrong
on hardware that never sees a real host. Investigating whether
the CircuitPython firmware should release the lock when no host
has done a real WRITE10 in some window, or expose a cooperative
"yield to web workflow" mechanism, is its own piece of work and
belongs in adafruit/circuitpython.
That follow-up will be tracked separately; #460 stays open as
the umbrella.

Testing

  • node --check on both edited files passes.
  • npm run build (vite) passes clean.
  • Diff is messaging-only; no control-flow changes, no new
    branches, no API surface change.

Refs

The current dialog asserts that a host computer has CIRCUITPY mounted
over USB, but that isn't always the cause. CircuitPython firmware
holds the block device locked whenever USB Mass Storage is enabled
on the board (the default for most boards), even on a power-only USB
connection or a wall adapter that never completes SCSI enumeration.

Users reproducing on a board connected only to a USB power source —
no host, no Finder eject involved — were getting a dialog telling
them to disconnect a host that wasn't there, which read as a bug.

This commit:

- Rewords the connect-time read-only notice to point at USB Mass
  Storage being *enabled*, not 'released'.
- Rewords the save-failure dialog and the underlying ProtocolError
  hint to describe the read-only state in terms of the firmware's
  USB MSC mode rather than asserting host involvement.
- Adds a 'heads up' note explaining that disabling USB MSC in
  boot.py hides CIRCUITPY from a host computer too, and mentions
  the common boot.py-button-gate pattern so users juggling Mu and
  web workflow understand the tradeoff before they edit boot.py.
- Keeps the macOS Finder-eject caveat where it still applies.

The detection logic (409/500 on /fs/ PUT tagged as writeProtected)
is unchanged; this is a messaging fix only.
Copy link
Copy Markdown
Collaborator

@makermelissa makermelissa left a comment

Choose a reason for hiding this comment

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

Looks good.

@makermelissa makermelissa merged commit 0e7d914 into circuitpython:main Jun 5, 2026
1 check passed
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.

Cannot Save code.py Edits on Adafruit Qualia ESP32-S3 for TTL RGB-666 Displays

2 participants