summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEmily Shaffer <emilyshaffer@google.com>2017-06-14 13:06:26 -0700
committerPatrick Williams <patrick@stwcx.xyz>2017-09-13 21:42:57 +0000
commitcc941e150007d56b2d7f2fc0c8248e6d74dd659d (patch)
treeb1107d9a2c0dbc7eef9d3626b58c5915ee41da50 /scripts
parent16fe26d83f06719077da41b054d99d78c065091e (diff)
downloadphosphor-host-ipmid-cc941e150007d56b2d7f2fc0c8248e6d74dd659d.tar.gz
phosphor-host-ipmid-cc941e150007d56b2d7f2fc0c8248e6d74dd659d.zip
sensorhandler: support setting analog sensors
Refactor YAML format to denote mutability of sensors. Sensors which expect different formats for reads and writes should present two entries in the sensor YAML, one with the read interface and one with the write interface. Sensors which share a format for both reads and writes may present only one entry in the YAML with both readable and writable enums specified. If a sensor receives a write which has an interface of Sensor.Value, the "Set" message is sent via DBus to the path provided in the YAML. The previous codepath is maintained. Change-Id: I292f95b6fe936de759fd65ce72c842a1bfe66448 Signed-off-by: Emily Shaffer <emilyshaffer@google.com> Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/sensor-example.yaml17
-rw-r--r--scripts/writesensor.mako.cpp20
2 files changed, 35 insertions, 2 deletions
diff --git a/scripts/sensor-example.yaml b/scripts/sensor-example.yaml
index 2556261..52eb076 100755
--- a/scripts/sensor-example.yaml
+++ b/scripts/sensor-example.yaml
@@ -74,3 +74,20 @@
sensorReadingType: 0x6F
sensorType: 0xC3
serviceInterface: org.freedesktop.DBus.Properties
+
+0xD0:
+ sensorType: 0x01
+ path: /xyz/openbmc_project/sensors/temperature/fleeting0
+ sensorReadingType: 0x01
+ multiplierM: 511
+ offsetB: 0
+ bExp: 0
+ mutability: Mutability::Write|Mutability::Read
+ serviceInterface: org.freedesktop.DBus.Properties
+ readingType: readingData
+ interfaces:
+ xyz.openbmc_project.Sensor.Value:
+ Value:
+ 0xFF:
+ type: int64_t
+
diff --git a/scripts/writesensor.mako.cpp b/scripts/writesensor.mako.cpp
index e4609ab..5b1ffd7 100644
--- a/scripts/writesensor.mako.cpp
+++ b/scripts/writesensor.mako.cpp
@@ -48,6 +48,19 @@ inline ipmi_ret_t readingAssertion(const SetSensorReadingReq& cmdData,
} // namespace sensor_${key}
+%elif "readingData" == readingType:
+
+namespace sensor_${key}
+{
+
+inline ipmi_ret_t readingData(const SetSensorReadingReq& cmdData,
+ const Info& sensorInfo)
+{
+ return set::readingData<${type}>(cmdData, sensorInfo);
+}
+
+} // namespace sensor_${key}
+
%endif
% endfor
@@ -70,12 +83,15 @@ extern const IdInfoMap sensors = {
updateFunc += sensor["readingType"]
if "readingAssertion" == valueReadingType:
updateFunc = "sensor_" + str(key) + "::" + valueReadingType
+ elif "readingData" == valueReadingType:
+ updateFunc = "sensor_" + str(key) + "::" + valueReadingType
sensorInterface = serviceInterface
if serviceInterface == "org.freedesktop.DBus.Properties":
sensorInterface = next(iter(interfaces))
+ mutability = sensor.get("mutability", "Mutability::Read")
%>
${sensorType},"${path}","${sensorInterface}",${readingType},${multiplier},
- ${offset},${exp},${offset * pow(10,exp)},${updateFunc},{
+ ${offset},${exp},${offset * pow(10,exp)},${updateFunc},Mutability(${mutability}),{
% for interface,properties in interfaces.items():
{"${interface}",{
% for dbus_property,property_value in properties.items():
@@ -107,7 +123,7 @@ extern const IdInfoMap sensors = {
% endfor
}},
% endfor
- }
+ },
}},
% endif
% endfor
OpenPOWER on IntegriCloud