* [PATCH skeleton] skeleton: Update setValue() method dbus object '/org/openbmc/sensors/…
@ 2016-01-20 6:00 OpenBMC Patches
2016-01-20 6:00 ` [PATCH skeleton] skeleton: Update setValue() method dbus object '/org/openbmc/sensors/host/OccStatus' OpenBMC Patches
0 siblings, 1 reply; 2+ messages in thread
From: OpenBMC Patches @ 2016-01-20 6:00 UTC (permalink / raw)
To: openbmc
…host/OccStatus'
In recent occ_i2c driver, a new hwmon sysfs attribte
'/sys/class/i2c-adapter/i2c-X/X-0050/online' has been used to
instantiate occ_i2c device. Update the 'OccStatus' dbus object
to use the new interface.
Do not use '/sys/class/i2c-adapter/i2c-X/new_device' anymore.
Signed-off-by: Yi Li <adamliyi@msn.com>
https://github.com/openbmc/skeleton/pull/31
Yi Li (1):
skeleton: Update setValue() method dbus object
'/org/openbmc/sensors/host/OccStatus'
bin/Sensors.py | 11 ++++-------
bin/sensor_manager2.py | 6 +++++-
2 files changed, 9 insertions(+), 8 deletions(-)
--
2.6.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH skeleton] skeleton: Update setValue() method dbus object '/org/openbmc/sensors/host/OccStatus'
2016-01-20 6:00 [PATCH skeleton] skeleton: Update setValue() method dbus object '/org/openbmc/sensors/… OpenBMC Patches
@ 2016-01-20 6:00 ` OpenBMC Patches
0 siblings, 0 replies; 2+ messages in thread
From: OpenBMC Patches @ 2016-01-20 6:00 UTC (permalink / raw)
To: openbmc
From: Yi Li <adamliyi@msn.com>
In recent occ_i2c driver, a new hwmon sysfs attribte
'/sys/class/i2c-adapter/i2c-X/X-0050/online' has been used to
instantiate occ_i2c device. Update the 'OccStatus' dbus object
to use the new interface.
Do not use '/sys/class/i2c-adapter/i2c-X/new_device' anymore.
Signed-off-by: Yi Li <adamliyi@msn.com>
---
bin/Sensors.py | 11 ++++-------
bin/sensor_manager2.py | 6 +++++-
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/bin/Sensors.py b/bin/Sensors.py
index 81a593a..d31eed3 100755
--- a/bin/Sensors.py
+++ b/bin/Sensors.py
@@ -163,6 +163,8 @@ class BootProgressSensor(VirtualSensor):
class OccStatusSensor(VirtualSensor):
def __init__(self,bus,name):
+ ## default path. can be override
+ self.sysfs_attr = "/sys/class/i2c-adapter/i2c-3/3-0050/online"
VirtualSensor.__init__(self,bus,name)
self.setValue("Disabled")
bus.add_signal_receiver(self.SystemStateHandler,signal_name = "GotoSystemState")
@@ -170,7 +172,6 @@ class OccStatusSensor(VirtualSensor):
def SystemStateHandler(self,state):
if (state == "HOST_POWERED_OFF"):
self.setValue("Disabled")
-
##override setValue method
@dbus.service.method(SensorValue.IFACE_NAME,
@@ -178,14 +179,10 @@ class OccStatusSensor(VirtualSensor):
def setValue(self,value):
if (value == "Enabled"):
print "Installing OCC device"
- os.system("echo occ-i2c 0x50 > /sys/bus/i2c/devices/i2c-3/new_device")
- os.system("echo occ-i2c 0x51 > /sys/bus/i2c/devices/i2c-3/new_device")
+ os.system("echo 1 > " + self.sysfs_attr)
else:
print "Deleting OCC device"
- os.system("echo 0x50 > /sys/bus/i2c/devices/i2c-3/delete_device")
- os.system("echo 0x51 > /sys/bus/i2c/devices/i2c-3/delete_device")
-
-
+ os.system("echo 0 > " + self.sysfs_attr)
SensorValue.setValue(self,value)
@dbus.service.signal(CONTROL_IFACE,signature='s')
diff --git a/bin/sensor_manager2.py b/bin/sensor_manager2.py
index 5964263..ca5c2c8 100755
--- a/bin/sensor_manager2.py
+++ b/bin/sensor_manager2.py
@@ -56,8 +56,12 @@ if __name__ == '__main__':
root_sensor.add(obj_path,Sensors.PowerCap(bus,obj_path))
obj_path = OBJ_PATH+"/host/BootProgress"
root_sensor.add(obj_path,Sensors.BootProgressSensor(bus,obj_path))
+
obj_path = OBJ_PATH+"/host/OccStatus"
- root_sensor.add(obj_path,Sensors.OccStatusSensor(bus,obj_path))
+ sensor_obj = Sensors.OccStatusSensor(bus,obj_path)
+ sensor_obj.sysfs_attr = "/sys/class/i2c-adapter/i2c-3/3-0050/online"
+ root_sensor.add(obj_path,sensor_obj)
+
obj_path = OBJ_PATH+"/host/BootCount"
root_sensor.add(obj_path,Sensors.BootCountSensor(bus,obj_path))
obj_path = OBJ_PATH+"/host/OperatingSystemStatus"
--
2.6.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-20 6:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 6:00 [PATCH skeleton] skeleton: Update setValue() method dbus object '/org/openbmc/sensors/… OpenBMC Patches
2016-01-20 6:00 ` [PATCH skeleton] skeleton: Update setValue() method dbus object '/org/openbmc/sensors/host/OccStatus' OpenBMC Patches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.