Support reading 64 bit integers
Some sysfs *_input values may be bigger than 32 bits,
for example power values reported in microwatts. As such,
read an int64_t value out of sysfs instead of just a uint32_t.
The D-Bus property that will hold the value is also the same
type, an int64_t.
Resolves openbmc/openbmc#2686
Change-Id: I4376de120825b73580d18d339fe76be454eeb18d
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index 61de673..2aa9e0f 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -154,7 +154,7 @@
return true;
}
-int adjustValue(const SensorSet::key_type& sensor, int value)
+int64_t adjustValue(const SensorSet::key_type& sensor, int64_t value)
{
const auto& it = sensorAdjusts.find(sensor);
if (it != sensorAdjusts.end())
@@ -179,7 +179,7 @@
auto& obj = std::get<Object>(info);
auto& objPath = std::get<std::string>(info);
- auto val = 0;
+ int64_t val = 0;
try
{
// Retry for up to a second if device is busy
@@ -405,7 +405,7 @@
if (attrs.find(hwmon::entry::input) != attrs.end())
{
// Read value from sensor.
- int value;
+ int64_t value;
try
{
// Retry for up to a second if device is busy