now a sd card will always be on
This commit is contained in:
@ -89,30 +89,39 @@ ReturnValue_t SdCardManager::sdCardActive(std::pair<bool, bool>& active) {
|
||||
}
|
||||
string line;
|
||||
uint8_t idx = 0;
|
||||
bool on = false;
|
||||
|
||||
while (std::getline(sdStatus, line)) {
|
||||
istringstream iss(line);
|
||||
string word;
|
||||
sd::SdCard currentSd = sd::SdCard::SLOT_0;
|
||||
while(iss >> word) {
|
||||
if (word == "1:") {
|
||||
currentSd = sd::SdCard::SLOT_1;
|
||||
}
|
||||
|
||||
if(word == "on") {
|
||||
on = true;
|
||||
if(currentSd == sd::SdCard::SLOT_0) {
|
||||
active.first = true;
|
||||
}
|
||||
else {
|
||||
active.second = true;
|
||||
}
|
||||
}
|
||||
else if (word == "off") {
|
||||
on = false;
|
||||
if(currentSd == sd::SdCard::SLOT_0) {
|
||||
active.first = false;
|
||||
}
|
||||
else {
|
||||
active.second = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
if(idx == 0) {
|
||||
active.first = on;
|
||||
}
|
||||
else if(idx == 1) {
|
||||
active.second = on;
|
||||
}
|
||||
else if(idx > 1) {
|
||||
|
||||
if(idx > 3) {
|
||||
sif::warning << "SdCardManager::sdCardActive: Status file has more "
|
||||
"than 2 lines!" << std::endl;
|
||||
"than 4 lines!" << std::endl;
|
||||
return STATUS_FILE_FORMAT_INVALID;
|
||||
}
|
||||
}
|
||||
@ -122,8 +131,7 @@ ReturnValue_t SdCardManager::sdCardActive(std::pair<bool, bool>& active) {
|
||||
}
|
||||
|
||||
sd::SdCard SdCardManager::getPreferredSdCard() const {
|
||||
int result = std::system("xsc_scratch read PREFSD > /tmp/pref_sd.txt");
|
||||
|
||||
//int result = std::system("xsc_scratch read PREFSD > /tmp/pref_sd.txt");
|
||||
return preferredSdCard;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user