Documentation/watchdog: add support for magic close to watchdog-test
authorTimur Tabi <timur@codeaurora.org>
Tue, 21 Jun 2016 23:00:15 +0000 (18:00 -0500)
committerWim Van Sebroeck <wim@iguana.be>
Sun, 17 Jul 2016 19:02:32 +0000 (21:02 +0200)
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>
Documentation/watchdog/src/watchdog-test.c

index b3cc7aa12a72b456e66a19cbc2ac096b7b785ca9..c69153913722abcea5db1175fe8f9110dd36399c 100644 (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;
 }