Repository navigation
Don't stop SD listing at an orphaned long name - #98
Conversation
|
@ellensp can you clarify the context ? I do not denie the issue you raised and fixed but I do not understand how you could meet it |
SdFat's openNext() fails when a long name entry's checksum doesn't match the short name entry that follows it. SD bootloaders on many printer boards leave exactly that when they rename firmware.bin to FIRMWARE.CUR, so the SD file list came back empty with a card that had been used to update such a board. Keep reading after such a failure, and stop only at the end of the directory or on a card error.
5f1c5ca to
686fe05
Compare
|
Sorry for the confusion in my first description. I wrote that the TinyBee's bootloader had renamed I've corrected the description and the commit message. The code change is the same: any card that has been through one of those bootloaders hits this, whichever board reads it afterwards. |
|
Ok that make more sense - thank you for the clarification |
|
Merged thank you |
Don't stop SD listing at an orphaned long name
Description
With an SD card that was previously used to update another printer board, the ESP3D SD file list is empty:
[ESP740]reportsFiles: 0, Dirs :0, and the web file list returns"files":[], although the card has files on it.SD bootloaders on many printer boards flash
firmware.binand then rename it toFIRMWARE.CUR, changing only the 8.3 name. The long name entry forfirmware.binstays in front of it. These are the first two root directory entries of the test card, read on the board:The long name's checksum, 0x57, is the checksum of
FIRMWARE.BIN.FIRMWARE.CURhas a checksum of 0x21. SdFat'sFatFile::openNext()treats that mismatch as a failure (if (lfnOrd && checksum != lfnChecksum(dir->name)) goto fail;, the same in SdFat 2.2.3, 2.3.0 and 2.3.1). SoESP_SDFile::openNextFile()insd_sdfat2_esp32.cppreturns no file at the first entry, and every listing of that directory ends there. Linux, and Marlin's own SD code, ignore the orphaned long name and list the rest of the directory.When SdFat's
openNextFile()fails,ESP_SDFile::openNextFile()now looks at the last 32-byte entry it read:openNextFile()again, which continues from the next entry.The entry that failed (
FIRMWARE.CURhere) is skipped, because SdFat won't open it.Testing
MKS TinyBee, Marlin
bugfix-2.1.xwith arduino-esp32 3.0.4 (pioarduino 51.03.04) and SdFat 2.2.3. The card hasFIRMWARE.CUR(as above), a.Trash-1000directory andwebtest.gcode:[ESP740](telnet)/sdfiles?path=/Files: 0, Dirs :0"files":[][DIR] .Trash-1000,webtest.gcode 53 B,Files: 1, Dirs :1.Trash-1000andwebtest.gcodeTotal and used space are reported the same before and after (7.42 GB, 340 KB).