Skip to content

Commit

Permalink
sensors: ignore min/max in json for D-Bus passive sensor read
Browse files Browse the repository at this point in the history
min/max values were meant to scale write to be PWM, but were
overloaded in commit 75eb769
to scale sensor read to percent as well. However currently the D-Bus sensors
built from JSON can only specify one pair of min/max values,so they
cannot be used for both read/write interfaces.

Fix the behavior by ignoring min/max in settings when building D-Bus passive
read interface and only read them from D-Bus.

Tested:
  D-Bus passive sensor value is no longer scaled if there is no
  MinValue/MaxValue specified.

Resolves: #14

Signed-off-by: Kun Yi <kunyi731@gmail.com>
Change-Id: I206bbe75c77e79f765eca76cfa015321dcba4aa7
  • Loading branch information
kunyi731 committed Jul 11, 2019
1 parent 6aae76f commit fc2e803
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 16 deletions.
2 changes: 0 additions & 2 deletions conf.hpp
Expand Up @@ -10,8 +10,6 @@
namespace conf
{

constexpr int64_t inheritValueFromDbus = std::numeric_limits<int64_t>::lowest();

/*
* General sensor structure used for configuration.
*/
Expand Down
5 changes: 0 additions & 5 deletions dbus/dbusconfiguration.cpp
Expand Up @@ -527,11 +527,6 @@ bool init(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer)
{
config.timeout = 0;
}
else if (config.type == "fan")
{
config.max = conf::inheritValueFromDbus;
config.min = conf::inheritValueFromDbus;
}
}
else if (sensorPathIfacePair.second == pwmInterface)
{
Expand Down
9 changes: 0 additions & 9 deletions dbus/dbuspassive.cpp
Expand Up @@ -60,15 +60,6 @@ std::unique_ptr<ReadInterface> DbusPassive::createDbusPassive(
{
return nullptr;
}
if (info->max != conf::inheritValueFromDbus)
{
settings.max = info->max;
}

if (info->min != conf::inheritValueFromDbus)
{
settings.min = info->min;
}

return std::make_unique<DbusPassive>(bus, type, id, helper, settings,
failed, path, redundancy);
Expand Down

0 comments on commit fc2e803

Please sign in to comment.