diff options
author | Emily Shaffer <emilyshaffer@google.com> | 2017-04-05 15:10:40 -0700 |
---|---|---|
committer | Emily Shaffer <emilyshaffer@google.com> | 2017-06-06 10:55:40 -0700 |
commit | 7117441c5fbd7a8a0adbff7a363feedb8511c4d8 (patch) | |
tree | 952b528d71347f965158a55d5d7745759a03f865 /sensorhandler.cpp | |
parent | 2ae09b9a5cdcf5991b8a30688e89ab26f43a3f27 (diff) | |
download | phosphor-host-ipmid-7117441c5fbd7a8a0adbff7a363feedb8511c4d8.tar.gz phosphor-host-ipmid-7117441c5fbd7a8a0adbff7a363feedb8511c4d8.zip |
sensorhandler: Fixes for dbus->type conversion.
This enables Get Type IPMI command.
Change-Id: I2e7ec6320d5e6a8eeb6566c6a4389b77c49bc92a
Signed-off-by: Emily Shaffer <emilyshaffer@google.com>
Diffstat (limited to 'sensorhandler.cpp')
-rw-r--r-- | sensorhandler.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sensorhandler.cpp b/sensorhandler.cpp index 9355fe3..1d0f4c9 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -154,6 +154,9 @@ int legacy_dbus_openbmc_path(const char *type, const uint8_t num, dbus_interface strncpy(interface->interface, str3, MAX_DBUS_PATH); interface->sensornumber = num; + // Make sure we know that the type hasn't been set, as newer codebase will + // set it automatically from the YAML at this step. + interface->sensortype = 0; final: @@ -340,7 +343,13 @@ uint8_t get_type_from_interface(dbus_interface_t dbus_if) { // is not a supported sensor if (dbus_if.interface[0] == 0) { return 0;} - if (strstr(dbus_if.interface, "InventoryItem")) { + // Fetch type from interface itself. + if (dbus_if.sensortype != 0) + { + type = dbus_if.sensortype; + } + // Legacy codebase does not populate type during initial handling: + else if (strstr(dbus_if.interface, "InventoryItem")) { // InventoryItems are real frus. So need to get the // fru_type property type = dbus_to_sensor_type_from_dbus(&dbus_if); |