summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2009-04-20 09:26:17 +0000
committerDenis Vlasenko2009-04-20 09:26:17 +0000
commite41fdbc2795e098887af2c5bff3294753b97ffb5 (patch)
treeb58d80036beaa95082fc2fcd43688146e7a7d6af
parent8c64e033c0076196a6d7d30ddd922cd6feb15c13 (diff)
downloadbusybox-e41fdbc2795e098887af2c5bff3294753b97ffb5.zip
busybox-e41fdbc2795e098887af2c5bff3294753b97ffb5.tar.gz
watchdog: enable it before setting timeout
function old new delta watchdog_main 239 259 +20 static.enable - 4 +4
-rw-r--r--miscutils/watchdog.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index f85138e..893cef0 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -59,13 +59,20 @@ int watchdog_main(int argc, char **argv)
/* WDIOC_SETTIMEOUT takes seconds, not milliseconds */
htimer_duration = htimer_duration / 1000;
#ifndef WDIOC_SETTIMEOUT
-#error WDIOC_SETTIMEOUT is not defined, cannot compile watchdog applet
+# error WDIOC_SETTIMEOUT is not defined, cannot compile watchdog applet
#else
+# if defined WDIOC_SETOPTIONS && defined WDIOS_ENABLECARD
+ {
+ static const int enable = WDIOS_ENABLECARD;
+ ioctl_or_warn(3, WDIOC_SETOPTIONS, (void*) &enable);
+ }
+# endif
ioctl_or_warn(3, WDIOC_SETTIMEOUT, &htimer_duration);
#endif
+
#if 0
ioctl_or_warn(3, WDIOC_GETTIMEOUT, &htimer_duration);
- printf("watchdog: SW timer is %dms, HW timer is %dms\n",
+ printf("watchdog: SW timer is %dms, HW timer is %ds\n",
stimer_duration, htimer_duration * 1000);
#endif