]> git.webhop.me Git - lcd4linux.git/commitdiff
[lcd4linux @ 2003-12-01 07:08:50 by reinelt]
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 1 Dec 2003 07:08:51 +0000 (07:08 +0000)
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Mon, 1 Dec 2003 07:08:51 +0000 (07:08 +0000)
Patches from Xavier:
 - WiFi: make interface configurable
 - "quiet" as an option from the config file
 - ignore missing "MemShared" on Linux 2.6

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@278 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

lcd4linux.c
system.c
wifi.c

index 3332ba4d39bcb5662e77988dd3029ed8b8901b9d..a0dde0c8d2bb1efb8d616e37153aaa20bfff360a 100644 (file)
@@ -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
  *
  *
  *
  * $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);
index dd638b54bab71cae425bd4f358bd92383bad3049..f013ddd2cc634ce9f3aa5e199a7d1af9353be818 100644 (file)
--- a/system.c
+++ b/system.c
@@ -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
  *
  *
  *
  * $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;
diff --git a/wifi.c b/wifi.c
index c1f6f05a53b21536ee320354334311b7460e8fda..1d1116eb1432e724a576d5aa4c857ddab4d139eb 100644 (file)
--- a/wifi.c
+++ b/wifi.c
@@ -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
  *
  *
  *
  * $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
  *
 #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;