Skip to content

Commit ce3a677

Browse files
George G. Davisshuahkh
authored andcommitted
selftests: watchdog: Add command line option to show watchdog_info
With the new ioctl(WDIOC_GETSUPPORT) call in place, add a command line option to show the watchdog_info. Suggested-by: Eugeniu Rosca <[email protected]> Signed-off-by: George G. Davis <[email protected]> Signed-off-by: Eugeniu Rosca <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 8f9577e commit ce3a677

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tools/testing/selftests/watchdog/watchdog-test.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
int fd;
2121
const char v = 'V';
22-
static const char sopts[] = "bdehp:t:Tn:NLf:";
22+
static const char sopts[] = "bdehp:t:Tn:NLf:i";
2323
static const struct option lopts[] = {
2424
{"bootstatus", no_argument, NULL, 'b'},
2525
{"disable", no_argument, NULL, 'd'},
@@ -32,6 +32,7 @@ static const struct option lopts[] = {
3232
{"getpretimeout", no_argument, NULL, 'N'},
3333
{"gettimeleft", no_argument, NULL, 'L'},
3434
{"file", required_argument, NULL, 'f'},
35+
{"info", no_argument, NULL, 'i'},
3536
{NULL, no_argument, NULL, 0x0}
3637
};
3738

@@ -72,6 +73,7 @@ static void usage(char *progname)
7273
printf("Usage: %s [options]\n", progname);
7374
printf(" -f, --file\t\tOpen watchdog device file\n");
7475
printf("\t\t\tDefault is /dev/watchdog\n");
76+
printf(" -i, --info\t\tShow watchdog_info\n");
7577
printf(" -b, --bootstatus\tGet last boot status (Watchdog/POR)\n");
7678
printf(" -d, --disable\t\tTurn off the watchdog timer\n");
7779
printf(" -e, --enable\t\tTurn on the watchdog timer\n");
@@ -216,6 +218,18 @@ int main(int argc, char *argv[])
216218
case 'f':
217219
/* Handled above */
218220
break;
221+
case 'i':
222+
/*
223+
* watchdog_info was obtained as part of file open
224+
* validation. So we just show it here.
225+
*/
226+
oneshot = 1;
227+
printf("watchdog_info:\n");
228+
printf(" identity:\t\t%s\n", info.identity);
229+
printf(" firmware_version:\t%u\n",
230+
info.firmware_version);
231+
printf(" options:\t\t%08x\n", info.options);
232+
break;
219233

220234
default:
221235
usage(argv[0]);

0 commit comments

Comments
 (0)