diff options
Diffstat (limited to '')
-rw-r--r-- | isdn.c | 10 | ||||
-rw-r--r-- | lcd4linux.c | 8 | ||||
-rw-r--r-- | processor.c | 14 | ||||
-rw-r--r-- | system.c | 38 |
4 files changed, 60 insertions, 10 deletions
@@ -1,4 +1,4 @@ -/* $Id: isdn.c,v 1.5 2000/03/13 15:58:24 reinelt Exp $ +/* $Id: isdn.c,v 1.6 2000/04/15 11:56:35 reinelt Exp $ * * ISDN specific functions * @@ -20,6 +20,10 @@ * * * $Log: isdn.c,v $ + * Revision 1.6 2000/04/15 11:56:35 reinelt + * + * more debug messages + * * Revision 1.5 2000/03/13 15:58:24 reinelt * * release 0.9 @@ -59,6 +63,7 @@ #include <sys/types.h> #include <linux/isdn.h> +#include "debug.h" #include "isdn.h" #include "filter.h" @@ -128,12 +133,15 @@ int Isdn (int *rx, int *tx, int *usage) perror ("open(/dev/isdninfo) failed"); return -1; } + debug ("open (/proc/isdninfo)=%d\n", fd); } + if (ioctl(fd, IIOCGETCPS, &cps)) { perror("ioctl(IIOCGETCPS) failed"); fd=-1; return -1; } + cps_i=0; cps_o=0; for (i=0; i<ISDN_MAX_CHANNELS; i++) { diff --git a/lcd4linux.c b/lcd4linux.c index 25210fc..602b70e 100644 --- a/lcd4linux.c +++ b/lcd4linux.c @@ -1,4 +1,4 @@ -/* $Id: lcd4linux.c,v 1.20 2000/04/15 11:13:54 reinelt Exp $ +/* $Id: lcd4linux.c,v 1.21 2000/04/15 11:56:35 reinelt Exp $ * * LCD4Linux * @@ -20,6 +20,10 @@ * * * $Log: lcd4linux.c,v $ + * Revision 1.21 2000/04/15 11:56:35 reinelt + * + * more debug messages + * * Revision 1.20 2000/04/15 11:13:54 reinelt * * added '-d' (debugging) switch @@ -253,6 +257,8 @@ int main (int argc, char *argv[]) lcd_clear(); } + debug ("starting main loop\n"); + smooth=0; while (1) { process (smooth); diff --git a/processor.c b/processor.c index 02b2775..6a4b715 100644 --- a/processor.c +++ b/processor.c @@ -1,4 +1,4 @@ -/* $Id: processor.c,v 1.4 2000/04/15 11:13:54 reinelt Exp $ +/* $Id: processor.c,v 1.5 2000/04/15 11:56:35 reinelt Exp $ * * main data processing * @@ -20,6 +20,10 @@ * * * $Log: processor.c,v $ + * Revision 1.5 2000/04/15 11:56:35 reinelt + * + * more debug messages + * * Revision 1.4 2000/04/15 11:13:54 reinelt * * added '-d' (debugging) switch @@ -383,14 +387,16 @@ static char *process_row (int r) void process_init (void) { int i; - char buffer[8]; load.overload=atof(cfg_get("overload")?:"2.0"); lcd_query (&rows, &cols, &xres, &yres, &supported_bars); debug ("%d rows, %d columns, %dx%d pixels\n", rows, cols, xres, yres); for (i=1; i<=rows; i++) { - snprintf (buffer, sizeof(buffer), "row%d", i); - row[i]=strdup(parse(cfg_get(buffer)?:"", supported_bars, token_usage)); + char buffer[8], *p; + snprintf (buffer, sizeof(buffer), "Row%d", i); + p=cfg_get(buffer)?:""; + debug ("%s: %s\n", buffer, p); + row[i]=strdup(parse(p, supported_bars, token_usage)); } } @@ -1,4 +1,4 @@ -/* $Id: system.c,v 1.10 2000/04/13 06:09:52 reinelt Exp $ +/* $Id: system.c,v 1.11 2000/04/15 11:56:35 reinelt Exp $ * * system status retreivement * @@ -20,6 +20,10 @@ * * * $Log: system.c,v $ + * Revision 1.11 2000/04/15 11:56:35 reinelt + * + * more debug messages + * * Revision 1.10 2000/04/13 06:09:52 reinelt * * added BogoMips() to system.c (not used by now, maybe sometimes we can @@ -126,8 +130,9 @@ #include <sys/utsname.h> #include <sys/param.h> -#include "system.h" +#include "debug.h" #include "cfg.h" +#include "system.h" #include "filter.h" static int parse_meminfo (char *tag, char *buffer) @@ -157,6 +162,7 @@ char *System(void) perror ("uname() failed"); strcpy (buffer, "unknown"); } else { + debug ("uname(sysname)=%s\n", ubuf.sysname); strncpy (buffer, ubuf.sysname, sizeof(buffer)); } } @@ -173,6 +179,7 @@ char *Release(void) perror ("uname() failed"); strcpy (buffer, "unknown"); } else { + debug ("uname(release)=%s\n", ubuf.release); strncpy (buffer, ubuf.release, sizeof(buffer)); } } @@ -189,6 +196,7 @@ char *Processor(void) perror ("uname() failed"); strcpy (buffer, "unknown"); } else { + debug ("uname(machine)=%s\n", ubuf.machine); strncpy (buffer, ubuf.machine, sizeof(buffer)); } } @@ -204,17 +212,20 @@ double BogoMips (void) if (val==-2) { char *p; - int fd=open("/proc/meminfo", O_RDONLY); + int fd=open("/proc/cpuinfo", O_RDONLY); if (fd==-1) { perror ("open(/proc/cpuinfo) failed"); val=-1; return -1; } + debug ("open(proc/cpuinfo)=%d\n", fd); if (read (fd, &buffer, sizeof(buffer)-1)==-1) { perror ("read(/proc/cpuinfo) failed"); + close (fd); val=-1; return -1; } + close (fd); p=strstr(buffer, "bogomips"); if (p==NULL) { fprintf (stderr, "parse(/proc/cpuinfo) failed: no 'bogomips' line\n"); @@ -226,6 +237,7 @@ double BogoMips (void) val=-1; return -1; } + debug ("BogoMips=%f\n", val); } return val; } @@ -240,6 +252,7 @@ int Memory(void) perror ("stat(/proc/kcore) failed"); value=0; } else { + debug ("sizeof(/proc/kcore)=%ld bytes\n", buf.st_size); value=buf.st_size>>20; } } @@ -274,6 +287,7 @@ int Ram (int *total, int *free, int *shared, int *buffered, int *cached) perror ("open(/proc/meminfo) failed"); return -1; } + debug ("open(/proc/meminfo)=%d\n", fd); } if (lseek(fd, 0L, SEEK_SET)!=0) { @@ -342,17 +356,21 @@ int Load (double *load1, double *load2, double *load3) perror ("open(/proc/loadavg) failed"); return -1; } + debug ("open(/proc/loadavg)=%d\n", fd); } + if (lseek(fd, 0L, SEEK_SET)!=0) { perror("lseek(/proc/loadavg) failed"); fd=-1; return -1; } + if (read (fd, &buffer, sizeof(buffer)-1)==-1) { perror("read(/proc/loadavg) failed"); fd=-1; return -1; } + if (sscanf(buffer, "%lf %lf %lf", &val1, &val2, &val3)<3) { fprintf(stderr, "scanf(/proc/loadavg) failed\n"); fd=-1; @@ -386,12 +404,15 @@ int Busy (double *user, double *nice, double *system, double *idle) perror ("open(proc/stat) failed"); return -1; } + debug ("open (/proc/stat)=%d\n", fd); } + if (lseek(fd, 0L, SEEK_SET)!=0) { perror ("lseek(/proc/stat) failed"); fd=-1; return -1; } + if (read (fd, &buffer, sizeof(buffer)-1)==-1) { perror ("read(/proc/stat) failed"); fd=-1; @@ -436,6 +457,7 @@ int Disk (int *r, int *w) perror ("open(/proc/stat) failed"); return -1; } + debug ("open (/proc/stat)=%d\n", fd); } if (lseek(fd, 0L, SEEK_SET)!=0) { @@ -494,6 +516,7 @@ int Net (int *rx, int *tx) perror ("open(/proc/net/dev) failed"); return -1; } + debug ("open (/proc/net/dev)=%d\n", fd); } if (lseek(fd, 0L, SEEK_SET)!=0) { @@ -501,11 +524,13 @@ int Net (int *rx, int *tx) fd=-1; return -1; } + if (read (fd, &buffer, sizeof(buffer)-1)==-1) { perror ("read(/proc/net/dev) failed"); fd=-1; return -1; } + pkg_rx=0; pkg_tx=0; p=buffer; @@ -561,25 +586,30 @@ int Sensor (int index, double *val, double *min, double *max) fd[index]=open(sensor[index], O_RDONLY); if (fd[index]==-1) { - fprintf (stderr, "open (%s) failed: %s\n", sensor[index], strerror(errno)); + fprintf (stderr, "open(%s) failed: %s\n", sensor[index], strerror(errno)); return -1; } + debug ("open (%s)=%d\n", sensor[index], fd[index]); } + if (lseek(fd[index], 0L, SEEK_SET)!=0) { fprintf (stderr, "lseek(%s) failed: %s\n", sensor[index], strerror(errno)); fd[index]=-1; return -1; } + if (read (fd[index], &buffer, sizeof(buffer)-1)==-1) { fprintf (stderr, "read(%s) failed: %s\n", sensor[index], strerror(errno)); fd[index]=-1; return -1; } + if (sscanf(buffer, "%*f %*f %lf", &value)<1) { fprintf (stderr, "scanf(%s) failed\n", sensor[index]); fd[index]=-1; return -1; } + val_buf[index]=value; *val=value; return 0; |