yangsong8-a1 opened a new pull request, #21886:
URL: https://github.com/apache/nuttx/pull/21886
## Summary
The watchdog device could only be stopped at runtime (magic 'V' write);
it could not be started again. Two commits:
- a write whose first byte is 'V' stops the watchdog (or the
auto-monitor) as before,
- any other non-empty write starts it again (the auto-monitor, or the
lower half start()),
- an empty write is still a keepalive.
The second commit replaces the single-pass loop in wdog_write() with the
equivalent if/else, removing structurally dead code.
## Impact
Behavior change for applications. With CONFIG_WATCHDOG_MAGIC_V and no
CONFIG_WATCHDOG_AUTOMONITOR_TASKS, write(fd, "x", 1) used to feed the
watchdog, as on Linux. Now it calls start() instead. An empty write is
not passed to the driver by the VFS, so write() can no longer feed the
watchdog at all; feeding needs WDIOC_KEEPALIVE. A lower half without
start() faults on a non-'V' write, because the new path calls
lower->ops->start() directly instead of WD_START().
## Testing
Ubuntu 22.04, gcc 13.1. sim:nsh + CONFIG_WATCHDOG, fake lower-half
test program (full methods / keepalive-only):
| Call | apache/master | This branch |
|---|---|---|
| /dev/wdfull: write("x") | keepalive | start |
| /dev/wdfull: write("", 0) | driver not called | driver not called |
| /dev/wdfull: write("V") | stop | stop |
| /dev/wdmin (keepalive only): write("x") | keepalive | segmentation fault
(start is NULL) |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]