Skip to content

Open /dev/watchdog before /dev/watchdog0 - #77

Merged
wberube merged 1 commit into
OpenIPC:masterfrom
difanz:watchdog-dev-watchdog
Nov 9, 2026
Merged

wberube merged 1 commit into
OpenIPC:masterfrom
difanz:watchdog-dev-watchdog

Conversation

@difanz

@difanz difanz commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

watchdog_start() tried /dev/watchdog0 first. Both nodes reach the first watchdog, but OpenIPC's sysupgrade only looks for a process holding /dev/watchdog (OpenIPC/firmware#2802, where the maintainers asked for the fix to go here). With divinus on /dev/watchdog0, sysupgrade saw nobody feeding the dog, did not arm its keeper, and once divinus was stopped for the flash the camera reset in the middle of the erase:

Erasing block: 605/681 (88%) ROM:       Use nor flash.

This swaps the order, so divinus opens /dev/watchdog and still falls back to /dev/watchdog0 where there is no legacy node.

Testing

On FH8626V100 (fh8626v100_lite with the V4L2 backend from #72), divinus started at boot holds /dev/watchdog, and an unmodified sysupgrade finds it:

/dev/watchdog: pid 522 feeds it; taken over if that dies

The upgrade completes and the camera boots into the new image.

Both nodes reach the first watchdog, but OpenIPC's sysupgrade looks
only for a process holding /dev/watchdog. A divinus holding
/dev/watchdog0 was not found, so the keeper was never armed and the
camera reset in the middle of the flash erase once divinus was gone.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Prefer /dev/watchdog so sysupgrade can detect the watchdog holder

🐞 Bug fix 🕐 Less than 5 minutes

Grey Divider

AI Description

• Open /dev/watchdog first so OpenIPC sysupgrade can detect the watchdog holder.
• Retain /dev/watchdog0 as a fallback when the legacy node is absent.
Diagram

graph TD
  A["divinus"] -->|preferred| B["/dev/watchdog"] --> D["Kernel watchdog"]
  A -->|absent| C["/dev/watchdog0"] --> D
  E["sysupgrade"] -->|detects holder| B
  E -->|arms| F["Keeper process"] --> D
Loading
High-Level Assessment

Prefer the existing /dev/watchdog path while retaining the fallback. Changing sysupgrade's detection instead would require modifying an external project and does not address the requested fix in divinus.

Files changed (1) +1 / -1

Bug fix (1) +1 / -1
watchdog.cPrefer the legacy watchdog device node +1/-1

Prefer the legacy watchdog device node

• Reorders the device search so watchdog_start() opens /dev/watchdog before /dev/watchdog0. This lets OpenIPC sysupgrade find divinus holding the expected node while preserving the fallback when that node is absent.

src/watchdog.c

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can see how risky a PR is at a glance with blast radius labels

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

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.

2 participants