Get bios version for debug card request
Reading Bios version stored in app data file and responding to
debug card request.
Tested: Verified in the debug card screen for Bios version.
Change-Id: I697fc75f66427edaeffde9ce567eea7ade325f67
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index ae200ae..d61c9b2 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -23,6 +23,7 @@
#include <fstream>
#include <iostream>
#include <phosphor-logging/log.hpp>
+#include <appcommands.hpp>
namespace ipmi
{
@@ -721,6 +722,25 @@
return 0;
}
+static int getBiosVer(std::string &ver)
+{
+ nlohmann::json appObj;
+
+ std::ifstream file(JSON_APP_DATA_FILE);
+ if (file)
+ {
+ file >> appObj;
+ file.close();
+ if (appObj.find(KEY_SYSFW_VER) != appObj.end())
+ {
+ ver = appObj[KEY_SYSFW_VER].get<std::string>();
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
static int udbg_get_info_page(uint8_t frame, uint8_t page, uint8_t *next,
uint8_t *count, uint8_t *buffer)
{
@@ -781,9 +801,15 @@
}
}
- /* TBD: BIOS ver, ME status and Board ID needs implementation */
// BIOS ver
+ std::string biosVer;
+ if (getBiosVer(biosVer) == 0)
+ {
+ frame_info.append("BIOS_FW_ver:", 0);
+ frame_info.append(biosVer.c_str(), 1);
+ }
+ /* TBD: ME status and Board ID needs implementation */
// ME status
// Board ID