Add error handing to recovery from gpio config failure
Sometimes these chassis related services will fail with below error:
Power GPIO: call to getGpioConfiguration failed:
GDBus.Error:org.freedesktop.DBus.Error.Service
Unknown: The name org.openbmc.managers.System was not provided by any
.service files
These gpio pins cannot be configured properly, and cannot power on/off
host.
Add error handing to terminate the service in such error, systemd will
restart them to try again
Change-Id: I3ce7383825f2b9715fdd82e1dec0725cef83073c
Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
diff --git a/rstbutton/button_reset_obj.c b/rstbutton/button_reset_obj.c
index 731ecce..8e1c1ac 100644
--- a/rstbutton/button_reset_obj.c
+++ b/rstbutton/button_reset_obj.c
@@ -1,4 +1,5 @@
#include <stdio.h>
+#include <stdlib.h>
#include <openbmc_intf.h>
#include <gpio.h>
#include <openbmc.h>
@@ -120,6 +121,7 @@
if(rc != GPIO_OK)
{
printf("ERROR PowerButton: GPIO setup (rc=%d)\n",rc);
+ exit(-1);
}
}