Fix Sensor query for derating factor returns 0

The issue here is that for derating factor sensor read command,
hostboot is expecting return value in event_status field, but we are
sending it in sensor reading field.

Testing:
ipmitool raw 0x04 0x2d 0xd8 #it has to retrun "00 00 5a 00"
Resolves openbmc/openbmc#3012

Change-Id: I09e3d02c946ad1d8a39ea747fc400fb623cbe6ef
Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index 1feef5b..ee62e17 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -460,7 +460,6 @@
 
     switch(type) {
         case 0xC2:
-        case 0xC8:
             r = sd_bus_get_property(bus,a.bus, a.path, a.interface,
                                     "value", NULL, &reply, "i");
             if (r < 0)
@@ -488,6 +487,34 @@
             resp->indication[1] = 0;
             break;
 
+        case 0xC8:
+            r = sd_bus_get_property(bus,a.bus, a.path, a.interface,
+                                    "value", NULL, &reply, "i");
+            if (r < 0)
+            {
+                sd_journal_print(LOG_ERR, "Failed to call sd_bus_get_property:"
+                                 " %d, %s\n", r, strerror(-r));
+                sd_journal_print(LOG_ERR, "Bus: %s, Path: %s, Interface: %s\n",
+                                 a.bus, a.path, a.interface);
+                break;
+            }
+
+            r = sd_bus_message_read(reply, "i", &reading);
+            if (r < 0) {
+                sd_journal_print(LOG_ERR, "Failed to read sensor: %s\n",
+                                 strerror(-r));
+                break;
+            }
+
+            rc = IPMI_CC_OK;
+            *data_len=sizeof(sensorreadingresp_t);
+
+            resp->value         = 0;
+            resp->operation     = 0;
+            resp->indication[0] = (uint8_t)reading;
+            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",