Commit Graph

26 Commits

Author SHA1 Message Date
Adam Múdry
c55b61d99f Merge branch 'fix/python3.14_test_fatfsgen' into 'master'
fix(fatfs): fix operator precedence bug in BootSector.__str__ for Python 3.14 compatibility

Closes IDF-15550

See merge request espressif/esp-idf!47479
2026-04-13 16:08:16 +02:00
Adam Múdry
5867550fb8 fix(fatfs): fix operator precedence bug in BootSector.__str__ for Python 3.14 compatibility
The condition filtering attributes lacked parentheses, causing the
'not startswith(_)' guard to only apply to str attributes. Python 3.14's
new __firstlineno__ (int) class attribute leaked into the output.

Also includes ruff auto-formatting fixes (imports, trailing commas,
union type annotations).
2026-04-09 15:36:43 +02:00
Adam Múdry
d8c30644c7 fix(fatfs): fix formatting in relevant python files to satisfy pre-commit check 2026-04-09 12:56:30 +02:00
Adam Múdry
1d0d45f203 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-09 12:53:43 +02:00
Tomáš Rohlínek
7854b955a1 fix(storage/fatfs): make wl_fatfsgen.py safe mode aware 2024-03-13 12:49:49 +01:00
Adam Múdry
8e50d63fea feat(fatfs): Add an option to use 2 FATs (file allocation tables) in FATFS volumes
Should help with redundancy and data corruption when enabled but uses more space.
2024-01-18 14:03:28 +01:00
radek.tandler
a640626b76 fix(fatfs): Fixed fatfsparse.py parsing of FAT boot sector
The fatfsparse.py script was too strict in parsing the FAT boot sector, causing it to fail in
certain cases. This commit fixes the issue by making the parsing less strict and allowing for more
flexibility in the boot sector format.

This change improves the reliability and compatibility of the fatfsparse.py script, ensuring that it
can correctly parse a wider range of FAT boot sectors.

Docs updated
2023-12-06 08:31:50 +01:00
Martin Gaňo
024b58604a docs: Describe the approach of fatfsgen.py and fatfsparse.py 2023-04-11 09:41:06 +05:30
Martin Gaňo
21408698e1 fatfsgen.py: Support for detection of minimal partition size 2022-09-30 15:20:49 +02:00
Roland Dobai
a38c63b211 Merge branch 'feature/enable-variable-partition-size-fatfs' into 'master'
fatfs: enabled reading sector size and sectors count from boot sector in rawflash

Closes IDF-4130

See merge request espressif/esp-idf!20412
2022-09-30 15:24:26 +08:00
Martin Gaňo
7fb62d41d5 fatfsgen.py: omit cluster allocation when the file is empty 2022-09-29 16:18:56 +02:00
Martin Gaňo
41742c2369 fatfs: enabled reading sector size and sectors count from boot sector in rawflash 2022-09-29 16:16:36 +02:00
Martin Vychodil
e82adaaaf7 Merge branch 'feature/add-test-coverage-with-review' into 'master'
fatfs: add test coverage and comments to the fatfsgen.py related code

Closes IDF-5864

See merge request espressif/esp-idf!19986
2022-09-29 19:17:17 +08:00
Martin Gaňo
943f96422b fatfs: add test coverage and comments to the fatfsgen.py related code 2022-09-27 12:14:32 +02:00
Martin Gaňo
2a0ea8703d fatfsgen.py: enabled 512 sized sectors 2022-09-27 10:18:52 +02:00
Martin Gaňo
567f5f963c fatfsgen.py: use lfn record when forbidden character detected in the file name
The file name is recorded as a LFN when it doesn't fit 8.3 pattern or if it contains characters prohibited in SFN
2022-09-21 15:22:51 +00: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
26f7f105c3 fatfsparse.py: Fixed ignoring first file in directory
Closes IDF-5968
2022-09-15 19:38:39 +02:00
Martin Gaňo
131b28314e fatfsgen.py: fixed missing NULL terminator 2022-09-14 16:55:13 +02:00
Martin Gaňo
37178dfa74 fatfsparse.py: limit the file content size to correct number 2022-09-12 14:13:03 +00:00
Martin Gaňo
2d173c0777 fatfsgen.py: enabled extension of the FAT table
Closes IDF-5688
2022-08-01 20:29:02 +02:00
Martin Gaňo
d56e692f2f fatfsgen.py: Speedup FAT cluster allocation in fatfsgen.py
Closes IDF-5243
2022-07-28 01:37:39 +02:00
Martin Gaňo
2ddcda29b3 fatfsparse.py: Add support for WL 2022-07-26 14:50:07 +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