core ctrl provides more info on reboot
This commit is contained in:
parent
1c74d39faf
commit
db3a4955c2
@ -171,6 +171,8 @@ ReturnValue_t CoreController::initialize() {
|
|||||||
sdStateMachine();
|
sdStateMachine();
|
||||||
|
|
||||||
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
|
triggerEvent(core::REBOOT_SW, CURRENT_CHIP, CURRENT_COPY);
|
||||||
|
announceCurrentImageInfo();
|
||||||
|
announceVersionInfo();
|
||||||
EventManagerIF *eventManager =
|
EventManagerIF *eventManager =
|
||||||
ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||||
if (eventManager == nullptr or eventQueue == nullptr) {
|
if (eventManager == nullptr or eventQueue == nullptr) {
|
||||||
@ -220,24 +222,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
|||||||
using namespace core;
|
using namespace core;
|
||||||
switch (actionId) {
|
switch (actionId) {
|
||||||
case (ANNOUNCE_VERSION): {
|
case (ANNOUNCE_VERSION): {
|
||||||
uint32_t p1 = (common::OBSW_VERSION_MAJOR << 24) | (common::OBSW_VERSION_MINOR << 16) |
|
announceVersionInfo();
|
||||||
(common::OBSW_VERSION_REVISION << 8);
|
|
||||||
uint32_t p2 = 0;
|
|
||||||
if (strcmp("", common::OBSW_VERSION_CST_GIT_SHA1) != 0) {
|
|
||||||
p1 |= 1;
|
|
||||||
auto shaAsStr = std::string(common::OBSW_VERSION_CST_GIT_SHA1);
|
|
||||||
size_t posDash = shaAsStr.find("-");
|
|
||||||
auto gitHash = shaAsStr.substr(posDash + 2, 4);
|
|
||||||
// Only copy first 4 letters of git hash
|
|
||||||
memcpy(&p2, gitHash.c_str(), 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
triggerEvent(VERSION_INFO, p1, p2);
|
|
||||||
if (mappedSysRomAddr != nullptr) {
|
|
||||||
uint32_t p1Firmware = *(reinterpret_cast<uint32_t *>(mappedSysRomAddr));
|
|
||||||
uint32_t p2Firmware = *(reinterpret_cast<uint32_t *>(mappedSysRomAddr) + 1);
|
|
||||||
triggerEvent(FIRMWARE_INFO, p1Firmware, p2Firmware);
|
|
||||||
}
|
|
||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return HasActionsIF::EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case (ANNOUNCE_BOOT_COUNTS): {
|
case (ANNOUNCE_BOOT_COUNTS): {
|
||||||
@ -245,7 +230,7 @@ ReturnValue_t CoreController::executeAction(ActionId_t actionId, MessageQueueId_
|
|||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return HasActionsIF::EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case (ANNOUNCE_CURRENT_IMAGE): {
|
case (ANNOUNCE_CURRENT_IMAGE): {
|
||||||
triggerEvent(CURRENT_IMAGE_INFO, CURRENT_CHIP, CURRENT_COPY);
|
announceCurrentImageInfo();
|
||||||
return HasActionsIF::EXECUTION_FINISHED;
|
return HasActionsIF::EXECUTION_FINISHED;
|
||||||
}
|
}
|
||||||
case (LIST_DIRECTORY_INTO_FILE): {
|
case (LIST_DIRECTORY_INTO_FILE): {
|
||||||
@ -2420,6 +2405,32 @@ void CoreController::dirListingDumpHandler() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CoreController::announceVersionInfo() {
|
||||||
|
using namespace core;
|
||||||
|
uint32_t p1 = (common::OBSW_VERSION_MAJOR << 24) | (common::OBSW_VERSION_MINOR << 16) |
|
||||||
|
(common::OBSW_VERSION_REVISION << 8);
|
||||||
|
uint32_t p2 = 0;
|
||||||
|
if (strcmp("", common::OBSW_VERSION_CST_GIT_SHA1) != 0) {
|
||||||
|
p1 |= 1;
|
||||||
|
auto shaAsStr = std::string(common::OBSW_VERSION_CST_GIT_SHA1);
|
||||||
|
size_t posDash = shaAsStr.find("-");
|
||||||
|
auto gitHash = shaAsStr.substr(posDash + 2, 4);
|
||||||
|
// Only copy first 4 letters of git hash
|
||||||
|
memcpy(&p2, gitHash.c_str(), 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
triggerEvent(VERSION_INFO, p1, p2);
|
||||||
|
if (mappedSysRomAddr != nullptr) {
|
||||||
|
uint32_t p1Firmware = *(reinterpret_cast<uint32_t *>(mappedSysRomAddr));
|
||||||
|
uint32_t p2Firmware = *(reinterpret_cast<uint32_t *>(mappedSysRomAddr) + 1);
|
||||||
|
triggerEvent(FIRMWARE_INFO, p1Firmware, p2Firmware);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoreController::announceCurrentImageInfo() {
|
||||||
|
triggerEvent(CURRENT_IMAGE_INFO, CURRENT_CHIP, CURRENT_COPY);
|
||||||
|
}
|
||||||
|
|
||||||
bool CoreController::isNumber(const std::string &s) {
|
bool CoreController::isNumber(const std::string &s) {
|
||||||
return !s.empty() && std::find_if(s.begin(), s.end(),
|
return !s.empty() && std::find_if(s.begin(), s.end(),
|
||||||
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
|
[](unsigned char c) { return !std::isdigit(c); }) == s.end();
|
||||||
|
@ -289,6 +289,8 @@ class CoreController : public ExtendedControllerBase, public ReceivesParameterMe
|
|||||||
bool parseRebootFile(std::string path, RebootFile& file);
|
bool parseRebootFile(std::string path, RebootFile& file);
|
||||||
void rewriteRebootFile(RebootFile file);
|
void rewriteRebootFile(RebootFile file);
|
||||||
void announceBootCounts();
|
void announceBootCounts();
|
||||||
|
void announceVersionInfo();
|
||||||
|
void announceCurrentImageInfo();
|
||||||
void readHkData();
|
void readHkData();
|
||||||
void dirListingDumpHandler();
|
void dirListingDumpHandler();
|
||||||
bool isNumber(const std::string& s);
|
bool isNumber(const std::string& s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user