always update sd state file in blocking manner
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
2023-03-10 02:45:21 +01:00
parent fae83a0fca
commit 677a3f95bd
3 changed files with 14 additions and 11 deletions

View File

@ -405,14 +405,14 @@ ReturnValue_t SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
return scratch::writeNumber(scratch::PREFERED_SDC_KEY, static_cast<uint8_t>(sdCard));
}
ReturnValue_t SdCardManager::updateSdCardStateFile(bool blocking) {
ReturnValue_t SdCardManager::updateSdCardStateFile() {
if (cmdExecutor.getCurrentState() == CommandExecutor::States::PENDING) {
return CommandExecutor::COMMAND_PENDING;
}
MutexGuard mg(sdLock, LOCK_TYPE, SD_LOCK_TIMEOUT, LOCK_CTX);
// Use q7hw utility and pipe the command output into the state file
std::string updateCmd = "q7hw sd info all > " + std::string(SD_STATE_FILE);
cmdExecutor.load(updateCmd, blocking, printCmdOutput);
cmdExecutor.load(updateCmd, true, printCmdOutput);
ReturnValue_t result = cmdExecutor.execute();
if (blocking and result != returnvalue::OK) {
utility::handleSystemError(cmdExecutor.getLastError(), "SdCardManager::mountSdCard");

View File

@ -125,7 +125,7 @@ class SdCardManager : public SystemObject, public SdCardMountedIF {
* - CommandExecutor::COMMAND_PENDING: Non-blocking command is pending
* - returnvalue::FAILED: blocking command failed
*/
ReturnValue_t updateSdCardStateFile(bool blocking);
ReturnValue_t updateSdCardStateFile();
/**
* Get the state of the SD cards. If the state file does not exist, this function will