Merge pull request #70 from anoo1/bootcount
Read/Write Boot Count Sensor as int
diff --git a/ipmid.C b/ipmid.C
index be2e681..6726a27 100644
--- a/ipmid.C
+++ b/ipmid.C
@@ -609,7 +609,7 @@
goto final;
}
- r = sd_bus_message_append(m, "v", "y", value);
+ r = sd_bus_message_append(m, "v", "i", value);
if (r < 0) {
fprintf(stderr, "Failed to create a input parameter: %s", strerror(-r));
goto final;
diff --git a/sensorhandler.C b/sensorhandler.C
index 90bfd0f..bb14e7a 100644
--- a/sensorhandler.C
+++ b/sensorhandler.C
@@ -173,7 +173,7 @@
dbus_interface_t a;
sd_bus *bus = ipmid_get_sd_bus_connection();
sd_bus_message *reply = NULL;
- uint8_t reading;
+ int reading = 0;
printf("IPMI GET_SENSOR_READING [0x%02x]\n",reqptr->sennum);
@@ -189,7 +189,7 @@
switch(type) {
case 0xC3:
case 0xC2:
- r = sd_bus_get_property(bus,a.bus, a.path, a.interface, "value", NULL, &reply, "y");
+ r = sd_bus_get_property(bus,a.bus, a.path, a.interface, "value", NULL, &reply, "i");
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",
@@ -197,9 +197,9 @@
break;
}
- r = sd_bus_message_read(reply, "y", &reading);
+ r = sd_bus_message_read(reply, "i", &reading);
if (r < 0) {
- fprintf(stderr, "Failed to read byte: %s\n", strerror(-r));
+ fprintf(stderr, "Failed to read sensor: %s\n", strerror(-r));
break;
}
@@ -208,7 +208,7 @@
rc = IPMI_CC_OK;
*data_len=sizeof(sensorreadingresp_t);
- resp->value = reading;
+ resp->value = (uint8_t)reading;
resp->operation = 0;
resp->indication[0] = 0;
resp->indication[1] = 0;