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/configurations/1Ux16 Riser.json b/configurations/1Ux16 Riser.json
index b9f766d..4bb3f99 100644
--- a/configurations/1Ux16 Riser.json
+++ b/configurations/1Ux16 Riser.json
@@ -47,7 +47,7 @@
}
],
"name": "1Ux16 Riser 1",
- "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'F1UL16RISER\\d', 'ADDRESS' : '0x50'})",
+ "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'F1UL16RISER\\d', 'ADDRESS' : 80})",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
"Model": "$BOARD_PRODUCT_NAME",
@@ -103,7 +103,7 @@
}
],
"name": "1Ux16 Riser 2",
- "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'F1UL16RISER\\d', 'ADDRESS' : '0x51'})",
+ "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'F1UL16RISER\\d', 'ADDRESS' : 81})",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
"Model": "$BOARD_PRODUCT_NAME",
diff --git a/configurations/2Ux8 Riser.json b/configurations/2Ux8 Riser.json
index e861607..3516589 100644
--- a/configurations/2Ux8 Riser.json
+++ b/configurations/2Ux8 Riser.json
@@ -47,7 +47,7 @@
}
],
"name": "2Ux8 Riser 1",
- "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'A2UL8RISER1', 'ADDRESS': '0x50'})",
+ "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'A2UL8RISER1', 'ADDRESS': 80})",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
"Model": "$BOARD_PRODUCT_NAME",
@@ -103,7 +103,7 @@
}
],
"name": "2Ux8 Riser 2",
- "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'A2UL8RISER2', 'ADDRESS': '0x51'})",
+ "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'A2UL8RISER2', 'ADDRESS': 81})",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
"Model": "$BOARD_PRODUCT_NAME",
diff --git a/configurations/Delta DPS-750XB PSU.json b/configurations/Delta DPS-750XB PSU.json
index 62639da..485bd1d 100644
--- a/configurations/Delta DPS-750XB PSU.json
+++ b/configurations/Delta DPS-750XB PSU.json
@@ -15,7 +15,7 @@
}
],
"name": "Delta DPS-750XB PSU 2",
- "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'DPS-750XB A', 'ADDRESS': '0x51'})",
+ "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'DPS-750XB A', 'ADDRESS': 81})",
"type": "PowerSupply",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
@@ -40,7 +40,7 @@
}
],
"name": "Delta DPS-750XB PSU 1",
- "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'DPS-750XB A', 'ADDRESS': '0x50'})",
+ "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'DPS-750XB A', 'ADDRESS': 80})",
"type": "PowerSupply",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
diff --git a/configurations/F2U12X35S3P_riser.json b/configurations/F2U12X35S3P_riser.json
index 0c6db3f..188c57c 100644
--- a/configurations/F2U12X35S3P_riser.json
+++ b/configurations/F2U12X35S3P_riser.json
@@ -41,7 +41,7 @@
}
],
"name": "2U12x35 Riser1",
- "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'A2UL16RISER\\d', 'ADDRESS' : '0x50'})",
+ "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'A2UL16RISER\\d', 'ADDRESS' : 80})",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
"Model": "$BOARD_PRODUCT_NAME",
@@ -91,7 +91,7 @@
}
],
"name": "2U12x35 Riser2",
- "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'A2UL16RISER\\d', 'ADDRESS' : '0x51'})",
+ "probe": "xyz.openbmc_project.FruDevice({'BOARD_PRODUCT_NAME': 'A2UL16RISER\\d', 'ADDRESS' : 81})",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
"Model": "$BOARD_PRODUCT_NAME",
diff --git a/configurations/Flextronics S-1100ADU00-201 PSU.json b/configurations/Flextronics S-1100ADU00-201 PSU.json
index 9dd90ff..ebd4c1b 100644
--- a/configurations/Flextronics S-1100ADU00-201 PSU.json
+++ b/configurations/Flextronics S-1100ADU00-201 PSU.json
@@ -15,7 +15,7 @@
}
],
"name": "Flextronics S-1100ADU00-201 PSU 2",
- "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'S-1100ADU00-201', 'ADDRESS': '0x51'})",
+ "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'S-1100ADU00-201', 'ADDRESS': 81})",
"type": "PowerSupply",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
@@ -40,7 +40,7 @@
}
],
"name": "Flextronics S-1100ADU00-201 PSU 1",
- "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'S-1100ADU00-201', 'ADDRESS': '0x50'})",
+ "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'S-1100ADU00-201', 'ADDRESS': 80})",
"type": "PowerSupply",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$BOARD_MANUFACTURER",
diff --git a/configurations/PSSF132202A.json b/configurations/PSSF132202A.json
index 1bcbe8e..83f02bb 100755
--- a/configurations/PSSF132202A.json
+++ b/configurations/PSSF132202A.json
@@ -15,7 +15,7 @@
}
],
"name": "Solum 1300W PSU 2",
- "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'PSSF132202A', 'ADDRESS': '0x51'})",
+ "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'PSSF132202A', 'ADDRESS': 81})",
"type": "PowerSupply",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$PRODUCT_MANUFACTURER",
@@ -40,7 +40,7 @@
}
],
"name": "Solum 1300W PSU 1",
- "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'PSSF132202A', 'ADDRESS': '0x50'})",
+ "probe": "xyz.openbmc_project.FruDevice({'PRODUCT_PRODUCT_NAME': 'PSSF132202A', 'ADDRESS': 80})",
"type": "PowerSupply",
"xyz.openbmc_project.Inventory.Decorator.Asset": {
"Manufacturer": "$PRODUCT_MANUFACTURER",
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();
}