Update analyze to check VIN_UV_FAULT
The function is a pure virtual function in DeviceMonitor, add in the
implementation of that for PowerSupply. Read the file that represents
that bit from the STATUS_WORD. If fault is on, report a fault.
Change-Id: I05a4bff997bb0c8b8b71db444e9db0e506765689
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index 4249024..43489d2 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -1,5 +1,6 @@
#pragma once
#include "device.hpp"
+#include "pmbus.hpp"
namespace witherspoon
{
@@ -29,10 +30,14 @@
* @param[in] inst - the device instance
* @param[in] objpath - the path to monitor
* @param[in] invpath - the inventory path to use
+ * @param[in] bus - D-Bus bus object
*/
PowerSupply(const std::string& name, size_t inst,
- const std::string& objpath, const std::string& invpath)
- : Device(name, inst), monitorPath(objpath), inventoryPath(invpath)
+ const std::string& objpath,
+ const std::string& invpath,
+ sdbusplus::bus::bus& bus)
+ : Device(name, inst), monitorPath(objpath), inventoryPath(invpath),
+ bus(bus), pmbusIntf(objpath)
{
}
@@ -65,6 +70,39 @@
* The D-Bus path to use for this power supply's inventory status.
*/
std::string inventoryPath;
+
+ /** @brief Connection for sdbusplus bus */
+ sdbusplus::bus::bus& bus;
+
+ /**
+ * @brief Pointer to the PMBus interface
+ *
+ * Used to read out of or write to the /sysfs tree(s) containing files
+ * that a device driver monitors the PMBus interface to the power
+ * supplies.
+ */
+ witherspoon::pmbus::PMBus pmbusIntf;
+
+ /**
+ * @brief Has a PMBus read failure already been logged?
+ */
+ bool readFailLogged = false;
+
+ /**
+ * @brief Set to true when a VIN UV fault has been detected
+ *
+ * This is the VIN_UV_FAULT bit in the low byte from the STATUS_WORD
+ * command response.
+ */
+ bool vinUVFault = false;
+
+ /**
+ * @brief Set to true when an input fault or warning is detected
+ *
+ * This is the "INPUT FAULT OR WARNING" bit in the high byte from the
+ * STATUS_WORD command response.
+ */
+ bool inputFault = false;
};
}