Update PostComplete polarity
After recent changes adding support for GPIO polarity in the config file
and using only active-high polarity for D-Bus, the PostComplete polarity
was left out of sync in a couple places.
This fixes PostComplete, so the correct polarity is used in all cases.
Tested:
Confirmed in D-Bus mode that PostComplete correctly initializes the OS
State and correctly updates the OS State on PropertiesChanged events.
Change-Id: Iae626de79b5f13292372081f14ca5ca75420a1c2
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/src/power_control.cpp b/src/power_control.cpp
index c73810c..b020309 100644
--- a/src/power_control.cpp
+++ b/src/power_control.cpp
@@ -2640,8 +2640,9 @@
else if (configData.name == "PostComplete")
{
OperatingSystemStateStage osState =
- (initialValue ? OperatingSystemStateStage::Inactive
- : OperatingSystemStateStage::Standby);
+ (initialValue == postCompleteConfig.polarity
+ ? OperatingSystemStateStage::Standby
+ : OperatingSystemStateStage::Inactive);
setOperatingSystemState(osState);
}
else
@@ -3483,20 +3484,20 @@
"xyz.openbmc_project.State.OperatingSystem.Status");
// Get the initial OS state based on POST complete
- // 0: Asserted, OS state is "Standby" (ready to boot)
- // 1: De-Asserted, OS state is "Inactive"
+ // Asserted, OS state is "Standby" (ready to boot)
+ // De-Asserted, OS state is "Inactive"
OperatingSystemStateStage osState;
if (postCompleteConfig.type == ConfigType::GPIO)
{
- osState = postCompleteLine.get_value() > 0
- ? OperatingSystemStateStage::Inactive
- : OperatingSystemStateStage::Standby;
+ osState = postCompleteLine.get_value() == postCompleteConfig.polarity
+ ? OperatingSystemStateStage::Standby
+ : OperatingSystemStateStage::Inactive;
}
else
{
osState = getProperty(postCompleteConfig) > 0
- ? OperatingSystemStateStage::Inactive
- : OperatingSystemStateStage::Standby;
+ ? OperatingSystemStateStage::Standby
+ : OperatingSystemStateStage::Inactive;
}
osIface->register_property(