add fan control
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index 1bbd0eb..8562187 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -26,6 +26,7 @@
EXIT_STATE_DEPEND = {
'BASE_APPS' : {
'/org/openbmc/sensors': 0,
+ '/org/openbmc/sensors/speed/fan6': 0,
},
'BMC_STARTING' : {
'/org/openbmc/control/chassis0': 0,
@@ -43,6 +44,11 @@
'bus_name' : 'org.openbmc.control.Host',
'obj_name' : '/org/openbmc/control/host0',
'interface_name' : 'org.openbmc.control.Host',
+ },
+ 'setMax' : {
+ 'bus_name' : 'org.openbmc.control.Fans',
+ 'obj_name' : '/org/openbmc/control/fans',
+ 'interface_name' : 'org.openbmc.control.Fans',
}
},
'BMC_READY' : {
@@ -85,6 +91,12 @@
'monitor_process' : False,
'process_name' : 'pcie_slot_present.exe',
},
+ 'fan_control' : {
+ 'system_state' : 'BMC_STARTING',
+ 'start_process' : True,
+ 'monitor_process' : True,
+ 'process_name' : 'fan_control.py',
+ },
'virtual_sensors' : {
'system_state' : 'BMC_STARTING',
'start_process' : True,
@@ -149,7 +161,7 @@
'process_name' : 'chassis_control.py',
},
'hwmon_barreleye' : {
- 'system_state' : 'BMC_STARTING',
+ 'system_state' : 'BASE_APPS',
'start_process' : True,
'monitor_process' : True,
'process_name' : 'hwmons_barreleye.exe',
diff --git a/bin/fan_control.py b/bin/fan_control.py
new file mode 100755
index 0000000..87dc7a9
--- /dev/null
+++ b/bin/fan_control.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python -u
+
+import sys
+#from gi.repository import GObject
+import gobject
+import dbus
+import dbus.service
+import dbus.mainloop.glib
+import Openbmc
+
+DBUS_NAME = 'org.openbmc.control.Fans'
+OBJ_PATH = '/org/openbmc/control/fans'
+IFACE_NAME = 'org.openbmc.control.Fans'
+
+FAN_BUS = 'org.openbmc.sensors.hwmon'
+FAN_OBJS = [
+ '/org/openbmc/sensors/speed/fan1',
+ '/org/openbmc/sensors/speed/fan2',
+ '/org/openbmc/sensors/speed/fan3',
+ '/org/openbmc/sensors/speed/fan4',
+ '/org/openbmc/sensors/speed/fan5',
+ '/org/openbmc/sensors/speed/fan6',
+]
+FAN_IFACE = 'org.openbmc.SensorValue'
+
+class FanControl(Openbmc.DbusProperties):
+ def __init__(self,bus,name):
+ Openbmc.DbusProperties.__init__(self)
+ dbus.service.Object.__init__(self,bus,name)
+ self.ObjectAdded(name,IFACE_NAME)
+ self.Set(IFACE_NAME,"floor",250)
+ self.Set(IFACE_NAME,"ceiling",255)
+ self.fan_intf = []
+ ## create interface proxies to all fans
+ for fan in FAN_OBJS:
+ print "Initializing fan: "+fan
+ obj = bus.get_object(FAN_BUS,fan)
+ fan_intf.append(dbus.Interface(obj,FAN_IFACE))
+
+ def setMax(self):
+ print "Setting fans to max"
+ for intf in self.fan_intf:
+ intf.setValue(dbus.UInt32(255))
+
+
+if __name__ == '__main__':
+
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+ bus = Openbmc.getDBus()
+ name = dbus.service.BusName(DBUS_NAME,bus)
+ fan_control = FanControl(bus,OBJ_PATH)
+ mainloop = gobject.MainLoop()
+
+ print "Starting fan control"
+ fan_control.setMax()
+ mainloop.run()
+