Craig,
Am 22.04.26 um 01:52 schrieb Craig Leres via OvmsDev:
On 4/21/26 15:04, Mark Webb-Johnson wrote:
I recall when I tried it I found the unmount function wasn’t atomic, so not trivial to do.
I guess we could issue the shell command (which is atomic), but perhaps that would cause problems (with recursion into the shell)?
I think what is needed is a way to poll sdcard::m_unmounting or even a new sdcard entry point that starts the unmount and waits for it to complete (or fail).
That's what the shell command does.
A problem I see is that if there are files open on the sdcard (e.g. a log file or can log), the unmount attempt will fail. So you probably want equivalent to "log close" before trying to unmount the sd.
That's the purpose of the synchronous "sd.unmounting" event, which framework components like the file logger listen to.
If you find a component that doesn't properly react to this event, that's a bug that needs to be fixed.
In your use case of writing huge CAN logs, I'd first check if you just
need to pass a longer timeout to "sd unmount", the default is 5 seconds.
The generic ESP_FAIL code is returned by unmount() if the
"sd.unmounting" process has been started but hasn't finished yet.
Regards, Michael
Craig
OVMS# sd unmount Error: SD unmount failed: ESP_FAIL OVMS# log status Log listeners : 3 File logging status: inactive Log file path : /sd/logs/ovms-dev.log Current size : 550.5 kB Cycle size : 1024 kB Cycle count : 0 Dropped messages : 0 Messages logged : 3227 Total fsync time : 6.0 s
OvmsDev mailing list -- ovmsdev@lists.openvehicles.com To unsubscribe send an email to ovmsdev-leave@lists.openvehicles.com
-- Michael Balzer * Am Rahmen 5 * D-58313 Herdecke Fon 02330 9104094 * Handy 0176 20698926