Fix up the inventory path
Change how the inventory path is initialized. This should allow for the
call out to result in the correct LED(s) activating when a fault is
committed. This also allows for the elimination of some redundant
variable setup for other parts of the code that use the inventory path.
Change-Id: Iac54fb8dbd8f6eed2808e7731403dc17191db10c
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index 41dc9b6..dc4b21d 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -48,7 +48,8 @@
std::chrono::seconds& t,
std::chrono::seconds& p)
: Device(name, inst), monitorPath(objpath), pmbusIntf(objpath),
- inventoryPath(invpath), bus(bus), event(e), presentInterval(p),
+ inventoryPath(INVENTORY_OBJ_PATH + invpath), bus(bus), event(e),
+ presentInterval(p),
presentTimer(e, [this]()
{
this->present = true;
@@ -60,10 +61,9 @@
})
{
using namespace sdbusplus::bus;
- auto present_obj_path = INVENTORY_OBJ_PATH + inventoryPath;
presentMatch = std::make_unique<match_t>(bus,
match::rules::propertiesChanged(
- present_obj_path,
+ inventoryPath,
INVENTORY_INTERFACE),
[this](auto& msg)
{
@@ -177,11 +177,9 @@
void PowerSupply::updatePresence()
{
// Use getProperty utility function to get presence status.
- std::string path = INVENTORY_OBJ_PATH + inventoryPath;
std::string service = "xyz.openbmc_project.Inventory.Manager";
-
- util::getProperty(INVENTORY_INTERFACE, PRESENT_PROP, path,service, bus,
- this->present);
+ util::getProperty(INVENTORY_INTERFACE, PRESENT_PROP, inventoryPath,
+ service, bus, this->present);
}
void PowerSupply::powerStateChanged(sdbusplus::message::message& msg)