diff options
-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: |