Add LED Support to Fan Sensor
This allows the fan sensor to trip an LED when a critical
threshold is crossed.
Tested: Saw LED d-bus object in Group manager get set
using sensor override
Change-Id: Iab5a69ded20de6e3ac99e9ac687c60605d5763d1
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/Utils.hpp b/include/Utils.hpp
index 2c6ce9e..7f529e1 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -81,6 +81,7 @@
{
constexpr const char* interface = "org.freedesktop.DBus.Properties";
constexpr const char* get = "Get";
+constexpr const char* set = "Set";
} // namespace properties
namespace power
@@ -152,6 +153,22 @@
}
}
+inline void setLed(std::shared_ptr<sdbusplus::asio::connection> conn,
+ const std::string& name, bool on)
+{
+ conn->async_method_call(
+ [name](const boost::system::error_code ec) {
+ if (ec)
+ {
+ std::cerr << "Failed to set LED " << name << "\n";
+ }
+ },
+ "xyz.openbmc_project.LED.GroupManager",
+ "/xyz/openbmc_project/led/groups/" + name, properties::interface,
+ properties::set, "xyz.openbmc_project.Led.Group", "Asserted",
+ std::variant<bool>(on));
+}
+
void createInventoryAssoc(
std::shared_ptr<sdbusplus::asio::connection> conn,
std::shared_ptr<sdbusplus::asio::dbus_interface> association,