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/main.cpp b/power-supply/main.cpp
index eb3f9ed..e36bd24 100644
--- a/power-supply/main.cpp
+++ b/power-supply/main.cpp
@@ -56,13 +56,16 @@
return -4;
}
+ auto bus = sdbusplus::bus::new_default();
+
auto objname = "power_supply" + instnum;
auto instance = std::stoul(instnum);
auto psuDevice = std::make_unique<psu::PowerSupply>(objname,
std::move(instance),
std::move(objpath),
- std::move(invpath));
- auto bus = sdbusplus::bus::new_default();
+ std::move(invpath),
+ bus);
+
sd_event* events = nullptr;
auto r = sd_event_default(&events);
@@ -81,6 +84,14 @@
// TODO: Use inventory path to subscribe to signal change for power supply presence.
+ //Attach the event object to the bus object so we can
+ //handle both sd_events (for the timers) and dbus signals.
+ bus.attach_event(eventPtr.get(), SD_EVENT_PRIORITY_NORMAL);
+
+ // TODO: Get power state on startup.
+ // TODO: Get presence state on startup and subscribe to presence changes.
+ // TODO - set to vinUVFault to false on presence change & start of poweron
+ // TODO - set readFailLogged to false on presence change and start of poweron
auto pollInterval = std::chrono::milliseconds(1000);
DeviceMonitor mainloop(std::move(psuDevice), eventPtr, pollInterval);
mainloop.run();