Commit 5a2d3de1 authored by Timur Tabi's avatar Timur Tabi Committed by Wim Van Sebroeck

Documentation/watchdog: add support for magic close to watchdog-test

Some drivers have the WDIOF_MAGICCLOSE set, which means that applications
need to write 'V' to the watchdog device before closing, otherwise the
driver won't stop the watchdog timer.
Signed-off-by: default avatarTimur Tabi <timur@codeaurora.org>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent ee279c27
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/watchdog.h> #include <linux/watchdog.h>
int fd; int fd;
const char v = 'V';
/* /*
* This function simply sends an IOCTL to the driver, which in turn ticks * This function simply sends an IOCTL to the driver, which in turn ticks
...@@ -34,6 +35,7 @@ static void keep_alive(void) ...@@ -34,6 +35,7 @@ static void keep_alive(void)
static void term(int sig) static void term(int sig)
{ {
write(fd, &v, 1);
close(fd); close(fd);
printf("\nStopping watchdog ticks...\n"); printf("\nStopping watchdog ticks...\n");
exit(0); exit(0);
...@@ -89,6 +91,7 @@ int main(int argc, char *argv[]) ...@@ -89,6 +91,7 @@ int main(int argc, char *argv[])
sleep(ping_rate); sleep(ping_rate);
} }
end: end:
write(fd, &v, 1);
close(fd); close(fd);
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment