summaryrefslogtreecommitdiffstats
path: root/monitor/tach_sensor.cpp
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-07-30 19:38:20 -0400
committerPatrick Williams <patrick@stwcx.xyz>2017-08-03 01:52:48 +0000
commitedaeb31c886e2b8d2d43664ec4178c8d35094742 (patch)
tree7a3a162ef3bae35ee1944dbe3a78e673b20f83c5 /monitor/tach_sensor.cpp
parentd7999b7c8d052dd64628b615a6ff84f189fd40ef (diff)
downloadphosphor-fan-presence-edaeb31c886e2b8d2d43664ec4178c8d35094742.tar.gz
phosphor-fan-presence-edaeb31c886e2b8d2d43664ec4178c8d35094742.zip
monitor: Allow missing sensors
Don't count sensors that don't exist as nonfunctional. Let some other application decide if missing sensors are a problem or not. Change-Id: Ie3d438c92df16bfd86ddc86db8a9dd143bf2cfb0 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'monitor/tach_sensor.cpp')
-rw-r--r--monitor/tach_sensor.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 0ec52ba..a4ebcd9 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -77,11 +77,21 @@ TachSensor::TachSensor(sdbusplus::bus::bus& bus,
_timer(events, [this, &fan](){ fan.timerExpired(*this); })
{
//Load in starting Target and Input values
- readProperty(FAN_SENSOR_VALUE_INTF,
- FAN_VALUE_PROPERTY,
- _name,
- _bus,
- _tachInput);
+
+ try
+ {
+ // Use getProperty directly to allow a missing sensor object
+ // to abort construction.
+ _tachInput = util::SDBusPlus::getProperty<decltype(_tachInput)>(
+ _bus,
+ _name,
+ FAN_SENSOR_VALUE_INTF,
+ FAN_VALUE_PROPERTY);
+ }
+ catch (std::exception& e)
+ {
+ throw InvalidSensorError();
+ }
if (_hasTarget)
{
OpenPOWER on IntegriCloud