[PATCH] watchdog add settimeout ioctl

Tito farmatito at tiscali.it
Tue Aug 5 12:25:31 UTC 2008


On Tuesday 05 August 2008 13:18:06 Darius wrote:
> Hi All,
>
> this patch adds one more command line option for watchdog utility and small
> ioctl implementation for hardware WD timer setting. Now it is possible to
> set up userspace and hardware timers independently with different values.
>
> BR,
> Darius Augulis
Hi,
maybe you can you use this little optimization.

-	if (ioctl(3, WDIOC_SETTIMEOUT, &htimer_duration) != 0){
-		printf("error setting hardware timer!\n");
-		if (ioctl(3, WDIOC_GETTIMEOUT, &htimer_duration) != 0)
-			printf("ioctl not supported by device!\n");
-	}
+bb_ioctl_or_warn(3, WDIOC_SETTIMEOUT,  &htimer_duration);
+bb_ioctl_or_warn(3, WDIOC_GETTIMEOUT,  &htimer_duration);

This is untested. You should test what happens with htimer_duration
if one of the calls fails and if this could affect somehow the subsequent

+	printf("SW timer is %dms, HW timer is %dms\n",
+		stimer_duration, htimer_duration * 1000);

Just my 0,02 € cents ;-) 
Ciao,
Tito



More information about the busybox mailing list