diff options
| -rw-r--r-- | lcd4linux.c | 14 | ||||
| -rw-r--r-- | system.c | 14 | ||||
| -rw-r--r-- | wifi.c | 25 | 
3 files changed, 42 insertions, 11 deletions
diff --git a/lcd4linux.c b/lcd4linux.c index 3332ba4..a0dde0c 100644 --- a/lcd4linux.c +++ b/lcd4linux.c @@ -1,4 +1,4 @@ -/* $Id: lcd4linux.c,v 1.51 2003/11/16 09:45:49 reinelt Exp $ +/* $Id: lcd4linux.c,v 1.52 2003/12/01 07:08:50 reinelt Exp $   *   * LCD4Linux   * @@ -22,6 +22,13 @@   *   *   * $Log: lcd4linux.c,v $ + * Revision 1.52  2003/12/01 07:08:50  reinelt + * + * Patches from Xavier: + *  - WiFi: make interface configurable + *  - "quiet" as an option from the config file + *  - ignore missing "MemShared" on Linux 2.6 + *   * Revision 1.51  2003/11/16 09:45:49  reinelt   * Crystalfontz changes, small glitch in getopt() fixed   * @@ -525,6 +532,11 @@ int main (int argc, char *argv[])      pid_exit(PIDFILE);      exit (0);    } + +  // check the conf to see if quiet startup is wanted  +  if (!quiet) { +    quiet = atoi(cfg_get("Quiet", "0")); +  }    if (!quiet && hello()) {      sleep (3); @@ -1,4 +1,4 @@ -/* $Id: system.c,v 1.30 2003/10/05 17:58:50 reinelt Exp $ +/* $Id: system.c,v 1.31 2003/12/01 07:08:51 reinelt Exp $   *   * system status retreivement   * @@ -22,6 +22,13 @@   *   *   * $Log: system.c,v $ + * Revision 1.31  2003/12/01 07:08:51  reinelt + * + * Patches from Xavier: + *  - WiFi: make interface configurable + *  - "quiet" as an option from the config file + *  - ignore missing "MemShared" on Linux 2.6 + *   * Revision 1.30  2003/10/05 17:58:50  reinelt   * libtool junk; copyright messages cleaned up   * @@ -412,8 +419,13 @@ int Ram (int *total, int *free, int *shared, int *buffered, int *cached)      return -1;    }    if ((v3=parse_meminfo ("MemShared:", buffer))<0) { +    // The "MemShared" entriy disappeared in Kernel 2.6... +#if 0      fd=-1;      return -1; +#else +    v3=0; +#endif    }    if ((v4=parse_meminfo ("Buffers:", buffer))<0) {      fd=-1; @@ -1,4 +1,4 @@ -/* $Id: wifi.c,v 1.2 2003/11/28 18:34:55 nicowallmeier Exp $ +/* $Id: wifi.c,v 1.3 2003/12/01 07:08:51 reinelt Exp $   *   * WIFI specific functions   * @@ -25,6 +25,13 @@   *   *   * $Log: wifi.c,v $ + * Revision 1.3  2003/12/01 07:08:51  reinelt + * + * Patches from Xavier: + *  - WiFi: make interface configurable + *  - "quiet" as an option from the config file + *  - ignore missing "MemShared" on Linux 2.6 + *   * Revision 1.2  2003/11/28 18:34:55  nicowallmeier   * Minor bugfixes   * @@ -56,12 +63,7 @@  #include "debug.h"  #include "wifi.h"  #include "filter.h" - -typedef struct { -  int signal; -  int link; -  int noise; -} CPS; +#include "cfg.h"  int Wifi (int *signal, int *link, int *noise)  { @@ -69,14 +71,18 @@ int Wifi (int *signal, int *link, int *noise)    static int fd=-2;    char buffer[4096];      char *p; + +  char *interface=cfg_get("Wifi.Interface","wlan0"); +    *signal=0;    *link=0;    *noise=0; +    if (fd==-1) return -1;	    if (fd==-2) {      fd = open("/proc/net/wireless", O_RDONLY);   // the real procfs file -    // fd = open("/wireless", O_RDONLY);         // a fake file for testing +    //fd = open("/wireless", O_RDONLY);         // a fake file for testing      if (fd==-1) {        error ("open(/proc/net/wireless) failed: %s", strerror(errno));        return -1; @@ -96,8 +102,9 @@ int Wifi (int *signal, int *link, int *noise)      return -1;    } -  p=strstr(buffer, "wlan0"); +  p=strstr(buffer, interface);    if (p!=NULL) { +  // TODO : size of interface ??       if (sscanf(p+13, "%d", &wl)!=1) {         error ("parse(/proc/net/wireless) failed: unknown format");        fd=-1;  | 
