summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sensor-example.yaml9
-rw-r--r--scripts/writesensor.mako.cpp12
2 files changed, 17 insertions, 4 deletions
diff --git a/scripts/sensor-example.yaml b/scripts/sensor-example.yaml
index c4ff4d5..db0e694 100755
--- a/scripts/sensor-example.yaml
+++ b/scripts/sensor-example.yaml
@@ -11,6 +11,8 @@
serviceInterface: org.freedesktop.DBus.Properties
# Where the sensor value is represented - assertion bits/reading/event data
readingType: assertion
+ # Sensor name would be occ0
+ sensorNamePattern: nameLeaf
eventType: 0x6F
# All the d-bus interfaces : properties that must be updated for this path
interfaces:
@@ -35,6 +37,7 @@
path: /system/chassis/motherboard/dimm1
serviceInterface: xyz.openbmc_project.Inventory.Manager
readingType: assertion
+ sensorNamePattern: nameLeaf
interfaces:
xyz.openbmc_project.State.Decorator.OperationalStatus:
Functional:
@@ -70,6 +73,8 @@
# serves as the value, or reading. Hence, the offset above is intentionally
# 0xFF, to indicate not to check any specific bits in the assertion.
readingType: readingAssertion
+ # Sensor name would be AttemptsLeft
+ sensorNamePattern: nameProperty
sensorReadingType: 0x6F
sensorType: 0xC3
serviceInterface: org.freedesktop.DBus.Properties
@@ -83,6 +88,7 @@
type: uint32_t
path: /xyz/openbmc_project/state/host1
readingType: readingAssertion
+ sensorNamePattern: nameProperty
sensorReadingType: 0x6F
sensorType: 0xC3
serviceInterface: org.freedesktop.DBus.Properties
@@ -97,6 +103,7 @@
mutability: Mutability::Write|Mutability::Read
serviceInterface: org.freedesktop.DBus.Properties
readingType: readingData
+ sensorNamePattern: nameLeaf
interfaces:
xyz.openbmc_project.Sensor.Value:
Value:
@@ -110,6 +117,8 @@
sensorReadingType: 0x6F
serviceInterface: xyz.openbmc_project.Inventory.Manager
readingType: assertion
+ # Sensor name would be cpu0_core22
+ sensorNamePattern: nameParentLeaf
interfaces:
xyz.openbmc_project.State.Decorator.OperationalStatus:
Functional:
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
index e081474..4644ff7 100644
--- a/scripts/writesensor.mako.cpp
+++ b/scripts/writesensor.mako.cpp
@@ -39,6 +39,8 @@ extern const IdInfoMap sensors = {
path = sensor["path"]
serviceInterface = sensor["serviceInterface"]
sensorType = sensor["sensorType"]
+ entityID = sensor.get("entityID", 0)
+ instance = sensor.get("entityInstance", 0)
readingType = sensor["sensorReadingType"]
multiplier = sensor.get("multiplierM", 1)
offsetB = sensor.get("offsetB", 0)
@@ -47,6 +49,8 @@ extern const IdInfoMap sensors = {
scale = sensor.get("scale", 0)
hasScale = "true" if "scale" in sensor.keys() else "false"
valueReadingType = sensor["readingType"]
+ sensorNamePattern = sensor.get("sensorNamePattern", "nameLeaf")
+ sensorNameFunc = "get::" + sensorNamePattern
updateFunc = interfaceDict[serviceInterface]["updateFunc"]
updateFunc += sensor["readingType"]
getFunc = interfaceDict[serviceInterface]["getFunc"]
@@ -63,10 +67,10 @@ extern const IdInfoMap sensors = {
sensorInterface = next(iter(interfaces))
mutability = sensor.get("mutability", "Mutability::Read")
%>
- ${sensorType},"${path}","${sensorInterface}",${readingType},${multiplier},
- ${offsetB},${exp},${offsetB * pow(10,exp)},
- ${hasScale},${scale},"${unit}",
- ${updateFunc},${getFunc},Mutability(${mutability}),{
+ ${entityID},${instance},${sensorType},"${path}","${sensorInterface}",
+ ${readingType},${multiplier}, ${offsetB},${exp},
+ ${offsetB * pow(10,exp)}, ${hasScale},${scale},"${unit}",
+ ${updateFunc},${getFunc},Mutability(${mutability}),${sensorNameFunc},{
% for interface,properties in interfaces.items():
{"${interface}",{
% for dbus_property,property_value in properties.items():
OpenPOWER on IntegriCloud