Fixed:sd card format bug.

This commit is contained in:
Fancy code 2024-07-22 10:49:44 +08:00
parent cb5c52bae8
commit a56fc1dcdc

View File

@ -65,6 +65,12 @@ StatusCode SdCardHal::GetCapacity(unsigned long long &totalSizeMB, unsigned long
LogInfo("Used size: %llu MB\n", usedSizeMB);
return CreateStatusCode(STATUS_CODE_OK);
}
/**
* @brief To format an SD card, you normally need to unmount the SD card before formatting it. However, when the SD card
* is abnormal (usually it cannot be mounted or unmounted), you still need to execute the format command operation,
* because some cards can be restored to normal by formatting when they are abnormal.
* @return StatusCode
*/
StatusCode SdCardHal::FormatSDCard(void)
{
UnInit();
@ -221,7 +227,7 @@ void SdCardHal::UnmountSdCard(void)
* card node to be occupied and cannot be loaded. To find problems and optimize them, it is especially important to
* check whether there are any omissions.
*/
sprintf(command, "umount -fl %s", SD_CARD_MOUNT_PATH);
sprintf(command, "umount -fl %s", SD_CARD_DEVICE);
int ret = fx_system(command);
if (ret != 0) {
LogError("Format sd card failed [%s].\n", SD_CARD_DEVICE);