psu-ng: Dynamically assign the device driver name
Replaced hardcoded device driver name with a method to build the device
driver name dynamically and assign it to a private data member.
The dynamically built device driver name used during bind/unbind.
Tested the changes in simulation and actual system, compared journalctl
entries of phosphor-psu-monitor with modified phosphor-psu-monitor. The
following test were conducted and verified same journal output:
- Verified driver name assigned correcty to PSU
- Good Machine Path
- Removed Power Supply
- Inserted Power Supply
- Missing Power Supply
Change-Id: Ic376d4ff058e9a2df1887468932faaa28d998960
Signed-off-by: Faisal Awada <faisal@us.ibm.com>
diff --git a/phosphor-power-supply/psu_manager.hpp b/phosphor-power-supply/psu_manager.hpp
index 8acb416..7bee9f7 100644
--- a/phosphor-power-supply/psu_manager.hpp
+++ b/phosphor-power-supply/psu_manager.hpp
@@ -408,6 +408,19 @@
psu->setInputVoltageRating();
}
}
+
+ /**
+ * @brief Build the device driver name for the power supply.
+ *
+ * @param[in] i2cbus - i2c bus
+ * @param[in] i2caddr - i2c bus address
+ */
+ void buildDriverName(uint64_t i2cbus, uint64_t i2caddr);
+
+ /**
+ * @brief The device driver name for all power supplies.
+ */
+ std::string driverName;
};
} // namespace phosphor::power::manager