[PATCH phosphor-host-ipmid] Support to stop the watchdog

OpenBMC Patches patches at stwcx.xyz
Fri Oct 23 05:43:49 AEDT 2015


From: Adriana Kobylak <anoo at us.ibm.com>

Check the request flags for the set watchdog command to determine
if the watchdog needs to be stopped or restarted.
---
 apphandler.C | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/apphandler.C b/apphandler.C
index 9d53552..45cec19 100755
--- a/apphandler.C
+++ b/apphandler.C
@@ -134,8 +134,8 @@ ipmi_ret_t ipmi_app_set_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
         return -1;
     }
 
-    // Start watchdog
-    r = sd_bus_message_new_method_call(bus,&m,busname,objname,iface,"start");
+    // Stop the current watchdog if any
+    r = sd_bus_message_new_method_call(bus,&m,busname,objname,iface,"stop");
     if (r < 0) {
         fprintf(stderr, "Failed to add the start method object: %s\n", strerror(-r));
         return -1;
@@ -146,6 +146,21 @@ ipmi_ret_t ipmi_app_set_watchdog(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
         return -1;
     }
 
+    // Start the watchdog if requested
+    if (reqptr->t_use & 0x40)
+    {
+        r = sd_bus_message_new_method_call(bus,&m,busname,objname,iface,"start");
+        if (r < 0) {
+            fprintf(stderr, "Failed to add the start method object: %s\n", strerror(-r));
+            return -1;
+        }
+        r = sd_bus_call(bus, m, 0, &error, &reply);
+        if (r < 0) {
+            fprintf(stderr, "Failed to call the start method: %s\n", strerror(-r));
+            return -1;
+        }
+    }
+
     sd_bus_error_free(&error);
     sd_bus_message_unref(m);
 
-- 
2.6.0




More information about the openbmc mailing list