Closed eduard-sukharev closed 1 year ago
Further debugging reveals following: in a file Marlin/src/sd/SdBaseFile.cpp
a function with signature bool SdBaseFile::open(SdBaseFile *dirFile, const uint8_t dname[11] OPTARG(LONG_FILENAME_WRITE_SUPPORT, const uint8_t dlname[LONG_FILENAME_LENGTH]), uint8_t oflag)
actually scans VFAT sequences to compose a complete LFN by matching LFN checksums, which means that it supposed to not care if the generated short dosname is random. The issue with mismatching filenames remains unresolved, though, as I still cannot understand why exactly that happens
The issue seem to be that lfn comparison is done like this:
if (!strncasecmp((char*)dlname, (char*)lfnName, lfnNameLength)) lfnFileFound = true;
and while dlname
and lfname
are both uint8_t
and have same length, dlname
content is encoded as single-byte chars string (ASCII), while lfname
contains two-byte chars encoding (UTF-16LE).
Closing since you've opened a PR.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Did you test the latest
bugfix-2.1.x
code?Yes, and the problem still exists.
Bug Description
Even with
LONG_FILENAME_HOST_SUPPORT
andLONG_FILENAME_WRITE_SUPPORT
defines, selecting a file for printing withM23
by the long file name does not work.Bug Timeline
No response
Expected behavior
Selecting a file for printing with
M23
worksActual behavior
Selecting a file by it's long filename fails
Steps to Reproduce
longfilename.gcode
M21
commandM20 L
command. Verify that the file is there and reported with both DOS filename and Long filename (LONGFI~1.GCO
andlongfilename.gcode
)M23 longfilename.gcode
to select the fileVersion of Marlin Firmware
bugfix-2.1.x
Printer model
No response
Electronics
No response
Add-ons
No response
Bed Leveling
None
Your Slicer
None
Host Software
Pronterface
Don't forget to include
Configuration.h
andConfiguration_adv.h
.Additional information & file uploads
I have added a bunch of
DEBUG_ECHO*
calls that mostly duplicate code comments, intoSdBaseFile.cpp
, inside the method with following signature:and here's the sample serial console log:
As can be clearly seen in
the short filename composed to lookup the file by was wrong (and presumably pretty much random), which didn't match the actual short name of a file and thus selecting a file failed.