Skip to content

Commit 804d08c

Browse files
committed
MMC: report mount error
1 parent 72d9398 commit 804d08c

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

firmware/hw_layer/mmc_card.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -577,37 +577,38 @@ static void deinitMmc() {
577577
// Mount the SD card.
578578
// Returns true if the filesystem was successfully mounted for writing.
579579
static bool mountMmc() {
580-
bool ret = false;
580+
FRESULT ret = FR_NOT_READY;
581581

582582
// if no card, don't try to mount FS
583583
if (cardBlockDevice != nullptr) {
584584
// clean shared buffer
585585
memset(&resources, 0x00, sizeof(resources));
586586
// We were able to connect the SD card, mount the filesystem
587587
memset(&MMC_FS, 0, sizeof(FATFS));
588-
ret = (f_mount(&MMC_FS, "", /* Mount immediately */ 1) == FR_OK);
588+
ret = f_mount(&MMC_FS, "", /* Mount immediately */ 1);
589589

590-
if (ret == false) {
590+
if (ret != FR_OK) {
591591
sdStatus = SD_STATUS_MOUNT_FAILED;
592-
efiPrintf("SD card mount failed!");
592+
printFatFsError("Mount failed", ret);
593+
} else {
594+
sdStatus = SD_STATUS_MOUNTED;
595+
efiPrintf("SD card mounted!");
593596
}
594597
}
595598

596-
if (ret) {
597-
sdStatus = SD_STATUS_MOUNTED;
598-
efiPrintf("SD card mounted!");
599-
}
600-
601599
#if EFI_STORAGE_SD == TRUE
602-
// notificate storage subsystem
603-
initStorageSD();
600+
if (ret == FR_OK) {
601+
// notificate storage subsystem
602+
initStorageSD();
603+
}
604604
#endif // EFI_STORAGE_SD
605605

606606
#if EFI_TUNER_STUDIO
607-
engine->outputChannels.sd_logging_internal = ret;
607+
engine->outputChannels.sd_error = (uint8_t) ret;
608+
engine->outputChannels.sd_logging_internal = (ret == FR_OK);
608609
#endif
609610

610-
return ret;
611+
return (ret == FR_OK);
611612
}
612613

613614
/*
@@ -629,6 +630,7 @@ static void unmountMmc() {
629630
}
630631

631632
#if EFI_TUNER_STUDIO
633+
engine->outputChannels.sd_error = (uint8_t) ret;
632634
engine->outputChannels.sd_logging_internal = false;
633635
#endif
634636

0 commit comments

Comments
 (0)