Expose the read-only file API on embedded-filesystem builds - #1262
Open
meeloo wants to merge 1 commit into
Open
Conversation
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.
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the Duet3D CLA v2.0 and I hereby sign it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rr_filelistanswered{err:1}on aUSE_EMBEDDED_FILESbuild, so DWC and AxisControl showed a broken file browser. The whole file API inHttpResponderis gated onHAS_MASS_STORAGE, whichUSE_EMBEDDED_FILESturns off - butEmbeddedFiles.cppimplements the veryMassStoragefunctions those endpoints call (FileExists,DirectoryExists,FindFirst,FindNext). The capability was there; only the HTTP layer hid it.fileinfo,filelistandfilesare now available when either backing store is present.upload,delete,moveandmkdirstay mass-storage only, since an embedded filesystem is read-only.thumbnailalso stays mass-storage only: it callsRepRap::GetFileFragment, which is not compiled for embedded builds.Two things worth recording:
{err:1}, which is not valid JSON. Clients report it as a parse error rather than as an error code. Now{"err":1}.GetJsonResponsepast the range of a Thumb branch and the link failed withdangerous 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_MB6HCis 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 atmeeloo/RepRapFirmware:build/embedded-mb6hc-configand can open it as a separate PR, fold it into this one, or leave it out - whichever suits