diff options
author | Deepak Kodihalli <dkodihal@in.ibm.com> | 2017-08-12 02:01:27 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-08-15 19:29:25 +0000 |
commit | 1bb0d387cd238a1d4b8c38c474433ccaada47a22 (patch) | |
tree | 2034d96ff380e7f20f5405fad129fb1cddd54149 /sensorhandler.cpp | |
parent | 8b26d353da78858d92c2e0fa814a79e5a6dd29e7 (diff) | |
download | phosphor-host-ipmid-1bb0d387cd238a1d4b8c38c474433ccaada47a22.tar.gz phosphor-host-ipmid-1bb0d387cd238a1d4b8c38c474433ccaada47a22.zip |
Refactor set sensor handling code
A summary of the changes:
- Do not generate per sensor type code to update d-bus objects
corresponding to sensors. Function to update d-bus objects based on
standard sensor event types, such as assertion, event data, are now
generic functions - the need not be generated per sensor or per sensor
type.
- There's a special case where the assertion is treated as a reading
(i.e read the entire assertion field as-is). In this case, code needs
to be generated per sensor because the type of the mapped d-bus
property can vary. In this case have a generic template function, and
generate minimal code like so:
inline ipmi_ret_t readingAssertion(const SetSensorReadingReq& cmdData,
const Info& sensorInfo)
{
// Corresponding d-bus property is uint32_t
return set::readingAssertion<uint32_t>(cmdData, sensorInfo);
}
- Make sensor-example.yaml succinct.
- Make the code in writesensor.mako.cpp more pythonic.
Change-Id: I84415ca6e3f756bbb51a90e290539eb086a7f78b
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
Diffstat (limited to 'sensorhandler.cpp')
-rw-r--r-- | sensorhandler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp index eac4215..d8cd0d4 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -206,7 +206,7 @@ int find_openbmc_path(uint8_t num, dbus_interface_t *interface) { // works for the Value interface but may not suffice for more complex // sensors. // tracked https://github.com/openbmc/phosphor-host-ipmid/issues/103 - strcpy(interface->interface, info.sensorInterfaces.begin()->first.c_str()); + strcpy(interface->interface, info.propertyInterfaces.begin()->first.c_str()); interface->sensornumber = num; final: @@ -649,7 +649,7 @@ ipmi_ret_t populate_record_from_dbus(get_sdr::SensorDataFullRecordBody *body, ipmi_data_len_t data_len) { /* Functional sensor case */ - if (info->sensorInterfaces.begin()->first == + if (info->propertyInterfaces.begin()->first == "xyz.openbmc_project.Sensor.Value") { // Get bus |