bmc: implement search for json files
Tested: Verified it prints out the blobs expected.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I1ba6af8b2ca066e6eb1699cb4214ce32f148005d
diff --git a/bmc/main.cpp b/bmc/main.cpp
index d22348d..2120107 100644
--- a/bmc/main.cpp
+++ b/bmc/main.cpp
@@ -16,6 +16,7 @@
#include "config.h"
+#include "buildjson.hpp"
#include "file_handler.hpp"
#include "firmware_handler.hpp"
#include "flags.hpp"
@@ -34,16 +35,22 @@
#include <memory>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
+#include <string>
#include <unordered_map>
+#include <vector>
namespace ipmi_flash
{
+
namespace
{
/* The maximum external buffer size we expect is 64KB. */
static constexpr std::size_t memoryRegionSize = 64 * 1024UL;
+static constexpr const char* jsonConfigurationPath =
+ "/usr/share/phosphor-ipmi-flash/";
+
#ifdef ENABLE_LPC_BRIDGE
#if defined(ASPEED_LPC)
LpcDataHandler lpcDataHandler(
@@ -96,6 +103,17 @@
std::unique_ptr<blobs::GenericBlobInterface> createHandler()
{
+ /* NOTE: This is unused presently. */
+ {
+ std::vector<ipmi_flash::HandlerConfig> configsFromJson =
+ ipmi_flash::BuildHandlerConfigs(ipmi_flash::jsonConfigurationPath);
+
+ for (const auto& config : configsFromJson)
+ {
+ std::fprintf(stderr, "config loaded: %s\n", config.blobId.c_str());
+ }
+ }
+
ipmi_flash::ActionMap actionPacks = {};
{