summaryrefslogtreecommitdiffstats
path: root/log_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'log_manager.cpp')
-rw-r--r--log_manager.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/log_manager.cpp b/log_manager.cpp
index 6717a7a..641ed7b 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -446,6 +446,31 @@ void Manager::journalSync()
return;
}
+std::string Manager::readFWVersion()
+{
+ std::string version;
+ std::ifstream versionFile{BMC_VERSION_FILE};
+ std::string line;
+ static constexpr auto VERSION_ID = "VERSION_ID=";
+
+ while (std::getline(versionFile, line))
+ {
+ if (line.find(VERSION_ID) != std::string::npos)
+ {
+ auto pos = line.find_first_of('"') + 1;
+ version = line.substr(pos, line.find_last_of('"') - pos);
+ break;
+ }
+ }
+
+ if (version.empty())
+ {
+ log<level::ERR>("Unable to read BMC firmware version");
+ }
+
+ return version;
+}
+
} // namespace internal
} // namespace logging
} // namepsace phosphor
OpenPOWER on IntegriCloud