psu-ng: Add method to get PSU conf from D-Bus.
Add a getPSUProperties method that will get the power supply unit
configuration information from the D-Bus properties populated by
entity-manager. The IBM common form factor power supplies will have
these properties under the interface called
xyz.openbmc_project.Configuration.IBMCFFPSConnector. See
I45b724238cffe6fb7f1f8f9947fa1c2c9e9e8015 for changes to add the
necessary updates to entity-manager.
The D-Bus property for I2CAddress is a uint64_t type, while the JSON
configuration file had a string. Move the PowerSupply constructor to the
cpp file, updated to take in uint16_t for the i2caddr.
Update PSUManager::getJSONProperties() to convert Address from string to
uint16_t.
Add in a PSUManager constructor to use the getPSUProperties() function.
Add code to handle interfacesAdded from entity-manager prior to
getPSUProperties() or getSystemProperties().
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Change-Id: I553e8982cf008828823cea2c0f017ff23c9070ab
diff --git a/phosphor-power-supply/power_supply.hpp b/phosphor-power-supply/power_supply.hpp
index 24d1df8..fc41635 100644
--- a/phosphor-power-supply/power_supply.hpp
+++ b/phosphor-power-supply/power_supply.hpp
@@ -52,32 +52,7 @@
* @param[in] i2caddr - The 16-bit I2C address of the power supply
*/
PowerSupply(sdbusplus::bus::bus& bus, const std::string& invpath,
- std::uint8_t i2cbus, const std::string& i2caddr) :
- bus(bus),
- inventoryPath(invpath),
- pmbusIntf(phosphor::pmbus::createPMBus(i2cbus, i2caddr))
- {
- if (inventoryPath.empty())
- {
- throw std::invalid_argument{"Invalid empty inventoryPath"};
- }
-
- // Setup the functions to call when the D-Bus inventory path for the
- // Present property changes.
- presentMatch = std::make_unique<sdbusplus::bus::match_t>(
- bus,
- sdbusplus::bus::match::rules::propertiesChanged(inventoryPath,
- INVENTORY_IFACE),
- [this](auto& msg) { this->inventoryChanged(msg); });
- presentAddedMatch = std::make_unique<sdbusplus::bus::match_t>(
- bus,
- sdbusplus::bus::match::rules::interfacesAdded() +
- sdbusplus::bus::match::rules::argNpath(0, inventoryPath),
- std::bind(&PowerSupply::inventoryAdded, this,
- std::placeholders::_1));
- // Get the current state of the Present property.
- updatePresence();
- }
+ std::uint8_t i2cbus, const std::uint16_t i2caddr);
phosphor::pmbus::PMBusBase& getPMBus()
{