pseq: Add two second wait to power off

In order to allow host and other BMC applications time to complete power
off processing, add a two second wait before initiating power off to the
power sequencer.

Signed-off-by: Jim Wright <jlwright@us.ibm.com>
Change-Id: I84517bfa776e0b321a47ae4986b5fc84b2682926
diff --git a/phosphor-power-sequencer/src/power_control.cpp b/phosphor-power-sequencer/src/power_control.cpp
index 2680409..fe844d5 100644
--- a/phosphor-power-sequencer/src/power_control.cpp
+++ b/phosphor-power-sequencer/src/power_control.cpp
@@ -112,6 +112,12 @@
             fmt::format("Power already at requested state: {}", state).c_str());
         return;
     }
+    if (s == 0)
+    {
+        // Wait for two seconds when powering down. This is to allow host and
+        // other BMC applications time to complete power off processing
+        std::this_thread::sleep_for(std::chrono::seconds(2));
+    }
 
     log<level::INFO>(fmt::format("setState: {}", s).c_str());
     powerControlLine.request(
@@ -130,8 +136,7 @@
     pgoodLine = gpiod::find_line(pgoodLineName);
     if (!pgoodLine)
     {
-        std::string errorString =
-            fmt::format("GPIO line name not found: {}", pgoodLineName);
+        std::string errorString{"GPIO line name not found: " + pgoodLineName};
         log<level::ERR>(errorString.c_str());
         report<
             sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure>();
@@ -140,8 +145,8 @@
     powerControlLine = gpiod::find_line(powerControlLineName);
     if (!powerControlLine)
     {
-        std::string errorString =
-            fmt::format("GPIO line name not found: {}", powerControlLineName);
+        std::string errorString{"GPIO line name not found: " +
+                                powerControlLineName};
         log<level::ERR>(errorString.c_str());
         report<
             sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure>();