diff options
| -rw-r--r-- | README | 3 | ||||
| -rw-r--r-- | parser.c | 7 | ||||
| -rw-r--r-- | parser.h | 8 | ||||
| -rw-r--r-- | processor.c | 14 | ||||
| -rw-r--r-- | system.c | 13 | 
5 files changed, 37 insertions, 8 deletions
| @@ -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) @@ -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 <info@cnau.de> + *   * 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 }, @@ -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 <info@cnau.de> + *   * 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 <info@cnau.de> + *   * 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));    } @@ -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 <info@cnau.de> + *   * 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;  } | 
