Lines Matching +full:watchdog +full:- +full:enable
1 // SPDX-License-Identifier: GPL-2.0
3 * Watchdog Driver Test Program
4 * - Tests all ioctls
5 * - Tests Magic Close - CONFIG_WATCHDOG_NOWAYOUT
6 * - Could be tested against softdog driver on systems that
7 * don't have watchdog hardware.
8 * - TODO:
9 * - Enhance test to add coverage for WDIOC_GETTEMP.
11 * Reference: Documentation/watchdog/watchdog-api.rst
24 #include <linux/watchdog.h>
34 {"enable", no_argument, NULL, 'e'},
50 * the PC Watchdog card to reset its internal timer so it doesn't trigger
64 * The main program. Run the program with "-d" to disable the card,
65 * or "-e" to enable the card.
74 printf("\nStopping watchdog ticks failed (%d)...\n", errno);
76 printf("\nStopping watchdog ticks...\n");
83 printf(" -f, --file\t\tOpen watchdog device file\n");
84 printf("\t\t\tDefault is /dev/watchdog\n");
85 printf(" -i, --info\t\tShow watchdog_info\n");
86 printf(" -s, --status\t\tGet status & supported features\n");
87 printf(" -b, --bootstatus\tGet last boot status (Watchdog/POR)\n");
88 printf(" -d, --disable\t\tTurn off the watchdog timer\n");
89 printf(" -e, --enable\t\tTurn on the watchdog timer\n");
90 printf(" -h, --help\t\tPrint the help message\n");
91 printf(" -p, --pingrate=P\tSet ping rate to P seconds (default %d)\n",
93 printf(" -t, --timeout=T\tSet timeout to T seconds\n");
94 printf(" -T, --gettimeout\tGet the timeout\n");
95 printf(" -n, --pretimeout=T\tSet the pretimeout to T seconds\n");
96 printf(" -N, --getpretimeout\tGet the pretimeout\n");
97 printf(" -L, --gettimeleft\tGet the time left until timer expires\n");
99 printf("Parameters are parsed left-to-right in real-time.\n");
100 printf("Example: %s -d -t 10 -p 5 -e\n", progname);
101 printf("Example: %s -t 12 -T -n 7 -N\n", progname);
115 {WDIOF_ALARMONLY, "Watchdog triggers a management or other external alarm not a reboot"},
117 {WDIOS_DISABLECARD, "Turn off the watchdog timer"},
118 {WDIOS_ENABLECARD, "Turn on the watchdog timer"},
160 printf("Last boot is caused by: Power-On-Reset\n");
178 char *file = "/dev/watchdog";
184 while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
191 if (fd == -1) {
193 printf("Watchdog device (%s) not found.\n", file);
195 printf("Run watchdog as root.\n");
197 printf("Watchdog device open failed %s\n",
199 exit(-1);
203 * Validate that `file` is a watchdog device
214 while ((c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1) {
229 printf("Watchdog card disabled.\n");
239 printf("Watchdog card enabled.\n");
249 printf("Watchdog ping rate set to %u seconds.\n", ping_rate);
270 printf("Watchdog timeout set to %u seconds.\n", flags);
288 printf("Watchdog pretimeout set to %u seconds.\n", flags);
341 printf("Watchdog Ticking Away!\n");
358 * enabled to ensure watchdog gets disabled on close.
362 printf("Stopping watchdog ticks failed (%d)...\n", errno);