Skip to content

watchdog: read the timeout back when the driver rejects it - #55

Merged
openwrt-bot merged 1 commit into
openwrt:mainfrom
thc1006:watchdog-timeout-readback
Oct 18, 2026
Merged

openwrt-bot merged 1 commit into
openwrt:mainfrom
thc1006:watchdog-timeout-readback

Conversation

@thc1006

@thc1006 thc1006 commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #54

If WDIOC_SETTIMEOUT fails, procd now logs it and reads the timeout back with WDIOC_GETTIMEOUT, so wdt_drv_timeout and ubus call system watchdog match the driver again.

I ran procd's watchdog.c in a small test program against softdog, which takes up to 65535 s. Valid timeouts behave as before. With 70000 s and 5000000 s, procd used to report the new value while softdog kept the old one; now it logs the error and reports the old one. A bad value set while the watchdog is stopped is caught the same way when it starts again.

On boards whose driver maximum is below the default 30 s, this adds an error message at boot.

WDIOC_SETTIMEOUT fails with EINVAL when the driver cannot use the
requested timeout, for example anything above 107 s on rt2880_wdt at
40 MHz. procd ignored the error and kept the requested value in
wdt_drv_timeout, so 'ubus call system watchdog' and the "Opened
watchdog with timeout" message reported a timeout that was never set,
while the driver kept its previous one.

Log the error and read the timeout back with WDIOC_GETTIMEOUT, as procd
did before the timeout was cached.

Fixes: 20192e4 ("watchdog: improve seting watchdog timeout and frequency")
Signed-off-by: Hsiu-Chi Tsai <hctsai@linux.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
@dangowrt
dangowrt force-pushed the watchdog-timeout-readback branch from 1ad618d to fa1ebfc Compare October 18, 2026 14:06
@openwrt-bot
openwrt-bot merged commit fa1ebfc into openwrt:main Oct 18, 2026
1 check failed
@thc1006
thc1006 deleted the watchdog-timeout-readback branch October 18, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

watchdog: ubus reports a timeout the driver did not accept

2 participants