From 6aa11c047514403281eb1655ead388f9b5fe0f61 Mon Sep 17 00:00:00 2001 From: reinelt Date: Fri, 16 Feb 2001 08:23:09 +0000 Subject: [lcd4linux @ 2001-02-16 08:23:09 by reinelt] new token 'ic' (ISDN connected) by Carsten Nau git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@81 3ae390bd-cb1e-0410-b409-cd5a39f66f1f --- README | 3 ++- parser.c | 7 ++++++- parser.h | 8 ++++++-- processor.c | 14 +++++++++++++- system.c | 13 ++++++++++--- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/README b/README index 255b171..07b135b 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ # -# $Id: README,v 1.10 2000/11/28 16:46:11 reinelt Exp $ +# $Id: README,v 1.11 2001/02/16 08:23:09 reinelt Exp $ # This is the README file for lcd4linux @@ -171,6 +171,7 @@ Tokens: 'io', ISDN bytes sent 'it', ISDN bytes total (received+send) 'im', ISDN bytes max (received, send) + 'ic', ISDN connected (0=offline, 1=online) 'ti', PPP bytes received 'to', PPP bytes sent 'tt', PPP bytes total (received+send) diff --git a/parser.c b/parser.c index 35f1b70..9bf856e 100644 --- a/parser.c +++ b/parser.c @@ -1,4 +1,4 @@ -/* $Id: parser.c,v 1.8 2001/02/14 07:40:16 reinelt Exp $ +/* $Id: parser.c,v 1.9 2001/02/16 08:23:09 reinelt Exp $ * * row definition parser * @@ -20,6 +20,10 @@ * * * $Log: parser.c,v $ + * Revision 1.9 2001/02/16 08:23:09 reinelt + * + * new token 'ic' (ISDN connected) by Carsten Nau + * * Revision 1.8 2001/02/14 07:40:16 reinelt * * first (incomplete) GPO implementation @@ -129,6 +133,7 @@ static SYMTAB Symtab[] = {{ "%", T_PERCENT, C_GENERIC, 0 }, { "io", T_ISDN_OUT, C_ISDN, 1 }, { "it", T_ISDN_TOTAL, C_ISDN, 1 }, { "im", T_ISDN_MAX, C_ISDN, 1 }, + { "ic", T_ISDN_CONNECT, C_ISDN, 0 }, { "ti", T_PPP_RX, C_PPP, 1 }, { "to", T_PPP_TX, C_PPP, 1 }, { "tt", T_PPP_TOTAL, C_PPP, 1 }, diff --git a/parser.h b/parser.h index fa6b4ac..8a0072c 100644 --- a/parser.h +++ b/parser.h @@ -1,4 +1,4 @@ -/* $Id: parser.h,v 1.6 2001/02/14 07:40:16 reinelt Exp $ +/* $Id: parser.h,v 1.7 2001/02/16 08:23:09 reinelt Exp $ * * row definition parser * @@ -20,6 +20,10 @@ * * * $Log: parser.h,v $ + * Revision 1.7 2001/02/16 08:23:09 reinelt + * + * new token 'ic' (ISDN connected) by Carsten Nau + * * Revision 1.6 2001/02/14 07:40:16 reinelt * * first (incomplete) GPO implementation @@ -65,7 +69,7 @@ typedef enum { T_DISK_READ, T_DISK_WRITE, T_DISK_TOTAL, T_DISK_MAX, T_ETH_RX, T_ETH_TX, T_ETH_TOTAL, T_ETH_MAX, T_PPP_RX, T_PPP_TX, T_PPP_TOTAL, T_PPP_MAX, - T_ISDN_IN, T_ISDN_OUT, T_ISDN_TOTAL, T_ISDN_MAX, + T_ISDN_IN, T_ISDN_OUT, T_ISDN_TOTAL, T_ISDN_MAX, T_ISDN_CONNECT, T_SENSOR_1, T_SENSOR_2, T_SENSOR_3, T_SENSOR_4, T_SENSOR_5, T_SENSOR_6, T_SENSOR_7, T_SENSOR_8, T_SENSOR_9 } TOKEN; diff --git a/processor.c b/processor.c index 50a3acf..71bc9e8 100644 --- a/processor.c +++ b/processor.c @@ -1,4 +1,4 @@ -/* $Id: processor.c,v 1.11 2001/02/14 07:40:16 reinelt Exp $ +/* $Id: processor.c,v 1.12 2001/02/16 08:23:09 reinelt Exp $ * * main data processing * @@ -20,6 +20,10 @@ * * * $Log: processor.c,v $ + * Revision 1.12 2001/02/16 08:23:09 reinelt + * + * new token 'ic' (ISDN connected) by Carsten Nau + * * Revision 1.11 2001/02/14 07:40:16 reinelt * * first (incomplete) GPO implementation @@ -181,6 +185,8 @@ static double query (int token) return isdn.total; case T_ISDN_MAX: return isdn.max; + case T_ISDN_CONNECT: + return isdn.usage; case T_PPP_RX: return ppp.rx; @@ -349,6 +355,12 @@ static void print_token (int token, char **p) else *p+=sprintf (*p, " ----"); break; + case T_ISDN_CONNECT: + if (isdn.usage) + *p+=sprintf (*p, "*",); + else + *p+=sprintf (*p, " "); + break; default: *p+=sprintf (*p, "%5.0f", query(token)); } diff --git a/system.c b/system.c index 8a55d04..ad24e54 100644 --- a/system.c +++ b/system.c @@ -1,4 +1,4 @@ -/* $Id: system.c,v 1.18 2000/11/17 10:36:23 reinelt Exp $ +/* $Id: system.c,v 1.19 2001/02/16 08:23:09 reinelt Exp $ * * system status retreivement * @@ -20,6 +20,10 @@ * * * $Log: system.c,v $ + * Revision 1.19 2001/02/16 08:23:09 reinelt + * + * new token 'ic' (ISDN connected) by Carsten Nau + * * Revision 1.18 2000/11/17 10:36:23 reinelt * * fixed parsing of /proc/net/dev for 2.0 kernels @@ -665,7 +669,9 @@ int PPP (int unit, int *rx, int *tx) static int fd=-2; struct ifpppstatsreq req; char buffer[16]; - + + static double junk=0; + *rx=0; *tx=0; @@ -689,9 +695,10 @@ int PPP (int unit, int *rx, int *tx) snprintf (buffer, sizeof(buffer), "ppp%d_rx", unit); *rx=smooth(buffer, 500, req.stats.p.ppp_ibytes); - snprintf (buffer, sizeof(buffer), "ppp%d_tx", unit); *tx=smooth(buffer, 500, req.stats.p.ppp_obytes); + debug ("ppp_tx=%f smooth=%f", (double)(req.stats.p.ppp_obytes-junk), (double)*tx); + junk=req.stats.p.ppp_obytes; return 0; } -- cgit v1.2.3