[skeleton]: Fix hard-coded path name when creating sensor object
This patch fixes skeleton issue: https://github.com/openbmc/skeleton/issues/33
The non-poll sensors have system specific properties. Define the sensor properties
in System files, and generate sensor object dynamically.
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index 0cf55a1..401f6f2 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -718,3 +718,16 @@
},
}
+# Miscellaneous non-poll sensor with system specific properties.
+# The sensor id is the same as those defined in ID_LOOKUP['SENSOR'].
+MISC_SENSORS = {
+ 0x09 : { 'class' : 'BootCountSensor' },
+ 0x05 : { 'class' : 'BootProgressSensor' },
+ 0x08 : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0050/online' },
+ 0x0A : { 'class' : 'OccStatusSensor',
+ 'os_path' : '/sys/class/i2c-adapter/i2c-3/3-0051/online' },
+ 0x32 : { 'class' : 'OperatingSystemStatusSensor' },
+ 0x33 : { 'class' : 'PowerCap',
+ 'os_path' : '/sys/class/hwmon/hwmon3/user_powercap' },
+}