add emergency signal for sensors and handler in chassis control to shutdown
diff --git a/bin/Sensors.py b/bin/Sensors.py
index cf80a01..81a593a 100755
--- a/bin/Sensors.py
+++ b/bin/Sensors.py
@@ -31,6 +31,7 @@
IFACE_NAME = 'org.openbmc.SensorThresholds'
def __init__(self,bus,name):
self.Set(SensorThresholds.IFACE_NAME,'thresholds_enabled',False)
+ self.Set(SensorThresholds.IFACE_NAME,'emergency_enabled',False)
self.Set(SensorThresholds.IFACE_NAME,'warning_upper',0)
self.Set(SensorThresholds.IFACE_NAME,'warning_lower',0)
self.Set(SensorThresholds.IFACE_NAME,'critical_upper',0)
@@ -52,16 +53,22 @@
current_state = "NORMAL"
if (value >= self.properties[iface]['critical_upper']):
current_state = "CRITICAL"
- rtn = True
- elif (value <= self.properties[iface]['critical_lower']):
- current_state = "CRITICAL"
- rtn = True
- elif (value >= self.properties[iface]['warning_upper']):
- current_state = "WARNING"
- rtn = True
- elif (value <= self.properties[iface]['warning_lower']):
- current_state = "WARNING"
rtn = True
+ elif (value <= self.properties[iface]['critical_lower']):
+ current_state = "CRITICAL"
+ rtn = True
+ elif (value >= self.properties[iface]['warning_upper']):
+ current_state = "WARNING"
+ rtn = True
+ elif (value <= self.properties[iface]['warning_lower']):
+ current_state = "WARNING"
+ rtn = True
+
+ if (self.Get(iface,'threshold_state') != current_state and
+ current_state == "CRITICAL" and
+ self.Get(iface,'emergency_enabled') == True):
+ self.Emergency()
+
self.Set(iface,'threshold_state',current_state)
worst = self.properties[iface]['worst_threshold_state']
if (current_state == "CRITICAL" or
@@ -70,6 +77,11 @@
return rtn
+ @dbus.service.signal(IFACE_NAME,signature='')
+ def Emergency(self):
+ pass
+
+
class VirtualSensor(SensorValue):
def __init__(self,bus,name):
Openbmc.DbusProperties.__init__(self)