summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sensor-example.yaml57
-rw-r--r--scripts/writesensor.mako.cpp29
2 files changed, 63 insertions, 23 deletions
diff --git a/scripts/sensor-example.yaml b/scripts/sensor-example.yaml
index 98e9ff6..c4ff4d5 100755
--- a/scripts/sensor-example.yaml
+++ b/scripts/sensor-example.yaml
@@ -17,13 +17,14 @@
# One or more interface dict entries
org.open_power.OCC.Status:
OccActive:
- # Sensor type specific offset
- 0x06:
- # OccActive is a boolean
- type: "bool"
- # If offset 0x06 is asserted, set OccActive as false.
- assert: "false"
- deassert: "true"
+ Offsets:
+ # Sensor type specific offset
+ 0x06:
+ # OccActive is a boolean
+ type: "bool"
+ # If offset 0x06 is asserted, set OccActive as false.
+ assert: "false"
+ deassert: "true"
0x61:
sensorType: 0x04
@@ -35,14 +36,23 @@
serviceInterface: xyz.openbmc_project.Inventory.Manager
readingType: assertion
interfaces:
- xyz.openbmc_project.Inventory.Item:
- Present:
- 0x06:
- assert: true
- deassert: false
- type: bool
xyz.openbmc_project.State.Decorator.OperationalStatus:
Functional:
+ #Offsets contain the offsets in the sensor data.
+ Offsets:
+ 0x06:
+ assert: true
+ deassert: false
+ type: bool
+ #Prereqs are pre-requisites for this property value to be true.
+ Prereqs:
+ 0x04:
+ assert: false
+ deassert: true
+ type: bool
+ xyz.openbmc_project.Inventory.Item:
+ Present:
+ Offsets:
0x04:
assert: false
deassert: true
@@ -52,8 +62,9 @@
interfaces:
xyz.openbmc_project.Control.Boot.RebootAttempts:
AttemptsLeft:
- 0xFF:
- type: uint32_t
+ Offsets:
+ 0xFF:
+ type: uint32_t
path: /xyz/openbmc_project/state/host0
# A special case of assertion, where the entire assert bitfield
# serves as the value, or reading. Hence, the offset above is intentionally
@@ -67,8 +78,9 @@
interfaces:
xyz.openbmc_project.Control.Boot.RebootAttempts:
AttemptsLeft:
- 0xFF:
- type: uint32_t
+ Offsets:
+ 0xFF:
+ type: uint32_t
path: /xyz/openbmc_project/state/host1
readingType: readingAssertion
sensorReadingType: 0x6F
@@ -88,8 +100,9 @@
interfaces:
xyz.openbmc_project.Sensor.Value:
Value:
- 0xFF:
- type: int64_t
+ Offsets:
+ 0xFF:
+ type: int64_t
0x54:
sensorType: 0x07
@@ -100,12 +113,18 @@
interfaces:
xyz.openbmc_project.State.Decorator.OperationalStatus:
Functional:
+ Offsets:
0x08:
assert: false
deassert: true
type: bool
+ Prereqs:
+ 0x07:
+ assert: true
+ deassert: false
xyz.openbmc_project.Inventory.Item:
Present:
+ Offsets:
0x07:
assert: true
deassert: false
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
index 9cd4e48..c5db13a 100644
--- a/scripts/writesensor.mako.cpp
+++ b/scripts/writesensor.mako.cpp
@@ -51,7 +51,7 @@ extern const IdInfoMap sensors = {
if "readingAssertion" == valueReadingType or "readingData" == valueReadingType:
for interface,properties in interfaces.items():
for dbus_property,property_value in properties.items():
- for offset,values in property_value.items():
+ for offset,values in property_value["Offsets"].items():
valueType = values["type"]
updateFunc = "set::" + valueReadingType + "<" + valueType + ">"
getFunc = "get::" + valueReadingType + "<" + valueType + ">"
@@ -66,7 +66,28 @@ extern const IdInfoMap sensors = {
{"${interface}",{
% for dbus_property,property_value in properties.items():
{"${dbus_property}",{
- % for offset,values in property_value.items():
+<%
+try:
+ preReq = property_value["Prereqs"]
+except KeyError, e:
+ preReq = dict()
+%>\
+ {
+ % for preOffset,preValues in preReq.items():
+ { ${preOffset},{
+ % for name,value in preValues.items():
+ % if name == "type":
+<% continue %>\
+ % endif
+<% value = str(value).lower() %>\
+ ${value},
+ % endfor
+ }
+ },
+ % endfor
+ },
+ {
+ % for offset,values in property_value["Offsets"].items():
{ ${offset},{
% if offset == 0xFF:
}},
@@ -102,11 +123,11 @@ except KeyError, e:
}
},
% endfor
- }},
+ }}},
% endfor
}},
% endfor
- },
+ }
}},
% endif
% endfor
OpenPOWER on IntegriCloud