summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--writefrudata.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/writefrudata.cpp b/writefrudata.cpp
index b36de7e..e090903 100644
--- a/writefrudata.cpp
+++ b/writefrudata.cpp
@@ -13,6 +13,7 @@
#include <fstream>
#include <sstream>
#include <mapper.h>
+#include "types.hpp"
#include "frup.hpp"
#include "fru-area.hpp"
#include <sdbusplus/server.hpp>
@@ -21,21 +22,10 @@
const char *sys_object_name = "/org/openbmc/managers/System";
const char *sys_intf_name = "org.openbmc.managers.System";
-extern const FruMap frus;
-
-using Property = std::string;
-using Value = sdbusplus::message::variant<bool, int64_t, std::string>;
-// Association between property and its value
-using PropertyMap = std::map<Property, Value>;
-
-using Interface = std::string;
-// Association between interface and the dbus property
-using InterfaceMap = std::map<Interface, PropertyMap>;
+using namespace ipmi::vpd;
-using Object = sdbusplus::message::object_path;
-
-// Association between object and the interfaces.
-using ObjectMap = std::map<Object, InterfaceMap>;
+extern const FruMap frus;
+extern const std::map<Path, InterfaceMap> extras;
//----------------------------------------------------------------
// Constructor
@@ -518,6 +508,7 @@ int ipmi_update_inventory(fru_area_vec_t& area_vec)
for (auto& instance : instanceList)
{
InterfaceMap interfaces;
+ const auto& extrasIter = extras.find(instance.first);
for (auto& interfaceList : instance.second)
{
@@ -558,11 +549,36 @@ int ipmi_update_inventory(fru_area_vec_t& area_vec)
}
props.emplace(std::move(properties.first), std::move(value));
}
- interfaces.emplace(std::move(interfaceList.first), std::move(props));
+ // Check and update extra properties
+ if(extras.end() != extrasIter)
+ {
+ const auto& propsIter =
+ (extrasIter->second).find(interfaceList.first);
+ if((extrasIter->second).end() != propsIter)
+ {
+ for(const auto& map : propsIter->second)
+ {
+ props.emplace(map.first, map.second);
+ }
+ }
+ }
+ interfaces.emplace(std::move(interfaceList.first),
+ std::move(props));
}
- //Call the inventory manager
+ // Call the inventory manager
sdbusplus::message::object_path path = instance.first;
+ // Check and update extra properties
+ if(extras.end() != extrasIter)
+ {
+ for(const auto& entry : extrasIter->second)
+ {
+ if(interfaces.end() == interfaces.find(entry.first))
+ {
+ interfaces.emplace(entry.first, entry.second);
+ }
+ }
+ }
objects.emplace(path,interfaces);
}
OpenPOWER on IntegriCloud