diff options
author | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2003-12-01 07:08:51 +0000 |
---|---|---|
committer | reinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2003-12-01 07:08:51 +0000 |
commit | 6ace72e8fcfdca9f7d92816da58b204b6d2c7893 (patch) | |
tree | 81f74288135143f6e755a556defbddfdbb6f7407 /wifi.c | |
parent | 7e0ca2796bf0e4dbec689211ba00ce86a393b83c (diff) | |
download | lcd4linux-6ace72e8fcfdca9f7d92816da58b204b6d2c7893.tar.gz |
[lcd4linux @ 2003-12-01 07:08:50 by reinelt]
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
Diffstat (limited to '')
-rw-r--r-- | wifi.c | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -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; |