[PATCH skeleton] Allow sysfs path to be passed to OCC sensor

OpenBMC Patches openbmc-patches at stwcx.xyz
Thu Apr 28 01:11:00 AEST 2016


From: Brad Bishop <bradleyb at us.ibm.com>

The previous method of overriding this didn't work because
the base class constructor disables the sensor before the path
is updated with the correct one.

Pass it into the constructor so that the path is correct from
the beginning.
---
 bin/Sensors.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bin/Sensors.py b/bin/Sensors.py
index f951eeb..8350774 100755
--- a/bin/Sensors.py
+++ b/bin/Sensors.py
@@ -176,9 +176,12 @@ class BootProgressSensor(VirtualSensor):
 		pass
 		
 class OccStatusSensor(VirtualSensor):
-	def __init__(self,bus,name):
+	def __init__(self,bus,name, sysfs = None):
 		## default path. can be override
-		self.sysfs_attr = "/sys/class/i2c-adapter/i2c-3/3-0050/online"
+		if sysfs is None:
+			self.sysfs_attr = "/sys/class/i2c-adapter/i2c-3/3-0050/online"
+		else:
+			self.sysfs_attr = sysfs
 		VirtualSensor.__init__(self,bus,name)
 		self.setValue("Disabled")
 		bus.add_signal_receiver(self.SystemStateHandler,signal_name = "GotoSystemState")
-- 
2.8.1




More information about the openbmc mailing list