diff options
author | Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com> | 2017-11-23 01:08:46 -0600 |
---|---|---|
committer | Tom Joseph <tomjoseph@in.ibm.com> | 2018-01-22 18:40:44 +0000 |
commit | 6244f93d23169bd6a810d698a20b2e06ab842684 (patch) | |
tree | 02cd795f9d19361a733dbbaa1cdf96fa9d98d20e | |
parent | 5e007a5daaaa9e9b4ea0400ad798b2e4ec44a838 (diff) | |
download | phosphor-host-ipmid-6244f93d23169bd6a810d698a20b2e06ab842684.tar.gz phosphor-host-ipmid-6244f93d23169bd6a810d698a20b2e06ab842684.zip |
Add sensor entry for power supply redundancy enabled.
IPMI to dbus lookup contained only mapping for PS
redundancy disabled, adding the mapping for enabled.
Changing the PS redundancy sensor type from D8 to CA.
Resolves openbmc/openbmc#2810
Change-Id: I2399ce76a168f63f6a4528cff8aa397ef12d5e1e
Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
-rw-r--r-- | ipmisensor.cpp | 3 | ||||
-rw-r--r-- | sensorhandler.cpp | 34 |
2 files changed, 36 insertions, 1 deletions
diff --git a/ipmisensor.cpp b/ipmisensor.cpp index eb70a7d..3bca4e7 100644 --- a/ipmisensor.cpp +++ b/ipmisensor.cpp @@ -204,7 +204,8 @@ lookup_t g_ipmidbuslookup[] = { {0x12, 0x02, set_sensor_dbus_state_system_event, "setValue", "", ""}, {0x12, 0x03, set_sensor_dbus_state_system_event, "setValue", "", ""}, {0x12, 0x04, set_sensor_dbus_state_system_event, "setValue", "", ""}, - {0xD8, 0x00, set_sensor_dbus_state_simple, "setValue", "Disabled", ""}, + {0xCA, 0x00, set_sensor_dbus_state_simple, "setValue", "Disabled", ""}, + {0xCA, 0x01, set_sensor_dbus_state_simple, "setValue", "Enabled", ""}, {0xFF, 0xFF, NULL, "", "", ""} }; diff --git a/sensorhandler.cpp b/sensorhandler.cpp index 3358b83..9064ecc 100644 --- a/sensorhandler.cpp +++ b/sensorhandler.cpp @@ -488,6 +488,7 @@ ipmi_ret_t ipmi_sen_get_sensor_reading(ipmi_netfn_t netfn, ipmi_cmd_t cmd, sd_bus *bus = ipmid_get_sd_bus_connection(); sd_bus_message *reply = NULL; int reading = 0; + char* assertion = NULL; printf("IPMI GET_SENSOR_READING [0x%02x]\n",reqptr->sennum); @@ -542,6 +543,39 @@ ipmi_ret_t ipmi_sen_get_sensor_reading(ipmi_netfn_t netfn, ipmi_cmd_t cmd, resp->indication[1] = 0; break; + //TODO openbmc/openbmc#2154 Move this sensor to right place. + case 0xCA: + r = sd_bus_get_property(bus,a.bus, a.path, a.interface, "value", NULL, &reply, "s"); + if (r < 0) { + fprintf(stderr, "Failed to call sd_bus_get_property:%d, %s\n", r, strerror(-r)); + fprintf(stderr, "Bus: %s, Path: %s, Interface: %s\n", + a.bus, a.path, a.interface); + break; + } + + r = sd_bus_message_read(reply, "s", &assertion); + if (r < 0) { + fprintf(stderr, "Failed to read sensor: %s\n", strerror(-r)); + break; + } + + rc = IPMI_CC_OK; + *data_len=sizeof(sensorreadingresp_t); + + resp->value = 0; + resp->operation = 0; + if (strcmp(assertion,"Enabled") == 0) + { + resp->indication[0] = 0x02; + } + else + { + resp->indication[0] = 0x1; + } + resp->indication[1] = 0; + free(assertion); + break; + case IPMI_SENSOR_TEMP: case IPMI_SENSOR_VOLTAGE: case IPMI_SENSOR_CURRENT: |