diff options
| author | Matt Spinler <spinler@us.ibm.com> | 2017-11-29 15:18:05 -0600 |
|---|---|---|
| committer | Matt Spinler <spinler@us.ibm.com> | 2017-11-29 15:26:51 -0600 |
| commit | fee106b9bf94e9a393c7c44b53b7cc5d9f89b439 (patch) | |
| tree | bc98557a70c36d365dd6868bf4df95942cfb54ae /mainloop.cpp | |
| parent | 67ce4a46999012eba2a0015a51619f474967d21c (diff) | |
| download | phosphor-hwmon-fee106b9bf94e9a393c7c44b53b7cc5d9f89b439.tar.gz phosphor-hwmon-fee106b9bf94e9a393c7c44b53b7cc5d9f89b439.zip | |
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>
Diffstat (limited to 'mainloop.cpp')
| -rw-r--r-- | mainloop.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mainloop.cpp b/mainloop.cpp index 61de673..2aa9e0f 100644 --- a/mainloop.cpp +++ b/mainloop.cpp @@ -154,7 +154,7 @@ auto getAttributes(const std::string& type, Attributes& attributes) 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 addValue(const SensorSet::key_type& sensor, 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 @@ void MainLoop::run() 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 |

