diff options
author | Santosh Puranik <santosh.puranik@in.ibm.com> | 2019-05-01 19:02:52 +0530 |
---|---|---|
committer | Tom Joseph <tomjoseph@in.ibm.com> | 2019-05-09 02:00:30 +0000 |
commit | bbf8bd6c78822dd56c5cc8c1e34ba0f06671763f (patch) | |
tree | 6543368cf1a1e22460f8ed12db5a62aa17adc04e /sensordatahandler.cpp | |
parent | f865dea955fcec03c71c356d91ac0f574f62c4aa (diff) | |
download | phosphor-host-ipmid-bbf8bd6c78822dd56c5cc8c1e34ba0f06671763f.tar.gz phosphor-host-ipmid-bbf8bd6c78822dd56c5cc8c1e34ba0f06671763f.zip |
sensordatahandler: Support empty inventory interfaces
This commit adds support for empty inventory interfaces when
asserting a sensor into the inventory. This is something already
supported in ipmi-fru-parser, for example.
Currently, the notify::assertion function expects that each DBUS
interface also have a set of associated properties. One of the
use-cases this commit tries to solve is when a sensor being asserted
maps to an inventory item (accessed via
xyz.openbmc_project.Inventory.Manager DBUS service) that implements
a DBUS interface with no properties. For example, the GPU sensor
is mapped to a GPU inventory object that implements the DBUS
interface xyz.openbmc_project.Inventory.Item.Accelerator.
This commit enables phosphor-host-ipmid to correctly create/update
inventory objects even in cases where they implement DBUS interfaces
that contain no properties.
The sensor-example.yaml file has been updated to show an example
of a GPU sensor, the inventory object for which implements a
property-less DBUS interface.
Tested:
Tested on a witherspoon system that had some GPUs attached to it.
Pulled also https://gerrit.openbmc-project.xyz/c/openbmc/openbmc/+/21107
in order to generate the right sensor configs for testing.
Verified that the GPU invetory objects that are created when the host
asserts a GPU sensor now implement the empty interface
xyz.openbmc_project.Inventory.Item.Accelerator
Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: I973580e285ae0fff1a513d3bbe8c03a89e0eeb83
Diffstat (limited to 'sensordatahandler.cpp')
-rw-r--r-- | sensordatahandler.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp index 76dad69..923b96a 100644 --- a/sensordatahandler.cpp +++ b/sensordatahandler.cpp @@ -322,6 +322,15 @@ ipmi_ret_t assertion(const SetSensorReadingReq& cmdData, const Info& sensorInfo) ipmi::sensor::InterfaceMap interfaces; for (const auto& interface : sensorInfo.propertyInterfaces) { + // An interface with no properties - It is possible that the sensor + // object on DBUS implements a DBUS interface with no properties. + // Make sure we add the interface to the list if interfaces on the + // object with an empty property map. + if (interface.second.empty()) + { + interfaces.emplace(interface.first, ipmi::sensor::PropertyMap{}); + continue; + } // For a property like functional state the result will be // calculated based on the true value of all conditions. for (const auto& property : interface.second) |