diff options
author | George G. Davis <george_davis@mentor.com> | 2019-09-17 14:40:23 -0400 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2019-10-02 15:44:43 -0400 |
commit | ce3a677802121e038d2f062e90f96f84e7351da0 (patch) | |
tree | 1443466086cfae8b58897b6e8aeca604063a803d /tools | |
parent | 8f9577eda5b74de4bd8b186c67f20736bdea6e07 (diff) |
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 <erosca@de.adit-jv.com>
Signed-off-by: George G. Davis <george_davis@mentor.com>
Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/watchdog/watchdog-test.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c index 6ed822dc2222..f45e510500c0 100644 --- a/tools/testing/selftests/watchdog/watchdog-test.c +++ b/tools/testing/selftests/watchdog/watchdog-test.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | int fd; | 20 | int fd; |
21 | const char v = 'V'; | 21 | const char v = 'V'; |
22 | static const char sopts[] = "bdehp:t:Tn:NLf:"; | 22 | static const char sopts[] = "bdehp:t:Tn:NLf:i"; |
23 | static const struct option lopts[] = { | 23 | static const struct option lopts[] = { |
24 | {"bootstatus", no_argument, NULL, 'b'}, | 24 | {"bootstatus", no_argument, NULL, 'b'}, |
25 | {"disable", no_argument, NULL, 'd'}, | 25 | {"disable", no_argument, NULL, 'd'}, |
@@ -32,6 +32,7 @@ static const struct option lopts[] = { | |||
32 | {"getpretimeout", no_argument, NULL, 'N'}, | 32 | {"getpretimeout", no_argument, NULL, 'N'}, |
33 | {"gettimeleft", no_argument, NULL, 'L'}, | 33 | {"gettimeleft", no_argument, NULL, 'L'}, |
34 | {"file", required_argument, NULL, 'f'}, | 34 | {"file", required_argument, NULL, 'f'}, |
35 | {"info", no_argument, NULL, 'i'}, | ||
35 | {NULL, no_argument, NULL, 0x0} | 36 | {NULL, no_argument, NULL, 0x0} |
36 | }; | 37 | }; |
37 | 38 | ||
@@ -72,6 +73,7 @@ static void usage(char *progname) | |||
72 | printf("Usage: %s [options]\n", progname); | 73 | printf("Usage: %s [options]\n", progname); |
73 | printf(" -f, --file\t\tOpen watchdog device file\n"); | 74 | printf(" -f, --file\t\tOpen watchdog device file\n"); |
74 | printf("\t\t\tDefault is /dev/watchdog\n"); | 75 | printf("\t\t\tDefault is /dev/watchdog\n"); |
76 | printf(" -i, --info\t\tShow watchdog_info\n"); | ||
75 | printf(" -b, --bootstatus\tGet last boot status (Watchdog/POR)\n"); | 77 | printf(" -b, --bootstatus\tGet last boot status (Watchdog/POR)\n"); |
76 | printf(" -d, --disable\t\tTurn off the watchdog timer\n"); | 78 | printf(" -d, --disable\t\tTurn off the watchdog timer\n"); |
77 | printf(" -e, --enable\t\tTurn on the watchdog timer\n"); | 79 | printf(" -e, --enable\t\tTurn on the watchdog timer\n"); |
@@ -216,6 +218,18 @@ int main(int argc, char *argv[]) | |||
216 | case 'f': | 218 | case 'f': |
217 | /* Handled above */ | 219 | /* Handled above */ |
218 | break; | 220 | 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; | ||
219 | 233 | ||
220 | default: | 234 | default: |
221 | usage(argv[0]); | 235 | usage(argv[0]); |