Skip to content

Expose the read-only file API on embedded-filesystem builds - #1262

Open
meeloo wants to merge 1 commit into
Duet3D:3.7-devfrom
meeloo:upstream/fix-embedded-file-api
Open

Expose the read-only file API on embedded-filesystem builds#1262
meeloo wants to merge 1 commit into
Duet3D:3.7-devfrom
meeloo:upstream/fix-embedded-file-api

Conversation

@meeloo

@meeloo meeloo commented Aug 22, 2026

Copy link
Copy Markdown

rr_filelist answered {err:1} on a USE_EMBEDDED_FILES build, so DWC and AxisControl showed a broken file browser. The whole file API in HttpResponder is gated on HAS_MASS_STORAGE, which USE_EMBEDDED_FILES turns off - but EmbeddedFiles.cpp implements the very MassStorage functions those endpoints call (FileExists, DirectoryExists, FindFirst, FindNext). The capability was there; only the HTTP layer hid it.

fileinfo, filelist and files are now available when either backing store is present. upload, delete, move and mkdir stay mass-storage only, since an embedded filesystem is read-only. thumbnail also stays mass-storage only: it calls RepRap::GetFileFragment, which is not compiled for embedded builds.

Two things worth recording:

  • the fallback for boards with neither store emitted {err:1}, which is not valid JSON. Clients report it as a parse error rather than as an error code. Now {"err":1}.
  • adding a rejection branch for the write endpoints pushed GetJsonResponse past the range of a Thumb branch and the link failed with dangerous relocation. That function is close enough to the limit that it is worth knowing before adding anything to it. The write endpoints fall through to unknown-request handling instead.

Duet3_MB6HC is byte-for-byte the same size afterwards, so nothing changes on the mass-storage path.

Testing note: nothing upstream builds USE_EMBEDDED_FILES, so this cannot be exercised without a build config for the embedded variant. I have one at meeloo/RepRapFirmware:build/embedded-mb6hc-config and can open it as a separate PR, fold it into this one, or leave it out - whichever suits

rr_filelist answered {err:1} on a USE_EMBEDDED_FILES build, so DWC and AxisControl
showed a broken file browser. The whole file API in HttpResponder is gated on
HAS_MASS_STORAGE, which USE_EMBEDDED_FILES turns off - but EmbeddedFiles.cpp
implements the very MassStorage functions those endpoints call (FileExists,
DirectoryExists, FindFirst, FindNext). The capability was there; only the HTTP
layer hid it.

fileinfo, filelist and files are now available when either backing store is
present. upload, delete, move and mkdir stay mass-storage only, since an embedded
filesystem is read-only. thumbnail also stays mass-storage only: it calls
RepRap::GetFileFragment, which is not compiled for embedded builds, and enabling it
failed at link time rather than cleanly.

Two things worth recording:

 - the fallback for boards with neither store emitted {err:1}, which is not valid
   JSON. Clients report it as a parse error rather than as an error code. Now
   {"err":1};
 - adding a rejection branch for the write endpoints pushed GetJsonResponse past
   the range of a Thumb branch and the link failed with "dangerous relocation".
   That function is close enough to the limit that it is worth knowing before
   adding anything to it. The write endpoints fall through to unknown-request
   handling instead.

Duet3_MB6HC is byte-for-byte the same size afterwards (text 998468), so nothing
changes on the mass-storage path.
@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@meeloo

meeloo commented Aug 22, 2026

Copy link
Copy Markdown
Author

I have read the Duet3D CLA v2.0 and I hereby sign it

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.

1 participant