Skip to content

Commit

Permalink
monitor: use signed value for factor and offset
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mine260309 committed Jun 27, 2019
1 parent 8a697b6 commit 4eac3cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion monitor/tach_sensor.cpp
Expand Up @@ -75,7 +75,7 @@ TachSensor::TachSensor(Mode mode,
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),
Expand Down
6 changes: 3 additions & 3 deletions monitor/tach_sensor.hpp
Expand Up @@ -89,7 +89,7 @@ class TachSensor
size_t funcDelay,
const std::string& interface,
size_t factor,
size_t offset,
int64_t offset,
size_t timeout,
const sdeventplus::Event& event);

Expand Down Expand Up @@ -133,7 +133,7 @@ class TachSensor
/**
* @brief Returns the offset of the sensor target
*/
inline size_t getOffset() const
inline int64_t getOffset() const
{
return _offset;
}
Expand Down Expand Up @@ -277,7 +277,7 @@ class TachSensor
/**
* @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
Expand Down
2 changes: 1 addition & 1 deletion monitor/types.hpp
Expand Up @@ -44,7 +44,7 @@ using SensorDefinition = std::tuple<std::string,
bool,
std::string,
size_t,
size_t>;
int64_t>;

constexpr auto fanNameField = 0;
constexpr auto funcDelay = 1;
Expand Down

0 comments on commit 4eac3cf

Please sign in to comment.