From d419e31296ea1e20791e0a4636d1b153a51c0296 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Jul 2021 18:20:01 +0200 Subject: [PATCH 1/2] fixes for file system --- bsp_q7s/core/CoreController.cpp | 27 +++++++++++++++++++++------ bsp_q7s/memory/SdCardManager.cpp | 5 +++++ linux/utility/utility.cpp | 4 +++- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/bsp_q7s/core/CoreController.cpp b/bsp_q7s/core/CoreController.cpp index 2f48fe2d..55cd0252 100644 --- a/bsp_q7s/core/CoreController.cpp +++ b/bsp_q7s/core/CoreController.cpp @@ -6,6 +6,8 @@ #include "../memory/scratchApi.h" #include "../memory/SdCardManager.h" +#include + CoreController::CoreController(object_id_t objectId): ExtendedControllerBase(objectId, objects::NO_OBJECT, 5) { } @@ -27,10 +29,18 @@ LocalPoolDataSetBase* CoreController::getDataSetHandle(sid_t sid) { } ReturnValue_t CoreController::initialize() { - ReturnValue_t result = sdCardInit(); - if(result != HasReturnvaluesIF::RETURN_OK) { - sif::warning << "CoreController::initialize: SD card init failed" << std::endl; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + try { + result = sdCardInit(); + if(result != HasReturnvaluesIF::RETURN_OK) { + sif::warning << "CoreController::initialize: SD card init failed" << std::endl; + } } + catch(const std::filesystem::filesystem_error& e) { + sif::error << "CoreController::initialize: sdCardInit failed with exception " << e.what() + << std::endl; + } + result = scratch::writeNumber(scratch::ALLOC_FAILURE_COUNT, 0); if(result != HasReturnvaluesIF::RETURN_OK) { sif::warning << "CoreController::initialize: Setting up alloc failure " @@ -103,9 +113,14 @@ ReturnValue_t CoreController::sdCardSetup(SdCardManager& sdcMan, return sdcMan.mountSdCard(sdCard); } else { - sif::info << "SD card " << sdString << " already on and mounted at " << - mountString << std::endl; - return SdCardManager::ALREADY_MOUNTED; + if(std::filesystem::exists(mountString)) { + sif::info << "SD card " << sdString << " already on and mounted at " << + mountString << std::endl; + return SdCardManager::ALREADY_MOUNTED; + } + sif::error << "SD card mounted but expected mount point " << mountString << " not found!" + << std::endl; + return SdCardManager::MOUNT_ERROR; } } diff --git a/bsp_q7s/memory/SdCardManager.cpp b/bsp_q7s/memory/SdCardManager.cpp index d24f540d..3dfa0b10 100644 --- a/bsp_q7s/memory/SdCardManager.cpp +++ b/bsp_q7s/memory/SdCardManager.cpp @@ -218,6 +218,11 @@ ReturnValue_t SdCardManager::unmountSdCard(sd::SdCard sdCard) { else if(sdCard == sd::SdCard::SLOT_1) { mountPoint = SD_1_MOUNT_POINT; } + if(not filesystem::exists(mountPoint)) { + sif::error << "SdCardManager::unmountSdCard: Default mount point " << mountPoint << + "does not exist" << std::endl; + return UNMOUNT_ERROR; + } if(filesystem::is_empty(mountPoint)) { // The mount point will always exist, but if it is empty, that is strong hint that // the SD card was not mounted properly. Still proceed with operation. diff --git a/linux/utility/utility.cpp b/linux/utility/utility.cpp index 69a3d08f..1d6ec5c0 100644 --- a/linux/utility/utility.cpp +++ b/linux/utility/utility.cpp @@ -3,9 +3,11 @@ #include "utility.h" #include "fsfw/serviceinterface/ServiceInterface.h" +#include void utility::handleSystemError(int retcode, std::string function) { #if OBSW_VERBOSE_LEVEL >= 1 - sif::warning << function << ": System call failed with code " << retcode; + sif::warning << function << ": System call failed with code " << retcode << ": " << + strerror(retcode) << std::endl; #endif } From 1cc6a52a3a4fa3dc66b7bca898542ada7d6f2ac8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 23 Jul 2021 18:22:50 +0200 Subject: [PATCH 2/2] deleted fsfw_hal --- fsfw_hal | 1 - 1 file changed, 1 deletion(-) delete mode 160000 fsfw_hal diff --git a/fsfw_hal b/fsfw_hal deleted file mode 160000 index ecc445af..00000000 --- a/fsfw_hal +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ecc445afa7b027f2c7f059e941862119bd6f3764