Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;
}