sensor: Implement sensor "PRIORITY"
This commit introduces the `xyz.openbmc_project.Common.Priority`
interface to define the priority of sensors. If a sensor's priority
attribute is specified, this interface is created with the 'priority'
attribute. However, if the priority attribute is not specified, this
interface is not created.
The `xyz.openbmc_project.Common.Priority` interface is used to indicate
the priority level of fan sensors. It provides information about
primary and secondary RPM sensors for dual rotor fans, allowing for a
more specific description of the sensor's priority.
phosphor-dbus-interfaces commit:
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/66779
Tested: Build phosphor-hwmon successfully
'''
1. Retrieve the priority level of the secondary sensor
busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Priority property u 1 emits-change writable
2. If the "PRIORITY" is not specified in the sensor's configuration file
busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_0 xyz.openbmc_project.Common.Priority
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
3. Change the sensor priority
busctl set-property xyz.openbmc_project.Hwmon-xxx.Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority \
Priority u 0
busctl introspect xyz.openbmc_project.Hwmon-xxx .Hwmon1 \
/xyz/openbmc_project/sensors/fan_tach/fan1_1 xyz.openbmc_project.Common.Priority
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Priority property u 0 emits-change writable
'''
Change-Id: I7a226cf105756bc32e04f6724428d93e84dfb72a
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
diff --git a/interface.hpp b/interface.hpp
index 6e2d71d..234af4c 100644
--- a/interface.hpp
+++ b/interface.hpp
@@ -1,6 +1,7 @@
#pragma once
#include <sdbusplus/server.hpp>
+#include <xyz/openbmc_project/Common/Priority/server.hpp>
#include <xyz/openbmc_project/Control/FanPwm/server.hpp>
#include <xyz/openbmc_project/Control/FanSpeed/server.hpp>
#include <xyz/openbmc_project/Sensor/Accuracy/server.hpp>
@@ -29,6 +30,9 @@
using StatusInterface = sdbusplus::xyz::openbmc_project::State::Decorator::
server::OperationalStatus;
using StatusObject = ServerObject<StatusInterface>;
+using PriorityInterface =
+ sdbusplus::xyz::openbmc_project::Common::server::Priority;
+using PriorityObject = ServerObject<PriorityInterface>;
using SensorValueType = double;
@@ -45,6 +49,7 @@
FAN_PWM,
STATUS,
ACCURACY,
+ PRIORITY,
};
// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4