summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEmily Shaffer <emilyshaffer@google.com>2017-06-14 13:06:26 -0700
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-12-10 05:49:24 +0000
commit6223561894d2ab60cf4af2c5b5cc930c0a26d8c2 (patch)
treeddd825a857344df4ac21f50925b913e6556d1ad1 /scripts
parentdd9943119afe553f930694214d7fa40771f7f89b (diff)
downloadphosphor-host-ipmid-6223561894d2ab60cf4af2c5b5cc930c0a26d8c2.zip
phosphor-host-ipmid-6223561894d2ab60cf4af2c5b5cc930c0a26d8c2.tar.gz
sensorhandler: allow preconfigured unit and scale
Allow specifying the scale and unit for a sensor in the YAML configuration. This can save clock time by no longer requiring the daemon to reach out to the sensor owner for the information. Change-Id: I5f63286fc32fb9d64ebab7d86d1dbb7ff40591f4 Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/writesensor.mako.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
index c5db13a..e081474 100644
--- a/scripts/writesensor.mako.cpp
+++ b/scripts/writesensor.mako.cpp
@@ -43,6 +43,9 @@ extern const IdInfoMap sensors = {
multiplier = sensor.get("multiplierM", 1)
offsetB = sensor.get("offsetB", 0)
exp = sensor.get("bExp", 0)
+ unit = sensor.get("unit", "")
+ scale = sensor.get("scale", 0)
+ hasScale = "true" if "scale" in sensor.keys() else "false"
valueReadingType = sensor["readingType"]
updateFunc = interfaceDict[serviceInterface]["updateFunc"]
updateFunc += sensor["readingType"]
@@ -61,7 +64,9 @@ extern const IdInfoMap sensors = {
mutability = sensor.get("mutability", "Mutability::Read")
%>
${sensorType},"${path}","${sensorInterface}",${readingType},${multiplier},
- ${offsetB},${exp},${offsetB * pow(10,exp)},${updateFunc},${getFunc},Mutability(${mutability}),{
+ ${offsetB},${exp},${offsetB * pow(10,exp)},
+ ${hasScale},${scale},"${unit}",
+ ${updateFunc},${getFunc},Mutability(${mutability}),{
% for interface,properties in interfaces.items():
{"${interface}",{
% for dbus_property,property_value in properties.items():
@@ -127,7 +132,7 @@ except KeyError, e:
% endfor
}},
% endfor
- }
+ },
}},
% endif
% endfor
OpenPOWER on IntegriCloud