apps/examples/watchdog: Introduce new watchdog example#7297
apps/examples/watchdog: Introduce new watchdog example#7297seokhun-eom24 wants to merge 1 commit intoSamsung:masterfrom
Conversation
Introduce a new watchdog example, include Kconfig, Makefile and main source file. This example demonstrates how to interact with the watchdog timer, providing commands for expiring the timer and pausing/resuming its operation. To use this example add CONFIG_EXAMPLES_WATCHDOG=y to defconfig. [Usage] ``` watchdog expire 30001 -> Expire after 30001ms watchdog expire 30001 1000 -> Print status every 1000ms and expire after 30001ms watchdog pause_resume -> Test watchdog pause/resume functionality and print status ```
PR #7297 — apps/examples/watchdog: Introduce new watchdog example
Repository: Base → Head: HEAD Commit: Scope: New 🔎 Review Summary
Final Verdict: ❗ Request Changes 🚨 Must-Fix Issues1. `expire ` leaves the watchdog armed when status polling fails
Problem Impact
Evidence
Required Fix
Change outline:
Example patch: diff --git a/apps/examples/watchdog/watchdog_main.c b/apps/examples/watchdog/watchdog_main.c
@@
-static int watchdog_wait_loop(int fd, uint32_t status_period_ms)
+static int watchdog_wait_loop(int fd, uint32_t status_period_ms)
{
@@
- return ERROR;
+ return ERROR;
}
@@
- return watchdog_wait_loop(fd, status_period_ms);
+ ret = watchdog_wait_loop(fd, status_period_ms);
+ if (ret != OK) {
+ (void)watchdog_stop(fd);
+ close(fd);
+ return ERROR;
+ }
+
+ close(fd);
+ return OK;
}Inference:
Validation Method
2. `pause_resume` reports success even if `WDIOC_STOP` fails at the end
Problem Impact
Evidence
Required Fix
Change outline:
Example patch: diff --git a/apps/examples/watchdog/watchdog_main.c b/apps/examples/watchdog/watchdog_main.c
@@
- watchdog_stop(fd);
- close(fd);
- return OK;
+ ret = watchdog_stop(fd);
+ close(fd);
+ return (ret == OK) ? OK : ERROR;
}Inference:
Validation Method
🟡 Nice-to-Have Improvements1. Restrict or document `pause_resume` for boards that actually implement the extra watchdog ioctls
Problem Impact
Recommended Action
Expected Output
✅ Notable ImprovementsNotable Improvements✔ Uses the configured watchdog device path instead of hard-coding
|
Introduce a new watchdog example, include Kconfig, Makefile and main source file.
This example demonstrates how to interact with the watchdog timer, providing commands for expiring the timer and pausing/resuming its operation.
To use this example add
CONFIG_EXAMPLES_WATCHDOG=yto defconfig.[Usage]