monitor: use signed value for factor and offset
The code was using size_t for factor and offset. For some fans the
offset could be negative, so it needs to use signed types.
This commit changes the offset type to int64_t.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I7443b00cd9f55ff0acb2fcc077bf2f5ba2b74395
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp
index 5494450..411bd16 100644
--- a/monitor/tach_sensor.cpp
+++ b/monitor/tach_sensor.cpp
@@ -75,7 +75,7 @@
size_t funcDelay,
const std::string& interface,
size_t factor,
- size_t offset,
+ int64_t offset,
size_t timeout,
const sdeventplus::Event& event) :
_bus(bus),
diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp
index 2a643c5..27a036e 100644
--- a/monitor/tach_sensor.hpp
+++ b/monitor/tach_sensor.hpp
@@ -89,7 +89,7 @@
size_t funcDelay,
const std::string& interface,
size_t factor,
- size_t offset,
+ int64_t offset,
size_t timeout,
const sdeventplus::Event& event);
@@ -133,7 +133,7 @@
/**
* @brief Returns the offset of the sensor target
*/
- inline size_t getOffset() const
+ inline int64_t getOffset() const
{
return _offset;
}
@@ -277,7 +277,7 @@
/**
* @brief The offset of target to get fan rpm
*/
- const size_t _offset;
+ const int64_t _offset;
/**
* @brief The input speed, from the Value dbus property
diff --git a/monitor/types.hpp b/monitor/types.hpp
index 9a7b1fa..1d47e60 100644
--- a/monitor/types.hpp
+++ b/monitor/types.hpp
@@ -44,7 +44,7 @@
bool,
std::string,
size_t,
- size_t>;
+ int64_t>;
constexpr auto fanNameField = 0;
constexpr auto funcDelay = 1;