Add beep support for PSU
Spec requires that system will beep with pattern 1-5-1-4
if there is any PSU failure or config error.
Tested:
With two PSUs, disconnect one AC cable, or unplug one PSU,
to trigger the psu failure/config error, there is a beep.
Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
Change-Id: I8664400164298fa4a35f82b79e4bf417481aabb0
diff --git a/include/PSUEvent.hpp b/include/PSUEvent.hpp
index 623806b..f5bc155 100644
--- a/include/PSUEvent.hpp
+++ b/include/PSUEvent.hpp
@@ -27,8 +27,10 @@
{
public:
PSUSubEvent(std::shared_ptr<sdbusplus::asio::dbus_interface> eventInterface,
- const std::string& path, boost::asio::io_service& io,
- const std::string& groupEventName, const std::string& eventName,
+ const std::string& path,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
+ boost::asio::io_service& io, const std::string& groupEventName,
+ const std::string& eventName,
std::shared_ptr<std::set<std::string>> asserts,
std::shared_ptr<std::set<std::string>> combineEvent,
std::shared_ptr<bool> state, const std::string& psuName);
@@ -51,6 +53,8 @@
void setupRead(void);
void handleResponse(const boost::system::error_code& err);
void updateValue(const int& newValue);
+ void beep(const uint8_t& beepPriority);
+ static constexpr uint8_t beepPSUFailure = 2;
boost::asio::posix::stream_descriptor inputDev;
static constexpr unsigned int eventPollMs = 1000;
static constexpr size_t warnAfterErrorCount = 10;
@@ -58,6 +62,7 @@
std::string fanName;
std::string assertMessage;
std::string deassertMessage;
+ std::shared_ptr<sdbusplus::asio::connection> systemBus;
};
class PSUCombineEvent
@@ -65,6 +70,7 @@
public:
PSUCombineEvent(
sdbusplus::asio::object_server& objectSever,
+ std::shared_ptr<sdbusplus::asio::connection>& conn,
boost::asio::io_service& io, const std::string& psuName,
boost::container::flat_map<std::string, std::vector<std::string>>&
eventPathList,