[PATCH 1/5] initd: Add ubus argument to trigger watchdog tickle.

Michael Jones mike at meshplusplus.com
Tue Sep 29 12:21:59 EDT 2020


Signed-off-by: Michael Jones <mike at meshplusplus.com>
---
 system.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/system.c b/system.c
index 0fb98f1..ef7943a 100644
--- a/system.c
+++ b/system.c
@@ -325,6 +325,7 @@ enum {
     WDT_TIMEOUT,
     WDT_MAGICCLOSE,
     WDT_STOP,
+    WDT_TICKLE,
     __WDT_MAX
 };
 
@@ -333,6 +334,7 @@ static const struct blobmsg_policy
watchdog_policy[__WDT_MAX] = {
     [WDT_TIMEOUT] = { .name = "timeout", .type = BLOBMSG_TYPE_INT32 },
     [WDT_MAGICCLOSE] = { .name = "magicclose", .type = BLOBMSG_TYPE_BOOL },
     [WDT_STOP] = { .name = "stop", .type = BLOBMSG_TYPE_BOOL },
+    [WDT_TICKLE] = { .name = "tickle", .type = BLOBMSG_TYPE_BOOL },
 };
 
 static int watchdog_set(struct ubus_context *ctx, struct ubus_object *obj,
@@ -367,6 +369,9 @@ static int watchdog_set(struct ubus_context *ctx,
struct ubus_object *obj,
         watchdog_timeout(timeout);
     }
 
+    if (tb[WDT_TICKLE] && blobmsg_get_bool(tb[WDT_TICKLE]))
+        watchdog_ping();
+
     if (tb[WDT_MAGICCLOSE])
         watchdog_set_magicclose(blobmsg_get_bool(tb[WDT_MAGICCLOSE]));
 
-- 
2.26.2




More information about the openwrt-devel mailing list