added docs and improvements

This commit is contained in:
2021-07-12 11:47:23 +02:00
committed by Robin Mueller
parent 4fc56417bc
commit 658e9a4907
2 changed files with 21 additions and 7 deletions

View File

@ -117,12 +117,12 @@ ReturnValue_t SdCardManager::setSdCardState(sd::SdCard sdCard, bool on) {
ReturnValue_t SdCardManager::sdCardActive(std::pair<sd::SdStatus, sd::SdStatus>& active) {
using namespace std;
if(not filesystem::exists("/tmp/sd_status.txt")) {
if(not filesystem::exists(SD_STATE_FILE)) {
return STATUS_FILE_NEXISTS;
}
// Now the file should exist in any case. Still check whether it exists.
fstream sdStatus("/tmp/sd_status.txt");
fstream sdStatus(SD_STATE_FILE);
if (not sdStatus.good()) {
return STATUS_FILE_NEXISTS;
}
@ -261,7 +261,9 @@ void SdCardManager::setPreferredSdCard(sd::SdCard sdCard) {
}
ReturnValue_t SdCardManager::updateSdCardStateFile() {
int result = std::system("q7hw sd info all > /tmp/sd_status.txt");
// Use q7hw utility and pipe the command output into the state file
std::string updateCmd = "q7hw sd info all > " + SD_STATE_FILE;
int result = std::system(updateCmd.c_str());
if(result == 0) {
return HasReturnvaluesIF::RETURN_OK;
}