Moxa DA-682A-C7-W7E [61/112] Examples

Moxa DA-682A-C7-W7E [61/112] Examples
DA-682A Linux Softrware Programming Guide
4-5
IOCTL WDIOC_KEEPALIVE
Description This pings the card to tell it not to reset your computer.
Input None
Output None
Return On success, return 0. Otherwise, return < 0 value.
IOCTL WDIOC_SETTIMEOUT
Description Sets the watchdog timeout
Input arg: 1 ~ 255 seconds
Output
None
Return On success, return 0. Otherwise, return < 0 value.
IOCTL WDIOC_GETTIMEOUT
Description Gets the current watchdog timeout.
Input None
Output arg: 1 ~ 255 seconds
Return On success, return 0. Otherwise, return < 0 value.
Examples
This sample watchdog script, watchdog-simple.c, checks the watchdog every in 10 seconds.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main(void)
{
int fd = open("/dev/watchdog", O_WRONLY);
int ret = 0;
if (fd == -1) {
perror("watchdog");
exit(EXIT_FAILURE);
}
while (1) {
ret = write(fd, "\0", 1);
if (ret != 1) {
ret = -1;
break;
}
sleep(10);
}
close(fd);
return ret;
}
Hot-Swapping Block Drives
A development library is provided to help you develop your applications. All of the code can be found at
/example/hotswap on the software CD

Содержание

Похожие устройства