skeleton: Rewrite setValue() method for Dbus object /org/openbmc/sensors/host/PowerCap
obmc uses dbus interface 'org.openbmc.SensorValue' of the object
'/org/openbmc/sensors/host/PowerCap' to set Host PowerCap.
Rewrite the setValue() method to set PowerCap via the
"/sys/class/hwmon/hwmonX/user_powercap" OCC-HWMON sysfs attribute.
BMC will sends a "Set User PowerCap" command to OCC.
Signed-off-by: Yi Li <adamliyi@msn.com>
diff --git a/bin/sensor_manager2.py b/bin/sensor_manager2.py
index 5964263..c924a75 100755
--- a/bin/sensor_manager2.py
+++ b/bin/sensor_manager2.py
@@ -53,7 +53,12 @@
## TODO: this should not be hardcoded
obj_path = OBJ_PATH+"/host/PowerCap"
- root_sensor.add(obj_path,Sensors.PowerCap(bus,obj_path))
+ sensor_obj = Sensors.PowerCap(bus,obj_path)
+ ## hwmon3 is default for master OCC on Barreleye.
+ ## should rewrite sensor_manager to remove hardcode
+ sensor_obj.sysfs_attr = "/sys/class/hwmon/hwmon3/user_powercap"
+ root_sensor.add(obj_path,sensor_obj)
+
obj_path = OBJ_PATH+"/host/BootProgress"
root_sensor.add(obj_path,Sensors.BootProgressSensor(bus,obj_path))
obj_path = OBJ_PATH+"/host/OccStatus"