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>
This commit is contained in:
Timur Tabi 2016-06-21 18:00:15 -05:00 коммит произвёл Wim Van Sebroeck
Родитель ee279c2734
Коммит 5a2d3de196
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -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;
}