1
0
Fork 0

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: Timur Tabi <timur@codeaurora.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
hifive-unleashed-5.1
Timur Tabi 2016-06-21 18:00:15 -05:00 committed by Wim Van Sebroeck
parent ee279c2734
commit 5a2d3de196
1 changed files with 3 additions and 0 deletions

View File

@ -13,6 +13,7 @@
#include <linux/watchdog.h>
int fd;
const char v = 'V';
/*
* This function simply sends an IOCTL to the driver, which in turn ticks
@ -34,6 +35,7 @@ static void keep_alive(void)
static void term(int sig)
{
write(fd, &v, 1);
close(fd);
printf("\nStopping watchdog ticks...\n");
exit(0);
@ -89,6 +91,7 @@ int main(int argc, char *argv[])
sleep(ping_rate);
}
end:
write(fd, &v, 1);
close(fd);
return 0;
}