From 68437a8e36e60eac503a1e7e6ed66d8acb74ad5d Mon Sep 17 00:00:00 2001 From: Serhii Kostiuk Date: Thu, 6 Aug 2020 17:49:42 +0300 Subject: Quectel EG25-G Delta Radio Firmware Upgrade support - libmts-io implementation Switched from `sendCommand` with empty command argument to `waitResponse` for URC analysis. Sending empty string to the serial interface is undefined behaviour according to the POSIX standart. More of it, we don't need to execute `write` on file descriptor to wait for URC messages. It was more like a hack than something that was actually required. This commit removes the hack and replaces it with a proper waiting for a response. --- src/MTS_IO_QuectelRadio.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/MTS_IO_QuectelRadio.cpp b/src/MTS_IO_QuectelRadio.cpp index 67a8d71..de36987 100644 --- a/src/MTS_IO_QuectelRadio.cpp +++ b/src/MTS_IO_QuectelRadio.cpp @@ -501,7 +501,7 @@ ICellularRadio::CODE QuectelRadio::startOmaDm(ICellularRadio::UpdateCb& stepCb) } // Wait for the "Start" response - std::string sResponse = sendCommand("", vOdmStartedStrings, iTimeoutStart, 0x00); + std::string sResponse = waitResponse(vOdmStartedStrings, iTimeoutStart); printDebug("%s| Radio returned: [%s]", getName().c_str(), sResponse.c_str()); // Received something unexpected or nothing at all? @@ -517,7 +517,7 @@ ICellularRadio::CODE QuectelRadio::startOmaDm(ICellularRadio::UpdateCb& stepCb) callNextStep(stepCb, "OMA DM Info: OMA DM started"); // Wait for the "End" or "Abnormal" response - sResponse = sendCommand("", vOdmFinishedStrings, iTimeoutEnd, 0x00); + sResponse = waitResponse(vOdmFinishedStrings, iTimeoutEnd); printDebug("%s| Radio returned: [%s]", getName().c_str(), sResponse.c_str()); // Received "Abnormal"? @@ -645,7 +645,7 @@ ICellularRadio::CODE QuectelRadio::fumoLocalApply(ICellularRadio::UpdateCb& step callNextStep(stepCb, "FUMO Info: waiting for the radio to enter recovery mode"); // Wait for new FOTA responses. Exits preliminary if radio detached. - sResponse = sendCommand("", vFotaBailStrings, duDetachTimeout, 0x00); + sResponse = waitResponse(vFotaBailStrings, duDetachTimeout); printTrace("Radio response: [%s]", sResponse.c_str()); if (i == 0 && sResponse.find(sFotaUrcPrefix) != std::string::npos) { @@ -1054,7 +1054,7 @@ ICellularRadio::CODE QuectelRadio::fumoWaitUpgradeFinished(ICellularRadio::Updat std::string sResponse; while (!bFinished) { // breaks on "FOTA","END" - sResponse = sendCommand("", vFotaBailStrings, duUrcTimeout, 0x00); + sResponse = waitResponse(vFotaBailStrings, duUrcTimeout); printTrace("Radio response: [%s]", sResponse.c_str()); if (sResponse.find(sFotaUrcPrefix) == std::string::npos) { -- cgit v1.2.3