-
-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File handling commands #741
Comments
There wasn't any need for cross-filesystem operations until now. Even with an SD-card, it's a nice to have, but not as critical imho. To support universal file handling, I think these operations (and subsequent commands) should be handled through LVGL filesystem APIs. This will prevent a lot of Alternatively, we could use POSIX operations ( If it is possible to mount the SD/MMC with ESP32 VFS APIs, then this should be relatively easy to implement. The LittleFS partition is already mounted to This will increase the flexibility greatly and should be easier to migrate to a different LVGL version, add new subsystems or even support across operation systems. |
Whilst I agree file system operations fall in to the "nice to have" category, having a copy enables a user to load up an SD card with files and then deploy them to multiple plates. The core of a list command is already in place with filesystem_list(), so spitting out an mqtt message should be trivial - Just a couple of lines were needed to print to the terminal (will commit the changes later). Will certainly look at the LVGL api if it simplifies handling multiple filesystems and copying files between drives. |
There are different routes, each with its own pro and cons. In the short term, On Arduino The idea is to phase out
I think the deeper you dive into this, a universal solution quickly becomes a necessity because there are config files, images, fonts, ... being accessed from LVGL, HTTP, FTP, ... Using Of course, this is just my opinion and more discussion is needed. I don't have a clear view on the work needed, but if we combine the effort it should be doable. |
I agree my solution works but it's only for a custom build, anyway I will explore for a universal solution. |
@Martinson50 Thanks for sharing your code. There is more interest in SD card support, so we are seriously looking seriously into adding this feature. The usage of the Arduino SD libraries are a good way to start using the SD card. However, it doesn't integrate well with other filesystems. I would like to avoid using I think if we can mount the card to the Virtual File System using This makes |
The Arduino libraries are, for the main part, wrappers around lower level espessif system calls. Well documented, and will run on non-ESP boards. Whilst not portable to say a POSIX environment, SD.h & FS.h allows for "proof of concept" to be thrown together fairly quickly. |
OK, I see |
So, I'm going to try to code a couple of commands
- copy [from Z:] [to L:]
- unzip [from Z:],[to L:]
El vie, 24 may 2024 a las 3:22, fvanroie ***@***.***>)
escribió:
… OK, I see SD.begin includes a mountpoint parameter, which presumably adds
it to the VFS on ESP32...
That would suffice to build other functions on-top, as it probably uses
the ESP32 VFS api's already; so my comment above is mute
—
Reply to this email directly, view it on GitHub
<#741 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCXKO7TED4IFCY7IVGLZUDZD2I6XAVCNFSM6AAAAABIFNGKT2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRYGMYTEOJQHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
An unzip from Z: to L: (or the other way round) isn't needed in my opinion. You can achieve the same by using the existing unzip (on either Z: or L:) and then copying the files. If you wanted to checkout my fork, we can do some of the collaboration there and push changes back here once they pass approval. |
Pushed a rough draft of a "list" command that returns an mqtt message containing files & sizes. |
Thanks for the demo. It makes the proposal a lot clearer, as I thought the commands would be consumed by the commandline and webserver. That result can potentially get huge, especially on a big SD card. Maybe we don't return all recursive results by default? Like the Instead of using |
Agreed, the mqtt message has the potential to consume a LOT of memory if there are shed loads of small files to list. Gets even worse if you descend in to subdirectories. Perhaps place a size limit on the payload string - Both the filesystem_list() and filesystem_list_path() suffer from the same problem. The latter could also overrun the end of the fn[] array if hit with a particularly long file name - There will always be some twisted individual that will try (like me 😜 ) Use case was nothing more than extracting information for curiosity. If the SD card was used to store logs, an end user could monitor the size and rotate/delete if they got too large. Give them the tools, and you might be surprised what gets done. |
As part of adding SD support, it occurred to me that it would be useful to have some basic file handling commands. e.g.:
list - Returning a json object with file names & sizes on either SD card or internal storage (spiffs/littlefs) - Already implemented as a dir command and used by the file editor, but doesn't display file size.
copy - Copy file to/from SD card and returns a json object of file name (including new path ?) and size
move - As per copy, but deleting source file if copy is successful.
delete - Already available within the file editor, but no callable from mqtt/telnet/terminal (unless I've missed something)
copy and move commands would only be of use for those using an SD card. list (or an enhanced dir) and copy have a wider appeal to other users.
The text was updated successfully, but these errors were encountered: