/* * Program to read the temperature from * the PC Watchdog Board * by David Walker (dwalker@eskimo.com), * based on watchdog.c by Ken Hollis. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/pcwd.h> #define WD_DRIVER_VER "0.22" void main() { int fd, temp = 0; fd = open("/dev/temperature", O_RDONLY); if (fd == -1) { printf( "Either you don't have the Watchdog"); printf( "drivers enabled, or the device\n"); printf( "does not exist.\n"); exit(0); } while (1) { ioctl(fd, WDIOC_GETTEMP, &temp); printf("Temperature is %i degrees C\n", temp); sleep(15); } }