* [PATCH] Documentation/watchdog: add timeout and ping rate control to watchdog-test.c
@ 2015-06-29 16:46 Timur Tabi
2015-07-23 3:56 ` Timur Tabi
2015-09-03 3:02 ` Timur Tabi
0 siblings, 2 replies; 4+ messages in thread
From: Timur Tabi @ 2015-06-29 16:46 UTC (permalink / raw)
To: Wim Van Sebroeck, linux-watchdog, Vipul Gandhi
The watchdog test program is much more useful if it can configure the
timeout value and ping rate. This will allow you to test actual timeouts.
Adds the -t parameter to set the timeout value (in seconds), and -p to set
the ping rate (number of seconds between pings).
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
Documentation/watchdog/src/watchdog-test.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c
index 3da8229..fcdde8f 100644
--- a/Documentation/watchdog/src/watchdog-test.c
+++ b/Documentation/watchdog/src/watchdog-test.c
@@ -41,6 +41,7 @@ static void term(int sig)
int main(int argc, char *argv[])
{
int flags;
+ unsigned int ping_rate = 1;
fd = open("/dev/watchdog", O_WRONLY);
@@ -63,22 +64,33 @@ int main(int argc, char *argv[])
fprintf(stderr, "Watchdog card enabled.\n");
fflush(stderr);
goto end;
+ } else if (!strncasecmp(argv[1], "-t", 2) && argv[2]) {
+ flags = atoi(argv[2]);
+ ioctl(fd, WDIOC_SETTIMEOUT, &flags);
+ fprintf(stderr, "Watchdog timeout set to %u seconds.\n", flags);
+ fflush(stderr);
+ goto end;
+ } else if (!strncasecmp(argv[1], "-p", 2) && argv[2]) {
+ ping_rate = strtoul(argv[2], NULL, 0);
+ fprintf(stderr, "Watchdog ping rate set to %u seconds.\n", ping_rate);
+ fflush(stderr);
} else {
- fprintf(stderr, "-d to disable, -e to enable.\n");
+ fprintf(stderr, "-d to disable, -e to enable, -t <n> to set " \
+ "the timeout,\n-p <n> to set the ping rate, and \n");
fprintf(stderr, "run by itself to tick the card.\n");
fflush(stderr);
goto end;
}
- } else {
- fprintf(stderr, "Watchdog Ticking Away!\n");
- fflush(stderr);
}
+ fprintf(stderr, "Watchdog Ticking Away!\n");
+ fflush(stderr);
+
signal(SIGINT, term);
while(1) {
keep_alive();
- sleep(1);
+ sleep(ping_rate);
}
end:
close(fd);
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Documentation/watchdog: add timeout and ping rate control to watchdog-test.c
2015-06-29 16:46 [PATCH] Documentation/watchdog: add timeout and ping rate control to watchdog-test.c Timur Tabi
@ 2015-07-23 3:56 ` Timur Tabi
2015-08-09 20:58 ` Timur Tabi
2015-09-03 3:02 ` Timur Tabi
1 sibling, 1 reply; 4+ messages in thread
From: Timur Tabi @ 2015-07-23 3:56 UTC (permalink / raw)
To: Timur Tabi; +Cc: Wim Van Sebroeck, linux-watchdog
On Mon, Jun 29, 2015 at 11:46 AM, Timur Tabi <timur@codeaurora.org> wrote:
> The watchdog test program is much more useful if it can configure the
> timeout value and ping rate. This will allow you to test actual timeouts.
>
> Adds the -t parameter to set the timeout value (in seconds), and -p to set
> the ping rate (number of seconds between pings).
>
> Signed-off-by: Timur Tabi <timur@codeaurora.org>
Wim, any chance of getting this patch into 4.2?
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Documentation/watchdog: add timeout and ping rate control to watchdog-test.c
2015-07-23 3:56 ` Timur Tabi
@ 2015-08-09 20:58 ` Timur Tabi
0 siblings, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2015-08-09 20:58 UTC (permalink / raw)
To: Timur Tabi; +Cc: Wim Van Sebroeck, linux-watchdog
On Wed, Jul 22, 2015 at 8:56 PM, Timur Tabi <timur@codeaurora.org> wrote:
> On Mon, Jun 29, 2015 at 11:46 AM, Timur Tabi <timur@codeaurora.org> wrote:
>> The watchdog test program is much more useful if it can configure the
>> timeout value and ping rate. This will allow you to test actual timeouts.
>>
>> Adds the -t parameter to set the timeout value (in seconds), and -p to set
>> the ping rate (number of seconds between pings).
>>
>> Signed-off-by: Timur Tabi <timur@codeaurora.org>
>
> Wim, any chance of getting this patch into 4.2?
Wim? If not 4.2, then 4.3? I think it's a pretty harmless patch, and
it works well for us.
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Documentation/watchdog: add timeout and ping rate control to watchdog-test.c
2015-06-29 16:46 [PATCH] Documentation/watchdog: add timeout and ping rate control to watchdog-test.c Timur Tabi
2015-07-23 3:56 ` Timur Tabi
@ 2015-09-03 3:02 ` Timur Tabi
1 sibling, 0 replies; 4+ messages in thread
From: Timur Tabi @ 2015-09-03 3:02 UTC (permalink / raw)
To: Timur Tabi; +Cc: Wim Van Sebroeck, linux-watchdog
On Mon, Jun 29, 2015 at 11:46 AM, Timur Tabi <timur@codeaurora.org> wrote:
> The watchdog test program is much more useful if it can configure the
> timeout value and ping rate. This will allow you to test actual timeouts.
>
> Adds the -t parameter to set the timeout value (in seconds), and -p to set
> the ping rate (number of seconds between pings).
>
> Signed-off-by: Timur Tabi <timur@codeaurora.org>
Wim, can you take this patch for 4.3?
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-03 3:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-29 16:46 [PATCH] Documentation/watchdog: add timeout and ping rate control to watchdog-test.c Timur Tabi
2015-07-23 3:56 ` Timur Tabi
2015-08-09 20:58 ` Timur Tabi
2015-09-03 3:02 ` Timur Tabi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.