Make Fru Device publish uint on dbus for BUS
Make BUS and ADRESS both uin32_t instead of string as
that logically makes more sense.
Change-Id: Ia35cbc8bdc65bc98ad004517260c2253172cf7fe
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index c237346..1755e46 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -840,26 +840,22 @@
}
else
{
- std::string substitute;
+ bool found = false;
for (auto &foundDevicePair : foundDevice)
{
if (boost::iequals(foundDevicePair.first, templateValue))
{
- // convert value to string
- // respresentation
- subsitute = mapbox::util::apply_visitor(
- VariantToStringVisitor(), foundDevicePair.second);
+ mapbox::util::apply_visitor(
+ [&](auto &&val) { keyPair.value() = val; },
+ foundDevicePair.second);
+ found = true;
break;
}
}
- if (!substitute.size())
+ if (!found)
{
std::cerr << "could not find symbol " << templateValue << "\n";
}
- else
- {
- keyPair.value() = substitute;
- }
}
}
}
diff --git a/src/FruDevice.cpp b/src/FruDevice.cpp
index 614bf91..2a89c08 100644
--- a/src/FruDevice.cpp
+++ b/src/FruDevice.cpp
@@ -379,7 +379,7 @@
boost::container::flat_map<std::pair<size_t, size_t>,
std::shared_ptr<sdbusplus::asio::dbus_interface>>
&dbusInterfaceMap,
- int bus, size_t address)
+ uint32_t bus, uint32_t address)
{
boost::container::flat_map<std::string, std::string> formattedFru;
if (!formatFru(device, formattedFru))
@@ -460,12 +460,8 @@
}
// baseboard will be 0, 0
- std::stringstream data;
- data << "0x" << std::hex << bus;
- iface->register_property("BUS", data.str());
- data.str("");
- data << "0x" << std::hex << address;
- iface->register_property("ADDRESS", data.str());
+ iface->register_property("BUS", bus);
+ iface->register_property("ADDRESS", address);
iface->initialize();
}