From 4887dc9e6b13c2977366526d2e59fb5aa97ba2f6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 May 2023 16:58:56 +0200 Subject: [PATCH] somethings still wrong --- linux/payload/PlocMpsocHandler.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/linux/payload/PlocMpsocHandler.cpp b/linux/payload/PlocMpsocHandler.cpp index 8a00e307..86589d21 100644 --- a/linux/payload/PlocMpsocHandler.cpp +++ b/linux/payload/PlocMpsocHandler.cpp @@ -360,7 +360,6 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain DeviceCommandId_t* foundId, size_t* foundLen) { ReturnValue_t result = returnvalue::OK; - sif::debug << "remainingSize: " << remainingSize << std::endl; SpacePacketReader spacePacket; spacePacket.setReadOnlyData(start, remainingSize); if (spacePacket.isNull()) { @@ -379,6 +378,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain }; switch (apid) { case (mpsoc::apid::ACK_SUCCESS): + sif::debug << "recv ack" << std::endl; *foundLen = mpsoc::SIZE_ACK_REPORT; *foundId = mpsoc::ACK_REPORT; break; @@ -394,6 +394,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain handleDedicatedReply(mpsoc::TM_CAM_CMD_RPT); break; case (mpsoc::apid::TM_HK_GET_REPORT): { + sif::debug << "recv hk report" << std::endl; handleDedicatedReply(mpsoc::TM_GET_HK_REPORT); break; } @@ -402,6 +403,7 @@ ReturnValue_t PlocMPSoCHandler::scanForReply(const uint8_t* start, size_t remain break; } case (mpsoc::apid::EXE_SUCCESS): + sif::debug << "recv exe" << std::endl; *foundLen = mpsoc::SIZE_EXE_REPORT; *foundId = mpsoc::EXE_REPORT; break; @@ -802,17 +804,22 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) { uint16_t apid = (*(data) << 8 | *(data + 1)) & APID_MASK; + auto cmdDoneHandler = [&]() { + if (normalCmdPending) { + normalCmdPending = false; + } + auto commandIter = deviceCommandMap.find(getPendingCommand()); + if (commandIter != deviceCommandMap.end()) { + commandIter->second.isExecuting = false; + } + disableAllReplies(); + }; switch (apid) { case (mpsoc::apid::EXE_SUCCESS): { - if (normalCmdPending) { - normalCmdPending = false; - } + cmdDoneHandler(); break; } case (mpsoc::apid::EXE_FAILURE): { - if (normalCmdPending) { - normalCmdPending = false; - } // TODO: Interpretation of status field in execution report sif::warning << "PlocMPSoCHandler::handleExecutionReport: Received execution failure report" << std::endl; @@ -825,8 +832,8 @@ ReturnValue_t PlocMPSoCHandler::handleExecutionReport(const uint8_t* data) { } printStatus(data); sendFailureReport(mpsoc::EXE_REPORT, MPSoCReturnValuesIF::RECEIVED_EXE_FAILURE); - disableExeReportReply(); result = IGNORE_REPLY_DATA; + cmdDoneHandler(); break; } default: {