diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2003-06-21 05:46:18 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2003-06-21 05:46:18 +0000 |
commit | 3f22aaebc992b44fefba8e47e0ed8dc4337aaaa6 (patch) | |
tree | ba403ab8b7cda8132daa2d4c288ca6398da7a56e | |
parent | 8f6dfc61f7f1a6c3784b4378cf147736666cce84 (diff) | |
download | lcd4linux-3f22aaebc992b44fefba8e47e0ed8dc4337aaaa6.tar.gz |
[lcd4linux @ 2003-06-21 05:46:18 by reinelt]
DVB client integrated
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@194 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.in | 8 | ||||
-rw-r--r-- | isdn.c | 7 | ||||
-rw-r--r-- | parser.c | 7 | ||||
-rw-r--r-- | parser.h | 11 | ||||
-rw-r--r-- | processor.c | 38 |
6 files changed, 60 insertions, 12 deletions
diff --git a/Makefile.am b/Makefile.am index f975678..fe3c489 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,6 +22,7 @@ isdn.c isdn.h \ mail.c mail.h \ seti.c seti.h \ battery.c battery.h \ +dvb.c dvb.h \ filter.c filter.h \ udelay.c udelay.h \ display.c display.h \ diff --git a/Makefile.in b/Makefile.in index 13055b7..52f7232 100644 --- a/Makefile.in +++ b/Makefile.in @@ -76,7 +76,7 @@ lcd4linux_LDFLAGS = $(X_LIBS) lcd4linux_LDADD = @DRIVERS@ @DRVLIBS@ lcd4linux_DEPENDENCIES = @DRIVERS@ -lcd4linux_SOURCES = lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h mail.c mail.h seti.c seti.h battery.c battery.h filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h bar.c bar.h fontmap.c fontmap.h exec.c exec.h mail2.c socket.c socket.h +lcd4linux_SOURCES = lcd4linux.c debug.c debug.h cfg.c cfg.h lock.c lock.h parser.c parser.h processor.c processor.h system.c system.h isdn.c isdn.h mail.c mail.h seti.c seti.h battery.c battery.h dvb.c dvb.h filter.c filter.h udelay.c udelay.h display.c display.h pixmap.c pixmap.h bar.c bar.h fontmap.c fontmap.h exec.c exec.h mail2.c socket.c socket.h EXTRA_lcd4linux_SOURCES = BeckmannEgle.c Crystalfontz.c Crystalfontz.h Cwlinux.c HD44780.c M50530.c T6963.c USBLCD.c MatrixOrbital.c PalmPilot.c Raster.c SIN.c Skeleton.c XWindow.c Text.c @@ -100,8 +100,8 @@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_PRE_LIBS = @X_PRE_LIBS@ lcd4linux_OBJECTS = lcd4linux.o debug.o cfg.o lock.o parser.o \ -processor.o system.o isdn.o mail.o seti.o battery.o filter.o udelay.o \ -display.o pixmap.o bar.o fontmap.o exec.o mail2.o socket.o +processor.o system.o isdn.o mail.o seti.o battery.o dvb.o filter.o \ +udelay.o display.o pixmap.o bar.o fontmap.o exec.o mail2.o socket.o CFLAGS = @CFLAGS@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -119,7 +119,7 @@ DEP_FILES = .deps/BeckmannEgle.P .deps/Crystalfontz.P .deps/Cwlinux.P \ .deps/HD44780.P .deps/M50530.P .deps/MatrixOrbital.P .deps/PalmPilot.P \ .deps/Raster.P .deps/SIN.P .deps/Skeleton.P .deps/T6963.P .deps/Text.P \ .deps/USBLCD.P .deps/XWindow.P .deps/bar.P .deps/battery.P .deps/cfg.P \ -.deps/debug.P .deps/display.P .deps/exec.P .deps/filter.P \ +.deps/debug.P .deps/display.P .deps/dvb.P .deps/exec.P .deps/filter.P \ .deps/fontmap.P .deps/isdn.P .deps/lcd4linux.P .deps/lock.P \ .deps/mail.P .deps/mail2.P .deps/parser.P .deps/pixmap.P \ .deps/processor.P .deps/seti.P .deps/socket.P .deps/system.P \ @@ -1,4 +1,4 @@ -/* $Id: isdn.c,v 1.9 2001/05/27 07:19:28 reinelt Exp $ +/* $Id: isdn.c,v 1.10 2003/06/21 05:46:18 reinelt Exp $ * * ISDN specific functions * @@ -20,6 +20,9 @@ * * * $Log: isdn.c,v $ + * Revision 1.10 2003/06/21 05:46:18 reinelt + * DVB client integrated + * * Revision 1.9 2001/05/27 07:19:28 reinelt * * fixed a warning in pixmap.c @@ -154,7 +157,7 @@ int Isdn (int *rx, int *tx, int *usage) error ("open(/dev/isdninfo) failed: %s", strerror(errno)); return -1; } - debug ("open (/proc/isdninfo)=%d", fd); + debug ("open (/dev/isdninfo)=%d", fd); } if (ioctl(fd, IIOCGETCPS, &cps)) { @@ -1,4 +1,4 @@ -/* $Id: parser.c,v 1.18 2002/12/05 19:23:01 reinelt Exp $ +/* $Id: parser.c,v 1.19 2003/06/21 05:46:18 reinelt Exp $ * * row definition parser * @@ -20,6 +20,9 @@ * * * $Log: parser.c,v $ + * Revision 1.19 2003/06/21 05:46:18 reinelt + * DVB client integrated + * * Revision 1.18 2002/12/05 19:23:01 reinelt * fixed undefined operations found by gcc3 * @@ -174,6 +177,8 @@ static SYMTAB Symtab[] = {{ "%", T_PERCENT, C_GENERIC, 0 }, { "bp", T_BATT_PERC, C_BATT, 1 }, { "bs", T_BATT_STAT, C_BATT, 0 }, { "bd", T_BATT_DUR, C_BATT, 0 }, + { "ss", T_DVB_STRENGTH, C_DVB, 1 }, + { "sn", T_DVB_SNR, C_DVB, 1 }, { "e*", T_MAIL, C_MAIL, 0 }, { "u*", T_MAIL_UNSEEN,C_MAIL, 0 }, { "s*", T_SENSOR, C_SENSOR, 1 }, @@ -1,4 +1,4 @@ -/* $Id: parser.h,v 1.11 2001/03/14 13:19:29 ltoetsch Exp $ +/* $Id: parser.h,v 1.12 2003/06/21 05:46:18 reinelt Exp $ * * row definition parser * @@ -20,6 +20,9 @@ * * * $Log: parser.h,v $ + * Revision 1.12 2003/06/21 05:46:18 reinelt + * DVB client integrated + * * Revision 1.11 2001/03/14 13:19:29 ltoetsch * Added pop3/imap4 mail support * @@ -86,15 +89,15 @@ typedef enum { T_ISDN_USED, T_ISDN_IN, T_ISDN_OUT, T_ISDN_TOTAL, T_ISDN_MAX, T_SETI_PRC, T_SETI_CPU, T_BATT_PERC, T_BATT_STAT, T_BATT_DUR, + T_DVB_STRENGTH, T_DVB_SNR, T_EXTENDED, T_MAIL, T_MAIL_UNSEEN, T_SENSOR, - T_EXEC + T_EXEC } TOKEN; typedef enum { - C_GENERIC, C_MEM, C_LOAD, C_CPU, C_DISK, C_ETH, C_PPP, C_ISDN, C_SETI, - C_BATT, + C_GENERIC, C_MEM, C_LOAD, C_CPU, C_DISK, C_ETH, C_PPP, C_ISDN, C_SETI, C_BATT, C_DVB, C_MAIL, C_SENSOR, C_EXEC } CLASS; diff --git a/processor.c b/processor.c index 5df882d..580c33e 100644 --- a/processor.c +++ b/processor.c @@ -1,4 +1,4 @@ -/* $Id: processor.c,v 1.31 2003/06/13 06:35:56 reinelt Exp $ +/* $Id: processor.c,v 1.32 2003/06/21 05:46:18 reinelt Exp $ * * main data processing * @@ -20,6 +20,9 @@ * * * $Log: processor.c,v $ + * Revision 1.32 2003/06/21 05:46:18 reinelt + * DVB client integrated + * * Revision 1.31 2003/06/13 06:35:56 reinelt * added scrolling capability * @@ -176,6 +179,7 @@ #include "processor.h" #include "mail.h" #include "battery.h" +#include "dvb.h" #include "seti.h" #include "exec.h" @@ -199,6 +203,7 @@ static struct { int perc, stat; double dur; } batt; static struct { double perc, cput; } seti; static struct { int num, unseen;} mail[MAILBOXES+1]; static struct { double val, min, max; } sensor[SENSORS+1]; +static struct { double strength, snr; } dvb; static double query (int token) { @@ -287,6 +292,11 @@ static double query (int token) case T_BATT_DUR: return batt.dur; + case T_DVB_STRENGTH: + return dvb.strength; + case T_DVB_SNR: + return dvb.snr; + case T_MAIL: return mail[(token>>8)-'0'].num; @@ -298,6 +308,7 @@ static double query (int token) case T_EXEC: return exec[(token>>8)-'0'].val; + } return 0.0; } @@ -363,6 +374,7 @@ static double query_bar (int token) value = 0; return value/100; } + case T_SENSOR: i=(token>>8)-'0'; return (value-sensor[i].min)/(sensor[i].max-sensor[i].min); @@ -376,27 +388,35 @@ static void print_token (int token, char **p, char *start, int maxlen) int i; switch (token & 255) { + case T_PERCENT: *(*p)++='%'; break; + case T_DOLLAR: *(*p)++='$'; break; + case T_OS: *p+=sprintf (*p, "%s", System()); break; + case T_RELEASE: *p+=sprintf (*p, "%s", Release()); break; + case T_CPU: *p+=sprintf (*p, "%s", Processor()); break; + case T_RAM: *p+=sprintf (*p, "%d", Memory()); break; + case T_OVERLOAD: *(*p)++=load.load1>load.overload?'!':' '; break; + case T_MEM_TOTAL: case T_MEM_USED: case T_MEM_FREE: @@ -406,6 +426,7 @@ static void print_token (int token, char **p, char *start, int maxlen) case T_MEM_AVAIL: *p+=sprintf (*p, "%6.0f", query(token)); break; + case T_LOAD_1: case T_LOAD_2: case T_LOAD_3: @@ -418,6 +439,7 @@ static void print_token (int token, char **p, char *start, int maxlen) else *p+=sprintf (*p, "%5.0f", val); break; + case T_CPU_USER: case T_CPU_NICE: case T_CPU_SYSTEM: @@ -425,6 +447,7 @@ static void print_token (int token, char **p, char *start, int maxlen) case T_CPU_IDLE: *p+=sprintf (*p, "%3.0f", 100.0*query(token)); break; + case T_ETH_RX: case T_ETH_TX: case T_ETH_MAX: @@ -434,6 +457,7 @@ static void print_token (int token, char **p, char *start, int maxlen) val/=1024.0; *p+=sprintf (*p, "%5.0f", val); break; + case T_ISDN_IN: case T_ISDN_OUT: case T_ISDN_MAX: @@ -443,12 +467,14 @@ static void print_token (int token, char **p, char *start, int maxlen) else *p+=sprintf (*p, " ----"); break; + case T_ISDN_USED: if (isdn.usage) *p+=sprintf (*p, "*"); else *p+=sprintf (*p, " "); break; + case T_SETI_PRC: val=100.0*query(token); if (val<100.0) @@ -497,6 +523,11 @@ static void print_token (int token, char **p, char *start, int maxlen) } break; + case T_DVB_STRENGTH: + case T_DVB_SNR: + *p+=sprintf (*p, "%5.1f", 100.0*query(token)); + break; + case T_EXEC: i = (token>>8)-'0'; *p+=sprintf (*p, "%.*s",cols-(*p-start), exec[i].s); @@ -567,6 +598,10 @@ static void collect_data (void) Battery (&batt.perc, &batt.stat, &batt.dur); } + if (token_usage[C_DVB]) { + DVB (&dvb.strength, &dvb.snr); + } + for (i=0; i<=MAILBOXES; i++) { if (token_usage[T_MAIL]&(1<<i) || token_usage[T_MAIL_UNSEEN]&(1<<i) ) { Mail (i, &mail[i].num, &mail[i].unseen); @@ -584,6 +619,7 @@ static void collect_data (void) Exec (i, exec[i].s, &exec[i].val); } } + } static char *process_row (int r) |