diff options
author | Lei YU <mine260309@gmail.com> | 2018-01-31 15:24:46 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2018-02-26 10:34:36 +0800 |
commit | 80f271b296488e12d4edd29b5bb908a407fbda1f (patch) | |
tree | 9009dca91bfa4fd5335a809a52746d02674c8078 /monitor/tach_sensor.cpp | |
parent | 8e5d197b840d4498dcb714b60cc1d38202a7a7a7 (diff) | |
download | phosphor-fan-presence-80f271b296488e12d4edd29b5bb908a407fbda1f.tar.gz phosphor-fan-presence-80f271b296488e12d4edd29b5bb908a407fbda1f.zip |
Add target interface for fan monitor
Current fan monitor assumes the use of the FanSpeed interface for fan
targets.
For fans controlled by pwm, FanPwm interface is added.
This commit adds a "target_interface" config parameter, so that user
can specify the interface for the fan targets.
E.g.
- name: fan0
has_target: true
target_interface: xyz.openbmc_project.Control.FanPwm
This config is optional and defaults to FanSpeed, so the current code
will not be affected.
Tested: Use this config on Romulus, ensures fan monitor gets fan
target from FanPwm interface and works OK.
Change-Id: I262a486c335b2b43a46af7abdd0e71e95a133b98
Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'monitor/tach_sensor.cpp')
-rw-r--r-- | monitor/tach_sensor.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp index 47f4d91..d725729 100644 --- a/monitor/tach_sensor.cpp +++ b/monitor/tach_sensor.cpp @@ -27,7 +27,6 @@ namespace fan namespace monitor { -constexpr auto FAN_SENSOR_CONTROL_INTF = "xyz.openbmc_project.Control.FanSpeed"; constexpr auto FAN_SENSOR_VALUE_INTF = "xyz.openbmc_project.Sensor.Value"; constexpr auto FAN_TARGET_PROPERTY = "Target"; constexpr auto FAN_VALUE_PROPERTY = "Value"; @@ -69,6 +68,7 @@ TachSensor::TachSensor(Mode mode, Fan& fan, const std::string& id, bool hasTarget, + const std::string& interface, size_t factor, size_t offset, size_t timeout, @@ -78,6 +78,7 @@ TachSensor::TachSensor(Mode mode, _name(FAN_SENSOR_PATH + id), _invName(path(fan.getName()) / id), _hasTarget(hasTarget), + _interface(interface), _factor(factor), _offset(offset), _timeout(timeout), @@ -106,7 +107,7 @@ TachSensor::TachSensor(Mode mode, if (_hasTarget) { - readProperty(FAN_SENSOR_CONTROL_INTF, + readProperty(_interface, FAN_TARGET_PROPERTY, _name, _bus, @@ -122,7 +123,7 @@ TachSensor::TachSensor(Mode mode, if (_hasTarget) { - match = getMatchString(FAN_SENSOR_CONTROL_INTF); + match = getMatchString(_interface); targetSignal = std::make_unique<sdbusplus::server::match::match>( _bus, @@ -189,7 +190,7 @@ static void readPropertyFromMessage(sdbusplus::message::message& msg, void TachSensor::handleTargetChange(sdbusplus::message::message& msg) { readPropertyFromMessage(msg, - FAN_SENSOR_CONTROL_INTF, + _interface, FAN_TARGET_PROPERTY, _tachTarget); |