Commit Graph
7 Commits
Author SHA1 Message Date
Adam Múdry 033405abb6 fix(fatfs): fix formatting in relevant python files to satisfy pre-commit check 2026-04-13 15:59:49 +02:00
Adam Múdry abea28451f fix(fatfs): fix a bug in SFN generation from LFN and rewrite to match C algorithm
Rewrite build_lfn_short_entry_name() and add _gen_numname_suffix() helper
to match the gen_numname() algorithm in ff.c. This fixes:

- chr(order) producing raw binary instead of ASCII digits
- Collision for order >= 10 when str(order) makes the name exceed 8 chars
- Hex suffix with dynamic stem shortening (matching C implementation)
- CRC16-CCITT hash for seq > 5 to reduce collision probability

Also fix LDIR_Name2_SIZE typo in long_filename_utils.py (should be
LDIR_Name3_SIZE), which made the assertion guard too permissive.

Add ShortFilenameGenerationTestCase with 9 unit tests covering single-digit,
multi-digit, hash-based, and collision-free generation scenarios.
2026-04-13 15:59:48 +02:00
Martin Gaňo b187fad076 fatfsgen.py: Increase number of files in directory
By starting the ID at the value 1, instead of ord('1') we increase the possible number of files by 49.
2022-09-21 13:30:05 +00:00
Martin Gaňo 53c2ea2d08 fatfsgen.py: enable multiple dots in the long file name 2022-09-16 13:50:12 +02:00
Martin Gaňo 131b28314e fatfsgen.py: fixed missing NULL terminator 2022-09-14 16:55:13 +02:00
Martin Gaňo 0f160c8f11 fatfs: enable long file names for fatfsparse.py 2022-06-09 15:51:03 +02:00
Martin Gano 8ef66536ed fatfsparse.py: add cluster chaining support to enable reading longer-than-sector files
Closes IDF-4975
2022-05-25 15:49:24 +02:00