Skip to content

WDOG: Output status on read - #19518

Merged
xiaoxiang781216 merged 2 commits into
apache:masterfrom
Javinator9889:feat/wdog-read_return_current_status
Aug 1, 2026
Merged

WDOG: Output status on read#19518
xiaoxiang781216 merged 2 commits into
apache:masterfrom
Javinator9889:feat/wdog-read_return_current_status

Conversation

@Javinator9889

Copy link
Copy Markdown
Contributor

Summary

Currently, the read function of the watchdog device is dummy and does nothing. Although this is fine, it's not useful at all from a userspace perspective, where you may want to check the current WDOG status.

A wrapper around the ioctl WDIOC_GETSTATUS has been added as the read function for the WDOG.

Impact

This should help debugging and developers with watchdog-enabled systems

Testing

The testing in this case is quite straightforward: cat /dev/watchdog0, whose output was:

nsh> cat /dev/watchdog0
Status       :
  flags      : 0x00000000
  timeout    : 30000
  timeleft   : 2947

@github-actions github-actions Bot added Area: Drivers Drivers issues Size: S The size of the change in this PR is small labels Jul 24, 2026
@Javinator9889
Javinator9889 force-pushed the feat/wdog-read_return_current_status branch 2 times, most recently from aa7c60e to ecc59cb Compare July 24, 2026 10:37
Comment thread drivers/timers/watchdog.c
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

arduino-mega2560

  • flash: .text +116 B (+0.2%, 67,430 B / 262,144 B, total: 26% used)

esp32-devkitc

  • ROM: .flash.rodata +160 B, .flash.text +1,464 B (+1.3%, 124,372 B / 4,194,272 B, total: 3% used)
  • drom0_0_seg: .flash.rodata +160 B (+1.2%, 13,456 B / 4,194,272 B, total: 0% used)
  • irom0_0_seg: .flash.text +1,464 B (+1.7%, 88,580 B / 3,342,304 B, total: 3% used)

hifive1-revb

  • flash: .text +120 B (+0.1%, 83,352 B / 4,194,304 B, total: 2% used)

mirtoo

  • kseg0_progmem: .text +244 B (+0.4%, 67,436 B / 131,072 B, total: 51% used)

qemu-armv8a

  • Code: .rodata +152 B, .text.dir_ioctl +64 B, .text.file_mq_vopen +40 B, .text.inode_checkopenperm +8 B, .text.nsh_session +8 B, .text.readline_common +816 B, .text.syslog_write_foreach -4 B (+0.9%, 318,122 B)
  • Data: +8 B (+0.0%, 76,970 B)

qemu-intel64

  • Code: .text +2,572 B (+0.0%, 8,658,048 B)
  • Data: .rodata +224 B (+0.2%, 120,647 B)

rx65n-rsk2mb

  • RAM: .bss +16 B (+0.2%, 6,586 B / 262,144 B, total: 3% used)
  • ROM: .rodata +104 B, .text +1,440 B (+1.8%, 87,248 B / 2,097,152 B, total: 4% used)

s698pm-dkit

  • Code: .text +5,040 B (+1.4%, 363,248 B)

stm32-nucleo-f103rb

  • flash: .text +124 B (+0.4%, 33,928 B / 131,072 B, total: 26% used)

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@Javinator9889 please squash your change into one patch.

Currently, the `read` function of the watchdog device is dummy and
does nothing. Although this is fine, it's not useful at all from a
userspace perspective, where you may want to check the current WDOG
status.

A wrapper around the `ioctl` `WDIOC_GETSTATUS` has been added as
the `read` function for the WDOG.

Signed-off-by: Javier Alonso <javieralonso@geotab.com>
@Javinator9889
Javinator9889 force-pushed the feat/wdog-read_return_current_status branch from bfb9a3d to 265caef Compare July 24, 2026 13:38
@Javinator9889

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 squashed and force-pushed

@acassis acassis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The watchdog documentation includes the new functionality of the
driver's char device: When reading from it, it emits information
about the watchdog status including flags, timeout and timeleft
as milliseconds. An example has been included as well.

Signed-off-by: Javier Alonso <dev@javinator9889.com>
@Javinator9889

Copy link
Copy Markdown
Contributor Author

@Javinator9889 please Document this new feature here: https://nuttx.apache.org/docs/latest/components/drivers/character/timers/watchdog.html

@acassis done at cd13c0c

@Javinator9889

Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 @jerpelea waiting for your code-owners approval :)

@xiaoxiang781216
xiaoxiang781216 merged commit 06ca196 into apache:master Aug 1, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Drivers Drivers issues Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants