From 112983611299ec1b7018f8eb70d9aff5e9e8177c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Feb 2023 01:40:27 +0100 Subject: [PATCH] that should fix the issue --- bsp_q7s/fs/SdCardManager.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/bsp_q7s/fs/SdCardManager.cpp b/bsp_q7s/fs/SdCardManager.cpp index 9e5d05bc..f8da9bee 100644 --- a/bsp_q7s/fs/SdCardManager.cpp +++ b/bsp_q7s/fs/SdCardManager.cpp @@ -508,9 +508,9 @@ bool SdCardManager::isSdCardUsable(std::optional sdCard) { ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& readOnly) { std::ostringstream command; if (sdcard == sd::SdCard::SLOT_0) { - command << "grep -q '" << config::SD_0_MOUNT_POINT << " ext4 ro,' /proc/mounts"; + command << "grep -q '" << config::SD_0_MOUNT_POINT << " ext4 rw,' /proc/mounts"; } else if (sdcard == sd::SdCard::SLOT_1) { - command << "grep -q '" << config::SD_1_MOUNT_POINT << " ext4 ro,' /proc/mounts"; + command << "grep -q '" << config::SD_1_MOUNT_POINT << " ext4 rw,' /proc/mounts"; } else { return returnvalue::FAILED; } @@ -519,18 +519,9 @@ ReturnValue_t SdCardManager::isSdCardMountedReadOnly(sd::SdCard sdcard, bool& re return result; } result = cmdExecutor.execute(); - if (result != returnvalue::OK) { - int exitStatus = cmdExecutor.getLastError(); - if (exitStatus == 1) { - readOnly = false; - return returnvalue::OK; - } - return result; - } - auto& readVec = cmdExecutor.getReadVector(); - size_t readLen = strnlen(readVec.data(), readVec.size()); - if (readLen == 0) { + if (result == returnvalue::OK) { readOnly = false; + return result; } readOnly = true; return returnvalue::OK;