diff options
author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2019-03-25 11:20:54 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-03-26 17:15:23 +1100 |
commit | 74d07469f276aff862a99423ded03f08ec5006b3 (patch) | |
tree | 05daad839685d50730fab5265c6a796686a14703 /extmod/vfs_fat.c | |
parent | d396a7e10d69f9490ca3aaa0b2ca147223f20314 (diff) |
extmod/vfs_fat: Fallback to FAT32 if standard FAT16/SFD format fails.
This allows formatting SD cards, larger flash etc which do not support the
default FAT16/SFD format mode.
Diffstat (limited to 'extmod/vfs_fat.c')
-rw-r--r-- | extmod/vfs_fat.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 024cecfe9..ec7aaed38 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -113,6 +113,9 @@ STATIC mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) { // make the filesystem uint8_t working_buf[FF_MAX_SS]; FRESULT res = f_mkfs(&vfs->fatfs, FM_FAT | FM_SFD, 0, working_buf, sizeof(working_buf)); + if (res == FR_MKFS_ABORTED) { // Probably doesn't support FAT16 + res = f_mkfs(&vfs->fatfs, FM_FAT32, 0, working_buf, sizeof(working_buf)); + } if (res != FR_OK) { mp_raise_OSError(fresult_to_errno_table[res]); } |