monitor: Support target_path option in configuration file
The target path containing the interface
xyz.openbmc_project.control.FanPwm or
xyz.openbmc_project.control.FanSpeed can be different between
phosphor-hwmon and dbus-sensor.
In phosphor-hwmon, it is "/xyz/openbmc_project/sensors/fan_tach/".
In dbus-sensor, it is "/xyz/openbmc_project/control/fanpwm/".
This commit supports making this path configurable via "target_path"
as a full object path.
By default, it is the same as the fan tach object path.
Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Change-Id: I2658a462dd49a98ad77d684f2927e6ccae21cd15
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp
index 30e9129..875c578 100644
--- a/monitor/tach_sensor.hpp
+++ b/monitor/tach_sensor.hpp
@@ -93,6 +93,7 @@
* setting the speed
* @param[in] funcDelay - Delay to mark functional
* @param[in] interface - the interface of the target
+ * @param[in] path - the object path of the sensor target
* @param[in] factor - the factor of the sensor target
* @param[in] offset - the offset of the sensor target
* @param[in] method - the method of out of range
@@ -107,10 +108,11 @@
*/
TachSensor(Mode mode, sdbusplus::bus_t& bus, Fan& fan,
const std::string& id, bool hasTarget, size_t funcDelay,
- const std::string& interface, double factor, int64_t offset,
- size_t method, size_t threshold, bool ignoreAboveMax,
- size_t timeout, const std::optional<size_t>& errorDelay,
- size_t countInterval, const sdeventplus::Event& event);
+ const std::string& interface, const std::string& path,
+ double factor, int64_t offset, size_t method, size_t threshold,
+ bool ignoreAboveMax, size_t timeout,
+ const std::optional<size_t>& errorDelay, size_t countInterval,
+ const sdeventplus::Event& event);
/**
* @brief Reads a property from the input message and stores it in value.
@@ -386,7 +388,8 @@
* @brief Returns the match string to use for matching
* on a properties changed signal.
*/
- std::string getMatchString(const std::string& interface);
+ std::string getMatchString(const std::optional<std::string> path,
+ const std::string& interface);
/**
* @brief Reads the Target property and stores in _tachTarget.
@@ -462,6 +465,11 @@
const std::string _interface;
/**
+ * @brief The object path to set sensor's target
+ */
+ const std::string _path;
+
+ /**
* @brief The factor of target to get fan rpm
*/
const double _factor;