From 28525b56161e1b659e85e85c33fc00dc397758aa Mon Sep 17 00:00:00 2001 From: Helen Huang Date: Mon, 19 Apr 2021 16:06:15 +0800 Subject: [PATCH] Add logs to fwVersionIsSame() Add logs to fwVersionIsSame() to indicate whether the firmware version is changed or not. Tested: Logs are printed as expected when firmware updating and BMC rebooting. Log of rebooting: The firmware version is similiar as the last boot, Hash value of versionFile is:3336889560 Log of Firmware update: The firmware version is changed since the last boot, hash value of current versionFile is:3336889560, hash value of versionFile of last boot is:834871226 Change-Id: I5306917329d2e2e015af58cad1e9c59881f0b217 Signed-off-by: Helen Huang --- include/Utils.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/Utils.hpp b/include/Utils.hpp index 657af92..8238807 100644 --- a/include/Utils.hpp +++ b/include/Utils.hpp @@ -116,13 +116,22 @@ inline bool fwVersionIsSame(void) if (expectedHash == hashString) { + std::cout << "The firmware version is similiar as the last boot, " + "hash value of versionFile is:" + << hashString.c_str() << "\n"; return true; } + std::cout << "The firmware version is changed since the last boot, hash " + "value of current versionFile is:" + << expectedHash.c_str() + << ", hash value of versionFile of last boot is:" + << hashString.c_str() << "\n"; hashFile.close(); } std::ofstream output(versionHashFile); output << expectedHash; + return false; } -- 2.17.1