From 390390ec37d01c3f0ae0af7c489d36ac1e84fbe1 Mon Sep 17 00:00:00 2001 From: Terence Stenvold Date: Fri, 19 Jul 2024 12:38:44 +0200 Subject: [PATCH] extmod/vfs_fat: Set default volume label on mkfs if it's defined. Using mkfs doesn't set a volume label for FAT filesystems. This commit will set the volume label if `MICROPY_HW_FLASH_FS_LABEL` is defined. --- extmod/vfs_fat.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 4f01432f5..ee1169b8c 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -114,6 +114,11 @@ static mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) { mp_raise_OSError(fresult_to_errno_table[res]); } + // set the filesystem label if it's configured + #ifdef MICROPY_HW_FLASH_FS_LABEL + f_setlabel(&vfs->fatfs, MICROPY_HW_FLASH_FS_LABEL); + #endif + return mp_const_none; } static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_mkfs_fun_obj, fat_vfs_mkfs);