I'm trying to feed the watchdog device - /dev/watchdog
in Raspbian - from C.
The problem is no matter how i try to access the device always throws busy or permission denied errors (as the process is already running and being fed by the system..).
In the watchdog API says that '..the driver will not disable the
watchdog unless a specific magic character 'V' has been sent to
/dev/watchdog just before closing the file.' but then again i cannot write /dev/watchdog
.. I tried:
echo V > /dev/watchdog //bash, /dev/watchdog: Permission denied
open("/dev/watchdog", O_WRONLY); //C, Device or resource busy
Is there any way to free the device so i can control the heartbeat from C?
I had this problem when i worked with Raspberry Pi. My application used extensive CPU time. After 1 or 2 days work it caused the Raspberry pi hangs. So i decided to use the wtchdog. When i wanted to write watchdog device from C++ program i got same error.
The solution that i found:
open a new rule file
sudo nano /etc/udev/rules.d/60-watchdog.rules
and add this line to the file
KERNEL=="watchdog", MODE="0666"
After this, i was able to access watchdog form terminal screen or c++ program.