appcommands: support multi-host set/get fw version
Support multi-host set/get fw version in IPMI set/get system info command
Test case:
Get bios version from different host success.
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>
Change-Id: Id2e1598bbe8f7d834fe3c31710384a7dbbe537e0
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index 9a718b7..19adbe8 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -795,7 +795,7 @@
return 0;
}
-static int getBiosVer(std::string& ver)
+static int getBiosVer(std::string& ver, size_t hostPosition)
{
nlohmann::json appObj;
@@ -804,9 +804,11 @@
{
file >> appObj;
file.close();
- if (appObj.find(KEY_SYSFW_VER) != appObj.end())
+ std::string version_key = KEY_SYSFW_VER + std::to_string(hostPosition);
+
+ if (appObj.find(version_key) != appObj.end())
{
- ver = appObj[KEY_SYSFW_VER].get<std::string>();
+ ver = appObj[version_key].get<std::string>();
return 0;
}
}
@@ -1025,7 +1027,7 @@
{
// BIOS ver
std::string biosVer;
- if (getBiosVer(biosVer) == 0)
+ if (getBiosVer(biosVer, hostPosition) == 0)
{
frame_info.append("BIOS_FW_ver:", 0);
frame_info.append(biosVer.c_str(), 1);