|
|
@@ -1288,8 +1288,6 @@ static int wdog_init(void)
|
|
|
|
|
|
#ifdef USE_WDOG
|
|
|
char *path="/dev/watchdog";
|
|
|
- struct watchdog_info info;
|
|
|
- int option = WDIOS_DISABLECARD;
|
|
|
|
|
|
if(wdog_fd<0) {
|
|
|
wdog_fd = open(path, O_RDWR); //O_WRONLY
|
|
|
@@ -1300,6 +1298,10 @@ static int wdog_init(void)
|
|
|
}
|
|
|
|
|
|
#if 0
|
|
|
+ int i,option,timeout;
|
|
|
+ struct watchdog_info info;
|
|
|
+
|
|
|
+ option = WDIOS_DISABLECARD;
|
|
|
r = ioctl(wdog_fd, WDIOC_SETOPTIONS, &option);
|
|
|
|
|
|
r = ioctl(wdog_fd, WDIOC_GETSUPPORT, &info);
|
|
|
@@ -1309,7 +1311,11 @@ static int wdog_init(void)
|
|
|
}
|
|
|
printf("___ watchdog options: 0x%x\n", info.options&WDIOC_SETTIMEOUT);
|
|
|
|
|
|
+ timeout = 100;
|
|
|
r = ioctl(wdog_fd, WDIOC_SETTIMEOUT, &timeout);
|
|
|
+ if(r) {
|
|
|
+ printf("______set__________ wdog set timeout: %d failed, errno: %d\n", timeout, errno);
|
|
|
+ }
|
|
|
|
|
|
option = WDIOS_ENABLECARD;
|
|
|
r = ioctl(wdog_fd, WDIOC_SETOPTIONS, &option);
|
|
|
@@ -1331,15 +1337,15 @@ static int wdog_enable(int en)
|
|
|
}
|
|
|
static int wdog_feed(void)
|
|
|
{
|
|
|
- int r=0,t1=100,t2=0;
|
|
|
+ int r=0,t1=200,t2=0;
|
|
|
|
|
|
#ifdef USE_WDOG
|
|
|
- r = ioctl(wdog_fd, WDIOC_KEEPALIVE, NULL);
|
|
|
+ r = ioctl(wdog_fd, WDIOC_KEEPALIVE, 0);
|
|
|
|
|
|
//r = ioctl(wdog_fd, WDIOC_SETTIMEOUT, &t1);
|
|
|
- //printf("______set__________ wdog timeout: %d\n", r);
|
|
|
- //r = ioctl(wdog_fd, WDIOC_GETTIMEOUT, &t2);
|
|
|
- //printf("________________ wdog timeout: %d\n", t2);
|
|
|
+ //printf("______set__________ wdog timeout: %d, errno: %d\n", r, errno);
|
|
|
+ r = ioctl(wdog_fd, WDIOC_GETTIMEOUT, &t2);
|
|
|
+ printf("________________ wdog timeout: %d\n", t2);
|
|
|
#endif
|
|
|
return r;
|
|
|
}
|