dbus-sensors: Change the host state match string
When the CurrentHostState dbus property value ends with "Running",
Dbus-sensors marks the host as running and starts reading the sensors
with "PowerState=On" configuration.
From commit "host state transitioning ...", phosphor-state-manager
package updates the transition state "TransitioningToOff" or
"TransitioningToRunning" to CurrentHostState property. This causes
dbus-sensors detects the host is running when it is transiting to
running state.
This commit fixs that issue by changing the match string from
"Running" to ".Running".
Tested:
1. Power off the host.
2. Power on the host.
3. Make sure there is no threshold warnings/errors for
the sensors with "PowerState=On" configuration.
Signed-off-by: ThuBaNguyen <thu@os.amperecomputing.com>
Change-Id: I3bde0f3d288614657869f54e286a2d690d92dcad
diff --git a/src/IpmbSensor.cpp b/src/IpmbSensor.cpp
index c7a9f33..edbe05f 100644
--- a/src/IpmbSensor.cpp
+++ b/src/IpmbSensor.cpp
@@ -581,7 +581,7 @@
if (findStatus != values.end())
{
bool powerStatus = boost::ends_with(
- std::get<std::string>(findStatus->second), "Running");
+ std::get<std::string>(findStatus->second), ".Running");
if (powerStatus)
{
if (!initCmdTimer)
diff --git a/src/Utils.cpp b/src/Utils.cpp
index cf0ce9a..5a5064f 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -268,7 +268,7 @@
return;
}
powerStatusOn =
- boost::ends_with(std::get<std::string>(state), "Running");
+ boost::ends_with(std::get<std::string>(state), ".Running");
},
power::busname, power::path, properties::interface, properties::get,
power::interface, power::property);
@@ -330,7 +330,7 @@
if (findState != values.end())
{
bool on = boost::ends_with(
- std::get<std::string>(findState->second), "Running");
+ std::get<std::string>(findState->second), ".Running");
if (!on)
{
timer.cancel();