sensor-monitor: support skip power checking
The threshold event is binding with power state currently.
Due to some sensors access will not depend on the power state.
Provide a new option to let user to disable it.
Change-Id: Ib232b889cde70082e3bd630ffbe6939eede474f8
Signed-off-by: Jerry C Chen <jerry.c.chen.wiwynn@gmail.com>
diff --git a/sensor-monitor/threshold_alarm_logger.cpp b/sensor-monitor/threshold_alarm_logger.cpp
index 6d78c0a..6b20e77 100644
--- a/sensor-monitor/threshold_alarm_logger.cpp
+++ b/sensor-monitor/threshold_alarm_logger.cpp
@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "config.h"
+
#include "threshold_alarm_logger.hpp"
#include "sdbusplus.hpp"
@@ -218,8 +220,9 @@
if (alarmValue != alarms[key][propertyName])
{
alarms[key][propertyName] = alarmValue;
-
+#ifndef SKIP_POWER_CHECKING
if (_powerState->isPowerOn())
+#endif
{
createEventLog(sensorPath, interface, propertyName,
alarmValue);
@@ -249,7 +252,11 @@
// This is just for checking alarms on startup,
// so only look for active alarms.
+#ifdef SKIP_POWER_CHECKING
+ if (alarmValue)
+#else
if (alarmValue && _powerState->isPowerOn())
+#endif
{
createEventLog(sensorPath, interface, property, alarmValue);
}