[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: watchdog card may be initially disabled
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2009-04-20 9:26:15
Message-ID: 200904201126.15539.vda.linux () googlemail ! com
[Download RAW message or body]

On Sunday 19 April 2009 19:22, 八戒哥哥 wrote:
> The watchdog card may be initially disabled by BIOS.
> 
> Executing 'watchdog -T 3 -t 1 /dev/watchdog' and
> 
> 'kill -9 `pidof watchdog`' will not work, the machine will still run happyly.
> 
> you must exeute these commands twice to make watchdog take effect.
> 
> I cannot find a 'WDIOS_ENABLECARD' ioctl in busybox-1.13.3/miscutils/watchdog.c.
> 
> The only ioctl operation is 'WDIOC_SETTIMEOUT'.
> 
>  59         htimer_duration = htimer_duration / 1000;
>  60         ioctl_or_warn(3, WDIOC_SETTIMEOUT, &htimer_duration);
> 
> I suggest to add a 'WDIOC_SETOPTIONS' ioctl before 'WDIOC_SETTIMEOUT',
> 
> then, we can be sure the watchdog card is enabled.
> 
> +58         ioctl_or_warn(3, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);
> 
>   59         htimer_duration = htimer_duration / 1000;
>   60         ioctl_or_warn(3, WDIOC_SETTIMEOUT, &htimer_duration);


Please test this patch.
--
vda

["3.patch" (text/x-diff)]

diff -d -urpN busybox.2/miscutils/watchdog.c busybox.3/miscutils/watchdog.c
--- busybox.2/miscutils/watchdog.c	2009-04-19 19:00:27.000000000 +0200
+++ busybox.3/miscutils/watchdog.c	2009-04-20 11:22:26.000000000 +0200
@@ -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
 


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic