diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/Makefile.in /usr6/buildroot/build_arm/wavemon-0.5.0z/Makefile.in
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/Makefile.in	2002-12-21 07:56:09.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/Makefile.in	2005-09-23 08:37:22.000000000 -0600
@@ -9,7 +9,7 @@
 
 CFLAGS = @CFLAGS@
 
-OBJECTS = conf.o llist.o ui.o error.o timer.o info_scr.o lhist_scr.o aplst_scr.o conf_scr.o help_scr.o about_scr.o iw_if.o net_if.o
+OBJECTS = conf.o llist.o ui.o iwlib.o error.o timer.o info_scr.o lhist_scr.o aplst_scr.o conf_scr.o help_scr.o about_scr.o iw_if.o net_if.o
 
 all: wavemon
 
@@ -30,6 +30,8 @@
 
 info_scr.o: info_scr.c info_scr.h defs.h
 
+iwlib.o: iwlib.o iwlib.h 
+
 lhist_scr.o: lhist_scr.c lhist_scr.h defs.h
 
 aplst_scr.o: aplst_scr.c aplst_scr.h defs.h
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/about_scr.c /usr6/buildroot/build_arm/wavemon-0.5.0z/about_scr.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/about_scr.c	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/about_scr.c	2005-09-22 10:46:19.000000000 -0600
@@ -103,12 +103,14 @@
 			key = wgetch(w_menu);
 			usleep(5000); 
 		} while (key <= 0);
-	} while (key < 265 || key > 275);
+//	} while (key < 265 || key > 275);
+	} while (key < 49 || key > 59);
 	
 	free_scramble();
 	
 	werase(w_about); wrefresh(w_about); delwin(w_about);
 	werase(w_menu); wrefresh(w_menu); delwin(w_menu);
 	
-	return key - 265;
+//	return key - 265;
+	return key - 49;
 }
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/aplst_scr.c /usr6/buildroot/build_arm/wavemon-0.5.0z/aplst_scr.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/aplst_scr.c	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/aplst_scr.c	2005-09-24 22:04:23.000000000 -0600
@@ -43,43 +43,35 @@
 		mvwhline(w_aplst, i, 1, ' ', xsize - 2);
 
 	if (iw_get_aplist(ifname, &axp)) {
+
 		if (axp.num) {
 			sprintf(s, "%d access point(s) in range.", axp.num);
-			mvwaddstr(w_aplst, 1, 1, s);
+			waddstr_center(w_aplst,(LINES >> 1) - 1, s);
 
-			if (axp.has_quality) {
-				for (i = 0; i < axp.num; i++) {
-					wmove(w_aplst, 3 + i * 2, 1);
-					sprintf(s, "%2d ", i);
-					waddstr(w_aplst, s);
-					sprintf(s, "%2hhX:%2hhX:%2hhX:%2hhX:%2hhX:%2hhX",
-							axp.aplist[i].addr.sa_data[0], axp.aplist[i].addr.sa_data[1], 
-							axp.aplist[i].addr.sa_data[2], axp.aplist[i].addr.sa_data[3], 
-							axp.aplist[i].addr.sa_data[4], axp.aplist[i].addr.sa_data[5]);
-					waddstr_b(w_aplst, s);
+				wmove(w_aplst, 2, 1);
+				sprintf(s, "        MAC ADDR     ESSID     Quality");
+				waddstr(w_aplst, s);
 
-					wmove(w_aplst, 4 + i * 2, 1);
-					sprintf(s, "Link quality: %d, signal level: %d, noise level: %d",
-							axp.aplist[i].quality.qual, axp.aplist[i].quality.level,
-							axp.aplist[i].quality.noise);
-					waddstr(w_aplst, s);
-				}
-			} else {
 				for (i = 0; i < axp.num; i++) {
 					wmove(w_aplst, 3 + i, 1);
-					sprintf(s, "%2d ", i);
+					sprintf(s, "%2d ", i + 1 );
 					waddstr(w_aplst, s);
-					sprintf(s, "%2hhX:%2hhX:%2hhX:%2hhX:%2hhX:%2hhX",
+					sprintf(s, "%02hhX:%02hhX:%02hhX:%02hhX:%02hhX:%02hhX",
+							
 							axp.aplist[i].addr.sa_data[0], axp.aplist[i].addr.sa_data[1], 
 							axp.aplist[i].addr.sa_data[2], axp.aplist[i].addr.sa_data[3], 
 							axp.aplist[i].addr.sa_data[4], axp.aplist[i].addr.sa_data[5]);
+					waddstr(w_aplst, s);
+					sprintf(s, " %s",axp.aplist[i].essid);
 					waddstr_b(w_aplst, s);
+					sprintf(s, " Q:%d",axp.aplist[i].quality);
+					waddstr(w_aplst, s);
 				}
-				waddstr_center(w_aplst, 4 + axp.num, "No link quality information available.");
+//				waddstr_center(w_aplst, 4 + axp.num, "No link quality information available.");
 			}
 
 		} else waddstr_center(w_aplst, (LINES >> 1) - 1, "No access points in range.");
-	} else waddstr_center(w_aplst, (LINES >> 1) - 1, "Access point list not available.");
+
 }
 
 int scr_aplst(struct wavemon_conf *wmconf) {
@@ -95,7 +87,7 @@
 	wmenubar(w_menu, 2);
 	wmove(w_menu, 1, 0);
 	nodelay(w_menu, TRUE); keypad(w_menu, TRUE);
-
+	
 	wrefresh(w_aplst);
 	wrefresh(w_menu);
 	
@@ -105,14 +97,16 @@
 			wrefresh(w_aplst);
 			wmove(w_menu, 1, 0);
 			wrefresh(w_menu);
-			start_timer(&t1, 50000);
-			while (!end_timer(&t1) && (key = wgetch(w_menu)) <= 0) usleep(5000);
+			start_timer(&t1, 5000000);
+			while (!end_timer(&t1) && (key = wgetch(w_menu)) <= 0) usleep(50000);
 		} while (key <= 0);
 		while (!end_timer(&t1));
-	} while (key < 265 || key > 275);
+//	} while (key < 265 || key > 275);
+	} while (key < 49 || key > 59);
 	
 	werase(w_aplst); wrefresh(w_aplst); delwin(w_aplst);
 	werase(w_menu); wrefresh(w_menu); delwin(w_menu);
 	
-	return key - 265;
+//	return key - 265;
+	return key - 49;
 }
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/conf.c /usr6/buildroot/build_arm/wavemon-0.5.0z/conf.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/conf.c	2002-12-21 08:27:14.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/conf.c	2005-09-18 10:30:17.000000000 -0600
@@ -410,7 +410,7 @@
 									}
 									break;
 					case t_sep: 	/* gcc -Wall sucks */
-					case t_func:
+					case t_func: break;
 				}
 			}
 		}
@@ -481,7 +481,7 @@
 							break;
 				case t_listval: sprintf(rv, "%s", (char *)ci->v);
 				case t_sep: break;
-				case t_func:
+				case t_func: break;
 			}
 			
 			add = 1;
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/conf_scr.c /usr6/buildroot/build_arm/wavemon-0.5.0z/conf_scr.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/conf_scr.c	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/conf_scr.c	2005-09-19 09:50:15.000000000 -0600
@@ -63,7 +63,7 @@
 			case t_listval:	strncpy(s, (char *)item->v, 32);
 							break;
 			case t_sep:		/* gcc -Wall sucks */
-			case t_func:
+			case t_func: break;
 		}
 
 		if (!item->unit) {
@@ -95,7 +95,7 @@
 	}
 }
 
-void change_item(int inum, char sign, char accel)
+void change_item(int inum, int sign, char accel)
 {
 	struct conf_item *item = ll_get(conf_items, inum);
 	int tmp;
@@ -136,7 +136,7 @@
 						strncpy((char *)item->v, ll_get(item->list, tmp), 32);
 						break;
 		case t_sep:		/* gcc -Wall sucks */
-		case t_func:
+		case t_func: break;
 	}
 }	
 
@@ -252,11 +252,13 @@
 								func();
 							}
 		}
-	} while (key < 265 || key > 275);
+//	} while (key < 265 || key > 275);
+	} while (key < 49 || key > 59);
 	
 	werase(w_conf); wrefresh(w_conf); delwin(w_conf);
 	delwin(w_confpad);
 	werase(w_menu); wrefresh(w_menu); delwin(w_menu);
 
-	return key - 265;
+//	return key - 265;
+	return key - 49;
 }
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/help_scr.c /usr6/buildroot/build_arm/wavemon-0.5.0z/help_scr.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/help_scr.c	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/help_scr.c	2005-09-18 15:44:28.000000000 -0600
@@ -52,10 +52,12 @@
 			key = wgetch(w_menu); 
 			usleep(5000);
 		} while (key <= 0);
-	} while (key < 265 || key > 275);
+//	} while (key < 265 || key > 275);
+	} while (key < 49 || key > 59);
 	
 	werase(w_help); wrefresh(w_help); delwin(w_help);
 	werase(w_menu); wrefresh(w_menu); delwin(w_menu);
 	
-	return key - 265;
+//	return key - 265;
+	return key - 49;
 }
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/info_scr.c /usr6/buildroot/build_arm/wavemon-0.5.0z/info_scr.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/info_scr.c	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/info_scr.c	2005-09-19 11:51:44.000000000 -0600
@@ -133,15 +133,16 @@
 	
 	wmove(w_stats, 1, 1);
 	
-	waddstr(w_stats, "RX: ");
+	waddstr(w_stats, "RX:");
 	sprintf(tmp, "%llu (%llu)", nstat.rx_packets, nstat.rx_bytes);
 	waddstr_b(w_stats, tmp);
 	
-	waddstr(w_stats, ",  TX: ");
+	waddstr(w_stats, ",TX:");
 	sprintf(tmp, "%llu (%llu)", nstat.tx_packets, nstat.tx_bytes);
 	waddstr_b(w_stats, tmp);
 	
-	waddstr(w_stats, ",  inv: ");
+	wmove(w_stats, 2, 1);
+	waddstr(w_stats, "inv: ");
 	sprintf(tmp, "%lu", iw_stats.dsc_nwid);
 	waddstr_b(w_stats, tmp);
 	waddstr(w_stats, " nwid, ");
@@ -179,37 +180,42 @@
 	iw_getinf_dyn(ifname, &info);
 
 	wmove(w_if, 1, 1);
-	sprintf(tmp, "%s (%s)", ifname, info.name);
+//	sprintf(tmp, "%s (%s)", ifname, info.name);
+	sprintf(tmp, "%s", info.name);
 	waddstr_b(w_if, tmp);
+
 	
-	waddstr(w_if, ",  ESSID: ");
+	waddstr(w_if, ",  ESSID:");
 	if (info.cap_essid) {
 		sprintf(tmp, "\"%s\"", info.essid);
 		waddstr_b(w_if, tmp);
 	} else waddstr(w_if, "n/a");
 	
-	waddstr(w_if, ",  nick: ");
+	wmove(w_if, 2, 1);
+
+	waddstr(w_if, "Nick: ");
 	if (info.cap_nickname) {
 		sprintf(tmp, "\"%s\"", info.nickname);
 		waddstr_b(w_if, tmp);
 	} else waddstr(w_if, "n/a");
 		
 	wmove(w_info, 1, 1);
-	waddstr(w_info, "frequency: ");
+	waddstr(w_info, "freq:");
 	if (info.cap_freq) {
 		sprintf(tmp, "%.4f GHz", info.freq);
 		waddstr_b(w_info, tmp);
 	} else waddstr(w_if, "n/a");
 
-	waddstr(w_info, ",  sensitivity: ");
+	waddstr(w_info, ",sens:");
 	if (info.cap_sens) {
 		sprintf(tmp, "%ld/%d", info.sens, range.sensitivity);
 		waddstr_b(w_info, tmp);
 	} else waddstr(w_info, "n/a");
 
-	waddstr(w_info, ",  TX power: ");
+	waddstr(w_info, ",TXpwr:");
 	if (info.cap_txpower) {
-		sprintf(tmp, "%d dBm (%.2f mW)", info.txpower_dbm, info.txpower_mw);
+//		sprintf(tmp, "%d dBm (%.2f mW)", info.txpower_dbm, info.txpower_mw);
+		sprintf(tmp, "%d dBm", info.txpower_dbm);
 		waddstr_b(w_info, tmp);
 	} else waddstr(w_info, "n/a");
 	
@@ -219,7 +225,7 @@
 	else waddstr(w_info, "n/a");
 
 	if (info.mode != 1) {
-		waddstr(w_info, ",  access point: ");
+		waddstr(w_info, ",  AP:");
 		if (info.cap_ap) {
 			sprintf(tmp, "%02hhX:%02hhX:%02hhX:%02hhX:%02hhX:%02hhX", 
 				info.ap_addr.sa_data[0] & 0xFF,
@@ -233,28 +239,28 @@
 	}
 	
 	wmove(w_info, 3, 1);
-	waddstr(w_info, "bitrate: ");
+	waddstr(w_info, "bitrate:");
 	if (info.cap_bitrate) {
-		sprintf(tmp, "%g Mbit/s", (double)info.bitrate / 1000000);
+		sprintf(tmp, " %gMbps", (double)info.bitrate / 1000000);
 		waddstr_b(w_info, tmp);
 	} else waddstr(w_info, "n/a");
 	
-	waddstr(w_info, ",  RTS thr: ");
+	waddstr(w_info, ", RTS thr:");
 	if (info.cap_rts) {
 		if (info.rts_on) sprintf(tmp, "%d bytes", info.rts);
 			else sprintf(tmp, "off");
 		waddstr_b(w_info, tmp);
 	} else waddstr(w_info, "n/a");
-	
-	waddstr(w_info, ",  frag thr: ");
+
+	wmove(w_info, 4, 1);
+	waddstr(w_info, "frag thr:");
 	if (info.cap_frag) {
 		if (info.frag_on) sprintf(tmp, "%d bytes", info.frag);
 			else sprintf(tmp, "off");
 		waddstr_b(w_info, tmp);
 	} else waddstr(w_info, "n/a");
 
-	wmove(w_info, 4, 1);
-	waddstr(w_info, "encryption: ");
+	waddstr(w_info, ", encryption:");
 	if (info.cap_encode) {
 		if (info.eflags.disabled || info.keysize == 0) {
 			waddstr_b(w_info, "off");
@@ -332,13 +338,17 @@
 		info.addr[1] & 0xFF, info.addr[2] & 0xFF, info.addr[3] & 0xFF);
 	waddstr_b(w_net, tmp);
 
-	waddstr(w_net, ",  netmask: ");
+	wmove(w_net, 3, 1);
+
+	waddstr(w_net, "netmask: ");
 	sprintf(tmp, "%hhu.%hhu.%hhu.%hhu", info.netmask[0] & 0xFF,
 		info.netmask[1] & 0xFF, info.netmask[2] & 0xFF,
 		info.netmask[3] & 0xFF);
 	waddstr_b(w_net, tmp);
 
-	waddstr(w_net, ",  bcast: ");
+	wmove(w_net, 4, 1);
+
+	waddstr(w_net, "broadcast: ");
 	sprintf(tmp, "%hhu.%hhu.%hhu.%hhu", info.bcast[0] & 0xFF,
 		info.bcast[1] & 0xFF, info.bcast[2] & 0xFF,
 		info.bcast[3] & 0xFF);
@@ -351,11 +361,11 @@
 	
 	conf = wmconf;
 
-	w_if = newwin_title(2, COLS, 0, 0, "Interface", 0, 1);
-	w_levels = newwin_title(9, COLS, 2, 0, "Levels", 1, 1);
-	w_stats = newwin_title(2, COLS, 11, 0, "Statistics", 1, 1);
-	w_info = newwin_title(6, COLS, 13, 0, "Info", 1, 1);
-	w_net = newwin_title(4, COLS, 19, 0, "Network", 1, 0);
+	w_if = newwin_title(3, COLS, 0, 0, "Interface", 0, 1);
+	w_levels = newwin_title(9, COLS, 3, 0, "Levels", 1, 1);
+	w_stats = newwin_title(3, COLS, 12, 0, "Statistics", 1, 1);
+	w_info = newwin_title(6, COLS, 15, 0, "Info", 1, 1);
+	w_net = newwin_title(6, COLS, 21, 0, "Network", 1, 0);
 	w_menu = newwin(1, COLS, LINES - 1, 0);
 	
 	display_info(conf->ifname, w_if, w_info);
@@ -380,7 +390,8 @@
 		wrefresh(w_net);
 		start_timer(&t1, conf->info_iv * 1000000);
 		while (!end_timer(&t1) && (key = wgetch(w_menu)) <= 0) sleep(1);
-	} while (key < 265 || key > 275);
+//	} while (key < 265 || key > 275);
+	} while (key < 49 || key > 59);
 
 	iw_stat_redraw = NULL;
 	
@@ -391,5 +402,6 @@
 	werase(w_net); wrefresh(w_net); delwin(w_net);
 	werase(w_menu); wrefresh(w_menu); delwin(w_menu);
 	
-	return key - 265;
+//	return key - 265;
+	return key - 49;
 }
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/install-sh /usr6/buildroot/build_arm/wavemon-0.5.0z/install-sh
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/install-sh	2002-09-21 15:27:40.000000000 -0600
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/install-sh	2005-09-18 10:29:52.000000000 -0600
@@ -43,7 +43,7 @@
 
 transformbasename=""
 transform_arg=""
-instcmd="$mvprog"
+instcmd="$cpprog"
 chmodcmd="$chmodprog 0755"
 chowncmd=""
 chgrpcmd=""
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/iw_if.c /usr6/buildroot/build_arm/wavemon-0.5.0z/iw_if.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/iw_if.c	2002-12-21 07:23:11.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/iw_if.c	2005-09-24 22:06:56.000000000 -0600
@@ -35,6 +35,7 @@
 #include "error.h"
 #include "llist.h"
 #include "iw_if.h"
+#include "iwlib.h"
 
 struct iw_stat iw_stats;
 struct iw_stat iw_stats_cache[IW_STACKSIZE];
@@ -43,6 +44,7 @@
 
 /*
  * convert log dBm values to linear mW
+ * pow(10,(dbm/10))
  */
 
 float dbm2mw(float in)
@@ -52,11 +54,13 @@
 
 /*
  * convert linear mW values to log dBm
+ * log(mw)/log(10)*10
  */
 
 float mw2dbm(float in)
 {
-    return((float)pow(10.0, in / 10.0));
+//    return((float)pow(10.0, in / 10.0));
+      return(log10(in)*10.0);
 }
 
 /*
@@ -218,13 +222,12 @@
     if (ioctl(skfd, SIOCGIWNAME, &iwr) < 0) fatal_error("cannot open device '%s'", iwr.u.name);
     strncpy(info->name, iwr.u.name, IFNAMSIZ);
 
-    iwr.u.essid.pointer = (caddr_t)&(info->essid);
+    iwr.u.essid.pointer = (caddr_t) (info->essid);
     iwr.u.essid.length = IW_ESSID_MAX_SIZE + 1;
     iwr.u.essid.flags = 0;
     if (ioctl(skfd, SIOCGIWESSID, &iwr) >= 0) {
         info->cap_essid = 1;
         info->essid_on = iwr.u.essid.flags;
-        strncpy(info->essid, iwr.u.essid.pointer, IW_ESSID_MAX_SIZE);
     }
 	
     if (ioctl(skfd, SIOCGIWNWID, &iwr) >= 0) {
@@ -233,14 +236,14 @@
         info->nwid_on = iwr.u.nwid.flags;
     }
 	
-    iwr.u.essid.pointer = (caddr_t)&(info->nickname);
+    iwr.u.essid.pointer = (caddr_t) (info->nickname);
     iwr.u.essid.length = IW_ESSID_MAX_SIZE + 1;
     iwr.u.essid.flags = 0;
     if (ioctl(skfd, SIOCGIWNICKN, &iwr) >= 0)
-        if (iwr.u.data.length > 1) info->cap_nickname = 1;
+        info->cap_nickname = iwr.u.data.length > 1;
 	
     if (ioctl(skfd, SIOCGIWFREQ, &iwr) >= 0) {
-        info->cap_freq = 1;
+	info->cap_freq = 1;
         if (iwr.u.freq.e)
             info->freq = (iwr.u.freq.m * pow(10, iwr.u.freq.e)) / 1000000000;
         else info->freq = iwr.u.freq.m;
@@ -505,41 +508,36 @@
 
 /*
  * get a list of access points in range
- * for now this uses the deprecated SIOCGIWAPLIST facility, next revision
- * will use SIOCSIWSCAN (if available)
+ * using SIOCSIWSCAN 
  */
 
 int iw_get_aplist(char *ifname, struct iw_aplist *lst)
 {
     int 	     skfd;
-    struct iwreq iwr;
-    char         buf[(sizeof(struct iw_quality) +
-                      sizeof(struct sockaddr)) * IW_MAX_AP];
-    int          i, rv = 1;
-	
+    struct iwreq;
+    int          i = 0, rv = 1;
+    struct wireless_scan_head   wsh;
+    struct wireless_scan	*ws;
+    	
     if ((skfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) fatal_error("could not open socket");
 	
     memset(lst, 0, sizeof(struct iw_aplist));
+    
+
+	if (iw_scan(skfd, ifname, 16, &wsh) >=0 ) { 
 	
-    strncpy(iwr.ifr_name, ifname, IFNAMSIZ);
-    iwr.u.data.pointer = (caddr_t)buf;
-    iwr.u.data.length = IW_MAX_AP;
-    iwr.u.data.flags = 0;
-    if (ioctl(skfd, SIOCGIWAPLIST, &iwr) >= 0) {
-        lst->num = iwr.u.data.length;
 
-/*
- * copy addresses and quality information (if available) to list array
- */
+        ws = wsh.result;
 
-        for (i = 0; i < lst->num; i++)
-            memcpy(&lst->aplist[i].addr, buf + i * sizeof(struct sockaddr), sizeof(struct sockaddr));
+    while (ws) {
+            lst->aplist[i].addr =  (ws->ap_addr);
+	    memcpy(lst->aplist[i].essid, (ws->b.essid), sizeof(ws->b.essid));
+            lst->aplist[i].quality =  (ws->stats.qual.qual);
+	    i = i + 1;     
+	    ws = ws->next;
+		}
+        lst->num = i;
 
-        if ((lst->has_quality = iwr.u.data.flags))
-            for (i = 0; i < lst->num; i++)
-                memcpy(&lst->aplist[i].quality,
-                       buf + lst->num * sizeof(struct sockaddr) + i * sizeof(struct iw_quality),
-                       sizeof(struct iw_quality));
     } else rv = 0;
 	
     close(skfd);
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/iw_if.h /usr6/buildroot/build_arm/wavemon-0.5.0z/iw_if.h
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/iw_if.h	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/iw_if.h	2005-09-24 21:02:19.000000000 -0600
@@ -39,9 +39,9 @@
 			cap_power	: 1,
 			cap_aplist	: 1;
 	char	name[IFNAMSIZ];
-	char	essid[IW_ESSID_MAX_SIZE];
+	char	essid[IW_ESSID_MAX_SIZE+1];
 	char	essid_on : 1;
-	char	nickname[IW_ESSID_MAX_SIZE];
+	char	nickname[IW_ESSID_MAX_SIZE+1];
 	unsigned long nwid;
 	char	nwid_on : 1;
 	unsigned short rts;
@@ -56,7 +56,7 @@
 	int		mode;
 	char 	keysize;
 	int		key_index;
-	char	key[IW_ENCODING_TOKEN_MAX];
+	unsigned char	key[IW_ENCODING_TOKEN_MAX];
 
 	struct crypt_flags {
 		char	disabled 	: 1,
@@ -88,7 +88,10 @@
 
 	struct {
 	  struct sockaddr   addr;
-	  struct iw_quality quality;
+//	  struct iw_quality quality;
+	  unsigned char	quality;
+	  char	essid[IW_ESSID_MAX_SIZE+1];
+
 	} aplist[IW_MAX_AP];
 };
 
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/iwlib.c /usr6/buildroot/build_arm/wavemon-0.5.0z/iwlib.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/iwlib.c	1969-12-31 17:00:00.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/iwlib.c	2005-09-26 14:47:04.000000000 -0600
@@ -0,0 +1,582 @@
+/*
+ *	This is a shortened version of iwlib.c specifically
+ *      for wavemon for the Zipit. No additions to copyright...
+ *      so it remains as below. (ken mcguire)
+ *	Wireless Tools
+ *
+ *		Jean II - HPLB 97->99 - HPL 99->04
+ *
+ * Common subroutines to all the wireless tools...
+ *
+ * This file is released under the GPL license.
+ *     Copyright (c) 1997-2004 Jean Tourrilhes <jt@hpl.hp.com>
+ */
+
+/***************************** INCLUDES *****************************/
+
+#include "iwlib.h"		/* Header */
+
+/************************ CONSTANTS & MACROS ************************/
+
+/*
+ * Constants fof WE-9->15
+ */
+#define IW15_MAX_FREQUENCIES	16
+#define IW15_MAX_BITRATES	8
+#define IW15_MAX_TXPOWER	8
+#define IW15_MAX_ENCODING_SIZES	8
+#define IW15_MAX_SPY		8
+#define IW15_MAX_AP		8
+
+/****************************** TYPES ******************************/
+
+/*
+ *	Struct iw_range up to WE-15
+ */
+double
+iw_freq2float(const iwfreq *	in)
+{
+#ifdef WE_NOLIBM
+  /* Version without libm : slower */
+  int		i;
+  double	res = (double) in->m;
+  for(i = 0; i < in->e; i++)
+    res *= 10;
+  return(res);
+#else	/* WE_NOLIBM */
+  /* Version with libm : faster */
+  return ((double) in->m) * pow(10,in->e);
+#endif	/* WE_NOLIBM */
+}
+
+/************************ EVENT SUBROUTINES ************************/
+/*
+ * The Wireless Extension API 14 and greater define Wireless Events,
+ * that are used for various events and scanning.
+ * Those functions help the decoding of events, so are needed only in
+ * this case.
+ */
+
+/* Type of headers we know about (basically union iwreq_data) */
+#define IW_HEADER_TYPE_NULL	0	/* Not available */
+#define IW_HEADER_TYPE_CHAR	2	/* char [IFNAMSIZ] */
+#define IW_HEADER_TYPE_UINT	4	/* __u32 */
+#define IW_HEADER_TYPE_FREQ	5	/* struct iw_freq */
+#define IW_HEADER_TYPE_ADDR	6	/* struct sockaddr */
+#define IW_HEADER_TYPE_POINT	8	/* struct iw_point */
+#define IW_HEADER_TYPE_PARAM	9	/* struct iw_param */
+#define IW_HEADER_TYPE_QUAL	10	/* struct iw_quality */
+
+/* Headers for the various requests */
+static const char standard_ioctl_hdr[] = {
+	IW_HEADER_TYPE_NULL,	/* SIOCSIWCOMMIT */
+	IW_HEADER_TYPE_CHAR,	/* SIOCGIWNAME */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWNWID */
+	IW_HEADER_TYPE_PARAM,	/* SIOCGIWNWID */
+	IW_HEADER_TYPE_FREQ,	/* SIOCSIWFREQ */
+	IW_HEADER_TYPE_FREQ,	/* SIOCGIWFREQ */
+	IW_HEADER_TYPE_UINT,	/* SIOCSIWMODE */
+	IW_HEADER_TYPE_UINT,	/* SIOCGIWMODE */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWSENS */
+	IW_HEADER_TYPE_PARAM,	/* SIOCGIWSENS */
+	IW_HEADER_TYPE_NULL,	/* SIOCSIWRANGE */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWRANGE */
+	IW_HEADER_TYPE_NULL,	/* SIOCSIWPRIV */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWPRIV */
+	IW_HEADER_TYPE_NULL,	/* SIOCSIWSTATS */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWSTATS */
+	IW_HEADER_TYPE_POINT,	/* SIOCSIWSPY */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWSPY */
+	IW_HEADER_TYPE_POINT,	/* SIOCSIWTHRSPY */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWTHRSPY */
+	IW_HEADER_TYPE_ADDR,	/* SIOCSIWAP */
+	IW_HEADER_TYPE_ADDR,	/* SIOCGIWAP */
+	IW_HEADER_TYPE_NULL,	/* -- hole -- */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWAPLIST */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWSCAN */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWSCAN */
+	IW_HEADER_TYPE_POINT,	/* SIOCSIWESSID */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWESSID */
+	IW_HEADER_TYPE_POINT,	/* SIOCSIWNICKN */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWNICKN */
+	IW_HEADER_TYPE_NULL,	/* -- hole -- */
+	IW_HEADER_TYPE_NULL,	/* -- hole -- */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWRATE */
+	IW_HEADER_TYPE_PARAM,	/* SIOCGIWRATE */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWRTS */
+	IW_HEADER_TYPE_PARAM,	/* SIOCGIWRTS */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWFRAG */
+	IW_HEADER_TYPE_PARAM,	/* SIOCGIWFRAG */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWTXPOW */
+	IW_HEADER_TYPE_PARAM,	/* SIOCGIWTXPOW */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWRETRY */
+	IW_HEADER_TYPE_PARAM,	/* SIOCGIWRETRY */
+	IW_HEADER_TYPE_POINT,	/* SIOCSIWENCODE */
+	IW_HEADER_TYPE_POINT,	/* SIOCGIWENCODE */
+	IW_HEADER_TYPE_PARAM,	/* SIOCSIWPOWER */
+	IW_HEADER_TYPE_PARAM,	/* SIOCGIWPOWER */
+};
+static const unsigned int standard_ioctl_num = sizeof(standard_ioctl_hdr);
+
+/*
+ * Meta-data about all the additional standard Wireless Extension events
+ * we know about.
+ */
+static const char	standard_event_hdr[] = {
+	IW_HEADER_TYPE_ADDR,	/* IWEVTXDROP */
+	IW_HEADER_TYPE_QUAL,	/* IWEVQUAL */
+	IW_HEADER_TYPE_POINT,	/* IWEVCUSTOM */
+	IW_HEADER_TYPE_ADDR,	/* IWEVREGISTERED */
+	IW_HEADER_TYPE_ADDR,	/* IWEVEXPIRED */
+};
+static const unsigned int standard_event_num = sizeof(standard_event_hdr);
+
+/* Size (in bytes) of various events */
+static const int event_type_size[] = {
+	IW_EV_LCP_LEN,		/* IW_HEADER_TYPE_NULL */
+	0,
+	IW_EV_CHAR_LEN,		/* IW_HEADER_TYPE_CHAR */
+	0,
+	IW_EV_UINT_LEN,		/* IW_HEADER_TYPE_UINT */
+	IW_EV_FREQ_LEN,		/* IW_HEADER_TYPE_FREQ */
+	IW_EV_ADDR_LEN,		/* IW_HEADER_TYPE_ADDR */
+	0,
+	IW_EV_POINT_LEN,	/* Without variable payload */
+	IW_EV_PARAM_LEN,	/* IW_HEADER_TYPE_PARAM */
+	IW_EV_QUAL_LEN,		/* IW_HEADER_TYPE_QUAL */
+};
+
+/* Forward compatibility with WE-19 */
+#define IW_EV_POINT_OFF (((char *) &(((struct iw_point *) NULL)->length)) - \
+			  (char *) NULL)
+
+/*------------------------------------------------------------------*/
+/*
+ * Initialise the struct stream_descr so that we can extract
+ * individual events from the event stream.
+ */
+void
+iw_init_event_stream(struct stream_descr *	stream,	/* Stream of events */
+		     char *			data,
+		     int			len)
+{
+  /* Cleanup */
+  memset((char *) stream, '\0', sizeof(struct stream_descr));
+
+  /* Set things up */
+  stream->current = data;
+  stream->end = data + len;
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Extract the next event from the event stream.
+ */
+int
+iw_extract_event_stream(struct stream_descr *	stream,	/* Stream of events */
+			struct iw_event *	iwe,	/* Extracted event */
+			int			we_version)
+{
+  int		event_type = 0;
+  unsigned int	event_len = 1;		/* Invalid */
+  char *	pointer;
+  /* Don't "optimise" the following variable, it will crash */
+  unsigned	cmd_index;		/* *MUST* be unsigned */
+
+  /* Unused for now. Will be later on... */
+  we_version = we_version;
+
+  /* Check for end of stream */
+  if((stream->current + IW_EV_LCP_LEN) > stream->end)
+    return(0);
+
+
+  /* Extract the event header (to get the event id).
+   * Note : the event may be unaligned, therefore copy... */
+  memcpy((char *) iwe, stream->current, IW_EV_LCP_LEN);
+
+
+  /* Check invalid events */
+  if(iwe->len <= IW_EV_LCP_LEN)
+    return(-1);
+
+  /* Get the type and length of that event */
+  if(iwe->cmd <= SIOCIWLAST)
+    {
+      cmd_index = iwe->cmd - SIOCIWFIRST;
+      if(cmd_index < standard_ioctl_num)
+	event_type = standard_ioctl_hdr[cmd_index];
+    }
+  else
+    {
+      cmd_index = iwe->cmd - IWEVFIRST;
+      if(cmd_index < standard_event_num)
+	event_type = standard_event_hdr[cmd_index];
+    }
+  /* Unknown events -> event_type=0 => IW_EV_LCP_LEN */
+  event_len = event_type_size[event_type];
+  /* Fixup for later version of WE */
+  if((we_version > 18) && (event_type == IW_HEADER_TYPE_POINT))
+    event_len -= IW_EV_POINT_OFF;
+
+  /* Check if we know about this event */
+  if(event_len <= IW_EV_LCP_LEN)
+    {
+      /* Skip to next event */
+      stream->current += iwe->len;
+      return(2);
+    }
+  event_len -= IW_EV_LCP_LEN;
+
+  /* Set pointer on data */
+  if(stream->value != NULL)
+    pointer = stream->value;			/* Next value in event */
+  else
+    pointer = stream->current + IW_EV_LCP_LEN;	/* First value in event */
+
+
+  /* Copy the rest of the event (at least, fixed part) */
+  if((pointer + event_len) > stream->end)
+    {
+      /* Go to next event */
+      stream->current += iwe->len;
+      return(-2);
+    }
+  /* Fixup for later version of WE */
+  if((we_version > 18) && (event_type == IW_HEADER_TYPE_POINT))
+    memcpy((char *) iwe + IW_EV_LCP_LEN + IW_EV_POINT_OFF,
+	   pointer, event_len);
+  else
+    memcpy((char *) iwe + IW_EV_LCP_LEN, pointer, event_len);
+
+  /* Skip event in the stream */
+  pointer += event_len;
+
+  /* Special processing for iw_point events */
+  if(event_type == IW_HEADER_TYPE_POINT)
+    {
+      /* Check the length of the payload */
+      if((iwe->len - (event_len + IW_EV_LCP_LEN)) > 0)
+	/* Set pointer on variable part (warning : non aligned) */
+	iwe->u.data.pointer = pointer;
+      else
+	/* No data */
+	iwe->u.data.pointer = NULL;
+
+      /* Go to next event */
+      stream->current += iwe->len;
+    }
+  else
+    {
+      /* Is there more value in the event ? */
+      if((pointer + event_len) <= (stream->current + iwe->len))
+	/* Go to next value */
+	stream->value = pointer;
+      else
+	{
+	  /* Go to next event */
+	  stream->value = NULL;
+	  stream->current += iwe->len;
+	}
+    }
+  return(1);
+}
+
+/*********************** SCANNING SUBROUTINES ***********************/
+/*
+ * The Wireless Extension API 14 and greater define Wireless Scanning.
+ * The normal API is complex, this is an easy API that return
+ * a subset of the scanning results. This should be enough for most
+ * applications that want to use Scanning.
+ * If you want to have use the full/normal API, check iwlist.c...
+ *
+ * Precaution when using scanning :
+ * The scanning operation disable normal network traffic, and therefore
+ * you should not abuse of scan.
+ * The scan need to check the presence of network on other frequencies.
+ * While you are checking those other frequencies, you can *NOT* be on
+ * your normal frequency to listen to normal traffic in the cell.
+ * You need typically in the order of one second to actively probe all
+ * 802.11b channels (do the maths). Some cards may do that in background,
+ * to reply to scan commands faster, but they still have to do it.
+ * Leaving the cell for such an extended period of time is pretty bad.
+ * Any kind of streaming/low latency traffic will be impacted, and the
+ * user will perceive it (easily checked with telnet). People trying to
+ * send traffic to you will retry packets and waste bandwidth. Some
+ * applications may be sensitive to those packet losses in weird ways,
+ * and tracing those weird behavior back to scanning may take time.
+ * If you are in ad-hoc mode, if two nodes scan approx at the same
+ * time, they won't see each other, which may create associations issues.
+ * For those reasons, the scanning activity should be limited to
+ * what's really needed, and continuous scanning is a bad idea.
+ * Jean II
+ */
+
+/*------------------------------------------------------------------*/
+/*
+ * Process/store one element from the scanning results in wireless_scan
+ */
+static inline struct wireless_scan *
+iw_process_scanning_token(struct iw_event *		event,
+			  struct wireless_scan *	wscan)
+{
+  struct wireless_scan *	oldwscan;
+
+  /* Now, let's decode the event */
+  
+  switch(event->cmd)
+    {
+    case SIOCGIWAP:
+      /* New cell description. Allocate new cell descriptor, zero it. */
+      oldwscan = wscan;
+      wscan = (struct wireless_scan *) malloc(sizeof(struct wireless_scan));
+      if(wscan == NULL)
+	return(wscan);
+      /* Link at the end of the list */
+      if(oldwscan != NULL)
+	oldwscan->next = wscan;
+
+      /* Reset it */
+      bzero(wscan, sizeof(struct wireless_scan));
+
+      /* Save cell identifier */
+      wscan->has_ap_addr = 1;
+      memcpy(&(wscan->ap_addr), &(event->u.ap_addr), sizeof (sockaddr));
+
+      break;
+    case SIOCGIWNWID:
+      wscan->b.has_nwid = 1;
+      memcpy(&(wscan->b.nwid), &(event->u.nwid), sizeof(iwparam));
+      break;
+    case SIOCGIWFREQ:
+      wscan->b.has_freq = 1;
+      wscan->b.freq = iw_freq2float(&(event->u.freq));
+      wscan->b.freq_flags = event->u.freq.flags;
+      break;
+    case SIOCGIWMODE:
+      wscan->b.mode = event->u.mode;
+      if((wscan->b.mode < IW_NUM_OPER_MODE) && (wscan->b.mode >= 0))
+	wscan->b.has_mode = 1;
+      break;
+    case SIOCGIWESSID:
+      wscan->b.has_essid = 1;
+      wscan->b.essid_on = event->u.data.flags;
+      if((event->u.essid.pointer) && (event->u.essid.length))
+	memcpy(wscan->b.essid, event->u.essid.pointer, event->u.essid.length);
+      wscan->b.essid[event->u.essid.length] = '\0';
+      break;
+    case SIOCGIWENCODE:
+      wscan->b.has_key = 1;
+      wscan->b.key_size = event->u.data.length;
+      wscan->b.key_flags = event->u.data.flags;
+      if(event->u.data.pointer)
+	memcpy(wscan->b.key, event->u.essid.pointer, event->u.data.length);
+      else
+	wscan->b.key_flags |= IW_ENCODE_NOKEY;
+      break;
+    case IWEVQUAL:
+      /* We don't get complete stats, only qual */
+      wscan->has_stats = 1;
+      memcpy(&wscan->stats.qual, &event->u.qual, sizeof(iwstats));
+      break;
+    case SIOCGIWRATE:
+      /* Scan may return a list of bitrates. Should we really bother with
+       * an array of bitrates ? Or only the maximum bitrate ? Jean II */
+    case IWEVCUSTOM:
+      /* How can we deal with those sanely ? Jean II */
+    default:
+      break;
+   }	/* switch(event->cmd) */
+
+  return(wscan);
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Initiate the scan procedure, and process results.
+ * This is a non-blocking procedure and it will return each time
+ * it would block, returning the amount of time the caller should wait
+ * before calling again.
+ * Return -1 for error, delay to wait for (in ms), or 0 for success.
+ * Error code is in errno
+ */
+int
+iw_process_scan(int			skfd,
+		char *			ifname,
+		int			we_version,
+		wireless_scan_head *	context)
+{
+  struct iwreq		wrq;
+  unsigned char *	buffer = NULL;		/* Results */
+  int			buflen = IW_SCAN_MAX_DATA; /* Min for compat WE<17 */
+  unsigned char *	newbuf;
+
+  /* Don't waste too much time on interfaces (150 * 100 = 15s) */
+  context->retry++;
+  if(context->retry > 150)
+    {
+      errno = ETIME;
+      return(-1);
+    }
+
+  /* If we have not yet initiated scanning on the interface */
+  if(context->retry == 1)
+    {
+      /* Initiate Scan */
+      wrq.u.data.pointer = NULL;		/* Later */
+      wrq.u.data.flags = 0;
+      wrq.u.data.length = 0;
+      if(iw_set_ext(skfd, ifname, SIOCSIWSCAN, &wrq) < 0)
+	return(-1);
+      /* Success : now, just wait for event or results */
+      return(250);	/* Wait 250 ms */
+    }
+
+ realloc:
+  /* (Re)allocate the buffer - realloc(NULL, len) == malloc(len) */
+  newbuf = realloc(buffer, buflen);
+  if(newbuf == NULL)
+    {
+      /* man says : If realloc() fails the original block is left untouched */
+      if(buffer)
+	free(buffer);
+      errno = ENOMEM;
+      return(-1);
+    }
+  buffer = newbuf;
+
+  /* Try to read the results */
+  wrq.u.data.pointer = buffer;
+  wrq.u.data.flags = 0;
+  wrq.u.data.length = buflen;
+  
+  if(iw_get_ext(skfd, ifname, SIOCGIWSCAN, &wrq) < 0)
+    {
+      /* Check if buffer was too small (WE-17 only) */
+      if((errno == E2BIG) && (we_version > 16))
+	{
+	  /* Some driver may return very large scan results, either
+	   * because there are many cells, or because they have many
+	   * large elements in cells (like IWEVCUSTOM). Most will
+	   * only need the regular sized buffer. We now use a dynamic
+	   * allocation of the buffer to satisfy everybody. Of course,
+	   * as we don't know in advance the size of the array, we try
+	   * various increasing sizes. Jean II */
+
+	  /* Check if the driver gave us any hints. */
+	  if(wrq.u.data.length > buflen)
+	    buflen = wrq.u.data.length;
+	  else
+	    buflen *= 2;
+
+	  /* Try again */
+	  goto realloc;
+	}
+
+      /* Check if results not available yet */
+      if(errno == EAGAIN)
+	{
+	  free(buffer);
+	  /* Wait for only 100ms from now on */
+	  return(100);	/* Wait 100 ms */
+	}
+
+      free(buffer);
+      /* Bad error, please don't come back... */
+      return(-1);
+    }
+
+  /* We have the results, process them */
+  if(wrq.u.data.length)
+    {
+      struct iw_event		iwe;
+      struct stream_descr	stream;
+      struct wireless_scan *	wscan = NULL;
+      int			ret;
+
+      /* Init */
+      iw_init_event_stream(&stream, buffer, wrq.u.data.length);
+      /* This is dangerous, we may leak user data... */
+      context->result = NULL;
+
+      /* Look every token */
+      do
+	{
+	  /* Extract an event and print it */
+	  ret = iw_extract_event_stream(&stream, &iwe, we_version);
+	  if(ret > 0)
+	    {
+	      /* Convert to wireless_scan struct */
+	      wscan = iw_process_scanning_token(&iwe, wscan);
+	      /* Check problems */
+	      if(wscan == NULL)
+		{
+		  free(buffer);
+		  errno = ENOMEM;
+		  return(-1);
+		}
+	      /* Save head of list */
+	      if(context->result == NULL)
+		context->result = wscan;
+	    }
+	}
+      while(ret > 0);
+    }
+
+  /* Done with this interface - return success */
+  free(buffer);
+  return(0);
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Perform a wireless scan on the specified interface.
+ * This is a blocking procedure and it will when the scan is completed
+ * or when an error occur.
+ *
+ * The scan results are given in a linked list of wireless_scan objects.
+ * The caller *must* free the result himself (by walking the list).
+ * If there is an error, -1 is returned and the error code is available
+ * in errno.
+ *
+ * The parameter we_version can be extracted from the range structure
+ * (range.we_version_compiled - see iw_get_range_info()), or using
+ * iw_get_kernel_we_version(). For performance reason, you should
+ * cache this parameter when possible rather than querying it every time.
+ *
+ * Return -1 for error and 0 for success.
+ */
+int
+iw_scan(int			skfd,
+	char *			ifname,
+	int			we_version,
+	wireless_scan_head *	context)
+{
+
+  int		delay;		/* in ms */
+
+
+  /* Clean up context. Potential memory leak if(context.result != NULL) */
+	wireless_scan	*	ws;
+
+  context->result = NULL;
+  context->retry = 0;
+
+
+  /* Wait until we get results or error */
+  while(1)
+    {
+      /* Try to get scan results */
+      delay = iw_process_scan(skfd, ifname, we_version, context);
+      /* Check termination */
+      if(delay <= 0)
+	break;
+
+      /* Wait a bit */
+      usleep(delay * 1000);
+    }
+    ws = context->result;
+
+  /* End - return -1 or 0 */
+  return(delay);
+}
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/iwlib.h /usr6/buildroot/build_arm/wavemon-0.5.0z/iwlib.h
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/iwlib.h	1969-12-31 17:00:00.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/iwlib.h	2005-09-22 09:47:56.000000000 -0600
@@ -0,0 +1,594 @@
+/*
+ *	Wireless Tools
+ *
+ *		Jean II - HPLB 97->99 - HPL 99->04
+ *
+ * Common header for the Wireless Extension library...
+ *
+ * This file is released under the GPL license.
+ *     Copyright (c) 1997-2004 Jean Tourrilhes <jt@hpl.hp.com>
+ */
+
+#ifndef IWLIB_H
+#define IWLIB_H
+
+/*#include "CHANGELOG.h"*/
+
+/***************************** INCLUDES *****************************/
+
+/* Standard headers */
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <netdb.h>		/* gethostbyname, getnetbyname */
+#include <net/ethernet.h>	/* struct ether_addr */
+#include <sys/time.h>		/* struct timeval */
+#include <unistd.h>
+
+/* This is our header selection. Try to hide the mess and the misery :-(
+ * Don't look, you would go blind ;-) */
+
+#ifndef LINUX_VERSION_CODE
+#include <linux/version.h>
+#endif
+
+/* Kernel headers 2.4.X + Glibc 2.2 - Mandrake 8.0, Debian 2.3, RH 7.1
+ * Kernel headers 2.2.X + Glibc 2.2 - Slackware 8.0 */
+#if defined(__GLIBC__) \
+    && __GLIBC__ == 2 \
+    && __GLIBC_MINOR__ >= 2 \
+    && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
+//#define GLIBC22_HEADERS
+#define GENERIC_HEADERS
+
+/* Kernel headers 2.4.X + Glibc 2.1 - Debian 2.2 upgraded, RH 7.0
+ * Kernel headers 2.2.X + Glibc 2.1 - Debian 2.2, RH 6.1 */
+#elif defined(__GLIBC__) \
+      && __GLIBC__ == 2 \
+      && __GLIBC_MINOR__ == 1 \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
+//#define GLIBC_HEADERS
+#define GENERIC_HEADERS
+
+/* Kernel headers 2.2.X + Glibc 2.0 - Debian 2.1 */
+#elif defined(__GLIBC__) \
+      && __GLIBC__ == 2 \
+      && __GLIBC_MINOR__ == 0 \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) \
+      && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
+#define GLIBC_HEADERS
+#define KLUDGE_HEADERS
+
+/* Note : is it really worth supporting kernel 2.0.X, knowing that
+ * we require WE v9, which is only available in 2.2.X and higher ?
+ * I guess one could use 2.0.x with an upgraded wireless.h... */
+
+/* Kernel headers 2.0.X + Glibc 2.0 - Debian 2.0, RH 5 */
+#elif defined(__GLIBC__) \
+      && __GLIBC__ == 2 \
+      && __GLIBC_MINOR__ == 0 \
+      && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)
+#define GLIBC_HEADERS
+
+/* Kernel headers 2.0.X + libc5 - old systems */
+#elif defined(_LINUX_C_LIB_VERSION_MAJOR) \
+      && _LINUX_C_LIB_VERSION_MAJOR == 5 \
+      && LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0) \
+      && LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0)
+#define LIBC5_HEADERS
+
+/* Unsupported combination */
+#else
+#error "Your kernel/libc combination is not supported"
+#endif
+
+#ifdef GENERIC_HEADERS 
+/* Proposed by Dr. Michael Rietz <rietz@mail.amps.de>, 27.3.2 */
+/* If this works for all, it might be more stable on the long term - Jean II */
+#include <net/if_arp.h>		/* For ARPHRD_ETHER */
+#include <sys/socket.h>		/* For AF_INET & struct sockaddr */
+#include <netinet/in.h>         /* For struct sockaddr_in */
+#include <netinet/if_ether.h>
+#endif /* GENERIC_HEADERS */    
+
+#ifdef GLIBC22_HEADERS 
+/* Added by Ross G. Miller <Ross_Miller@baylor.edu>, 3/28/01 */
+#include <linux/if_arp.h> 	/* For ARPHRD_ETHER */
+#include <linux/socket.h>	/* For AF_INET & struct sockaddr */
+#include <sys/socket.h>
+#endif /* GLIBC22_HEADERS */    
+
+#ifdef KLUDGE_HEADERS
+#include <socketbits.h>
+#endif	/* KLUDGE_HEADERS */
+
+#ifdef GLIBC_HEADERS
+#include <linux/if_arp.h>	/* For ARPHRD_ETHER */
+#include <linux/socket.h>	/* For AF_INET & struct sockaddr */
+#include <linux/in.h>		/* For struct sockaddr_in */
+#endif	/* KLUDGE_HEADERS || GLIBC_HEADERS */
+
+#ifdef LIBC5_HEADERS
+#include <sys/socket.h>		/* For AF_INET & struct sockaddr & socket() */
+#include <linux/if_arp.h>	/* For ARPHRD_ETHER */
+#include <linux/in.h>		/* For struct sockaddr_in */
+#endif	/* LIBC5_HEADERS */
+
+/* Those 3 headers were previously included in wireless.h */
+#include <linux/types.h>		/* for "caddr_t" et al		*/
+#include <linux/socket.h>		/* for "struct sockaddr" et al	*/
+#include <linux/if.h>			/* for IFNAMSIZ and co... */
+
+/* Private copy of Wireless extensions (in this directoty) */
+#include "wireless.h"
+
+/* Make gcc understant that when we say inline, we mean it.
+ * I really hate when the compiler is trying to be more clever than me,
+ * because in this case gcc is not able to figure out functions with a
+ * single call site, so not only I have to tag those functions inline
+ * by hand, but then it refuse to inline them properly.
+ * Total saving for iwevent : 150B = 0.7%.
+ * Fortunately, in gcc 3.4, they now automatically inline static functions
+ * with a single call site. Hurrah !
+ * Jean II */
+#if __GNUC__ == 3
+#if __GNUC_MINOR__ >= 1 && __GNUC_MINOR__ < 4
+#ifdef inline
+#undef inline
+#endif
+#define inline		inline		__attribute__((always_inline))
+#endif
+#endif /* __GNUC__ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/****************************** DEBUG ******************************/
+
+
+/************************ CONSTANTS & MACROS ************************/
+
+/* Various versions information */
+/* Recommended Wireless Extension version */
+#define WE_VERSION	17
+/* Version of Wireless Tools */
+#define WT_VERSION	28
+
+/* Paths */
+#define PROC_NET_WIRELESS	"/proc/net/wireless"
+#define PROC_NET_DEV		"/proc/net/dev"
+
+/* Some usefull constants */
+#define KILO	1e3
+#define MEGA	1e6
+#define GIGA	1e9
+/* For doing log10/exp10 without libm */
+#define LOG10_MAGIC	1.25892541179
+
+/* Backward compatibility for Wireless Extension 9 */
+#ifndef IW_POWER_MODIFIER
+#define IW_POWER_MODIFIER	0x000F	/* Modify a parameter */
+#define IW_POWER_MIN		0x0001	/* Value is a minimum  */
+#define IW_POWER_MAX		0x0002	/* Value is a maximum */
+#define IW_POWER_RELATIVE	0x0004	/* Value is not in seconds/ms/us */
+#endif /* IW_POWER_MODIFIER */
+
+#ifndef IW_ENCODE_NOKEY
+#define IW_ENCODE_NOKEY         0x0800  /* Key is write only, so not here */
+#define IW_ENCODE_MODE		0xF000	/* Modes defined below */
+#endif /* IW_ENCODE_NOKEY */
+#ifndef IW_ENCODE_TEMP
+#define IW_ENCODE_TEMP		0x0400  /* Temporary key */
+#endif /* IW_ENCODE_TEMP */
+
+/* More backward compatibility */
+#ifndef SIOCSIWCOMMIT
+#define SIOCSIWCOMMIT	SIOCSIWNAME
+#endif /* SIOCSIWCOMMIT */
+
+/* Still more backward compatibility */
+#ifndef IW_FREQ_FIXED
+#define IW_FREQ_FIXED	0x01
+#endif /* IW_FREQ_FIXED */
+
+/****************************** TYPES ******************************/
+
+/* Shortcuts */
+typedef struct iw_statistics	iwstats;
+typedef struct iw_range		iwrange;
+typedef struct iw_param		iwparam;
+typedef struct iw_freq		iwfreq;
+typedef struct iw_quality	iwqual;
+typedef struct iw_priv_args	iwprivargs;
+typedef struct sockaddr		sockaddr;
+
+/* Structure for storing all wireless information for each device
+ * This is a cut down version of the one above, containing only
+ * the things *truly* needed to configure a card.
+ * Don't add other junk, I'll remove it... */
+typedef struct wireless_config
+{
+  char		name[IFNAMSIZ + 1];	/* Wireless/protocol name */
+  int		has_nwid;
+  iwparam	nwid;			/* Network ID */
+  int		has_freq;
+  double	freq;			/* Frequency/channel */
+  int		freq_flags;
+  int		has_key;
+  unsigned char	key[IW_ENCODING_TOKEN_MAX];	/* Encoding key used */
+  int		key_size;		/* Number of bytes */
+  int		key_flags;		/* Various flags */
+  int		has_essid;
+  int		essid_on;
+  char		essid[IW_ESSID_MAX_SIZE + 1];	/* ESSID (extended network) */
+  int		has_mode;
+  int		mode;			/* Operation mode */
+} wireless_config;
+
+/* Structure for storing all wireless information for each device
+ * This is pretty exhaustive... */
+typedef struct wireless_info
+{
+  struct wireless_config	b;	/* Basic information */
+
+  int		has_sens;
+  iwparam	sens;			/* sensitivity */
+  int		has_nickname;
+  char		nickname[IW_ESSID_MAX_SIZE + 1]; /* NickName */
+  int		has_ap_addr;
+  sockaddr	ap_addr;		/* Access point address */
+  int		has_bitrate;
+  iwparam	bitrate;		/* Bit rate in bps */
+  int		has_rts;
+  iwparam	rts;			/* RTS threshold in bytes */
+  int		has_frag;
+  iwparam	frag;			/* Fragmentation threshold in bytes */
+  int		has_power;
+  iwparam	power;			/* Power management parameters */
+  int		has_txpower;
+  iwparam	txpower;		/* Transmit Power in dBm */
+  int		has_retry;
+  iwparam	retry;			/* Retry limit or lifetime */
+
+  /* Stats */
+  iwstats	stats;
+  int		has_stats;
+  iwrange	range;
+  int		has_range;
+} wireless_info;
+
+/* Structure for storing an entry of a wireless scan.
+ * This is only a subset of all possible information, the flexible
+ * structure of scan results make it impossible to capture all
+ * information in such a static structure. */
+typedef struct wireless_scan
+{
+  /* Linked list */
+  struct wireless_scan *	next;
+
+  /* Cell identifiaction */
+  int		has_ap_addr;
+  sockaddr	ap_addr;		/* Access point address */
+
+  /* Other information */
+  struct wireless_config	b;	/* Basic information */
+  iwstats	stats;			/* Signal strength */
+  int		has_stats;
+} wireless_scan;
+
+/*
+ * Context used for non-blocking scan.
+ */
+typedef struct wireless_scan_head
+{
+  wireless_scan *	result;		/* Result of the scan */
+  int			retry;		/* Retry level */
+} wireless_scan_head;
+
+/* Structure used for parsing event streams, such as Wireless Events
+ * and scan results */
+typedef struct stream_descr
+{
+  char *	end;		/* End of the stream */
+  char *	current;	/* Current event in stream of events */
+  char *	value;		/* Current value in event */
+} stream_descr;
+
+/* Prototype for handling display of each single interface on the
+ * system - see iw_enum_devices() */
+typedef int (*iw_enum_handler)(int	skfd,
+			       char *	ifname,
+			       char *	args[],
+			       int	count);
+
+/**************************** PROTOTYPES ****************************/
+/*
+ * All the functions in iwcommon.c
+ */
+
+/* ---------------------- SOCKET SUBROUTINES -----------------------*/
+int
+	iw_sockets_open(void);
+void
+	iw_enum_devices(int		skfd,
+			iw_enum_handler fn,
+			char *		args[],
+			int		count);
+/* --------------------- WIRELESS SUBROUTINES ----------------------*/
+int
+	iw_get_kernel_we_version(void);
+int
+	iw_print_version_info(const char *	toolname);
+int
+	iw_get_range_info(int		skfd,
+			  const char *	ifname,
+			  iwrange *	range);
+int
+	iw_get_priv_info(int		skfd,
+			 const char *	ifname,
+			 iwprivargs **	ppriv);
+int
+	iw_get_basic_config(int			skfd,
+			    const char *	ifname,
+			    wireless_config *	info);
+int
+	iw_set_basic_config(int			skfd,
+			    const char *	ifname,
+			    wireless_config *	info);
+/* --------------------- PROTOCOL SUBROUTINES --------------------- */
+int
+	iw_protocol_compare(const char *	protocol1,
+			    const char *	protocol2);
+/* -------------------- FREQUENCY SUBROUTINES --------------------- */
+void
+	iw_float2freq(double	in,
+		      iwfreq *	out);
+double
+	iw_freq2float(const iwfreq *	in);
+void
+	iw_print_freq_value(char *	buffer,
+			    int		buflen,
+			    double	freq);
+void
+	iw_print_freq(char *	buffer,
+		      int	buflen,
+		      double	freq,
+		      int	channel,
+		      int	freq_flags);
+int
+	iw_freq_to_channel(double			freq,
+			   const struct iw_range *	range);
+int
+	iw_channel_to_freq(int				channel,
+			   double *			pfreq,
+			   const struct iw_range *	range);
+void
+	iw_print_bitrate(char *	buffer,
+			 int	buflen,
+			 int	bitrate);
+/* ---------------------- POWER SUBROUTINES ----------------------- */
+int
+	iw_dbm2mwatt(int	in);
+int
+	iw_mwatt2dbm(int	in);
+void
+	iw_print_txpower(char *			buffer,
+			 int			buflen,
+			 struct iw_param *	txpower);
+/* -------------------- STATISTICS SUBROUTINES -------------------- */
+int
+	iw_get_stats(int		skfd,
+		     const char *	ifname,
+		     iwstats *		stats,
+		     const iwrange *	range,
+		     int		has_range);
+void
+	iw_print_stats(char *		buffer,
+		       int		buflen,
+		       const iwqual *	qual,
+		       const iwrange *	range,
+		       int		has_range);
+/* --------------------- ENCODING SUBROUTINES --------------------- */
+void
+	iw_print_key(char *			buffer,
+		     int			buflen,
+		     const unsigned char *	key,
+		     int			key_size,
+		     int			key_flags);
+int
+	iw_in_key(const char *		input,
+		  unsigned char *	key);
+int
+	iw_in_key_full(int		skfd,
+		       const char *	ifname,
+		       const char *	input,
+		       unsigned char *	key,
+		       __u16 *		flags);
+/* ----------------- POWER MANAGEMENT SUBROUTINES ----------------- */
+void
+	iw_print_pm_value(char *	buffer,
+			  int		buflen,
+			  int		value,
+			  int		flags);
+void
+	iw_print_pm_mode(char *		buffer,
+			 int		buflen,
+			 int		flags);
+/* --------------- RETRY LIMIT/LIFETIME SUBROUTINES --------------- */
+void
+	iw_print_retry_value(char *	buffer,
+			     int	buflen,
+			     int	value,
+			     int	flags);
+/* ----------------------- TIME SUBROUTINES ----------------------- */
+void
+	iw_print_timeval(char *			buffer,
+			 int			buflen,
+			 const struct timeval *	time);
+/* --------------------- ADDRESS SUBROUTINES ---------------------- */
+int
+	iw_check_mac_addr_type(int	skfd,
+			       char *	ifname);
+int
+	iw_check_if_addr_type(int	skfd,
+			      char *	ifname);
+#if 0
+int
+	iw_check_addr_type(int		skfd,
+			   char *	ifname);
+#endif
+int
+	iw_get_mac_addr(int			skfd,
+			const char *		name,
+			struct ether_addr *	eth,
+			unsigned short *	ptype);
+void
+	iw_ether_ntop(const struct ether_addr* eth, char* buf);
+char*
+	iw_ether_ntoa(const struct ether_addr* eth);
+int
+	iw_ether_aton(const char* bufp, struct ether_addr* eth);
+int
+	iw_in_inet(char *bufp, struct sockaddr *sap);
+int
+	iw_in_addr(int			skfd,
+		   char *		ifname,
+		   char *		bufp,
+		   struct sockaddr *	sap);
+/* ----------------------- MISC SUBROUTINES ------------------------ */
+int
+	iw_get_priv_size(int		args);
+
+/* ---------------------- EVENT SUBROUTINES ---------------------- */
+void
+	iw_init_event_stream(struct stream_descr *	stream,
+			     char *			data,
+			     int			len);
+int
+	iw_extract_event_stream(struct stream_descr *	stream,
+				struct iw_event *	iwe,
+				int			we_version);
+/* --------------------- SCANNING SUBROUTINES --------------------- */
+int
+	iw_process_scan(int			skfd,
+			char *			ifname,
+			int			we_version,
+			wireless_scan_head *	context);
+int
+	iw_scan(int			skfd,
+		char *			ifname,
+		int			we_version,
+		wireless_scan_head *	context);
+
+/**************************** VARIABLES ****************************/
+
+/* Modes as human readable strings */
+extern const char * const	iw_operation_mode[];
+#define IW_NUM_OPER_MODE	7
+
+/************************* INLINE FUNTIONS *************************/
+/*
+ * Functions that are so simple that it's more efficient inlining them
+ */
+
+/*
+ * Note : I've defined wrapper for the ioctl request so that
+ * it will be easier to migrate to other kernel API if needed
+ */
+
+/*------------------------------------------------------------------*/
+/*
+ * Wrapper to push some Wireless Parameter in the driver
+ */
+static inline int
+iw_set_ext(int			skfd,		/* Socket to the kernel */
+	   const char *		ifname,		/* Device name */
+	   int			request,	/* WE ID */
+	   struct iwreq *	pwrq)		/* Fixed part of the request */
+{
+  /* Set device name */
+  strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
+  /* Do the request */
+  return(ioctl(skfd, request, pwrq));
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Wrapper to extract some Wireless Parameter out of the driver
+ */
+static inline int
+iw_get_ext(int			skfd,		/* Socket to the kernel */
+	   const char *		ifname,		/* Device name */
+	   int			request,	/* WE ID */
+	   struct iwreq *	pwrq)		/* Fixed part of the request */
+{
+  /* Set device name */
+  strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
+  /* Do the request */
+  return(ioctl(skfd, request, pwrq));
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Close the socket used for ioctl.
+ */
+static inline void
+iw_sockets_close(int	skfd)
+{
+  close(skfd);
+}
+
+/*------------------------------------------------------------------*/
+/* Backwards compatability
+ * Actually, those form are much easier to use when dealing with
+ * struct sockaddr... */
+static inline char*
+iw_pr_ether(char* bufp, const unsigned char* addr)
+{
+  iw_ether_ntop((const struct ether_addr *) addr, bufp);
+  return bufp;
+}
+/* Backwards compatability */
+static inline int
+iw_in_ether(const char *bufp, struct sockaddr *sap)
+{
+  sap->sa_family = ARPHRD_ETHER;
+  return iw_ether_aton(bufp, (struct ether_addr *) sap->sa_data) ? 0 : -1;
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Create an Ethernet broadcast address
+ */
+static inline void
+iw_broad_ether(struct sockaddr *sap)
+{
+  sap->sa_family = ARPHRD_ETHER;
+  memset((char *) sap->sa_data, 0xFF, ETH_ALEN);
+}
+
+/*------------------------------------------------------------------*/
+/*
+ * Create an Ethernet NULL address
+ */
+static inline void
+iw_null_ether(struct sockaddr *sap)
+{
+  sap->sa_family = ARPHRD_ETHER;
+  memset((char *) sap->sa_data, 0x00, ETH_ALEN);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* IWLIB_H */
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/lhist_scr.c /usr6/buildroot/build_arm/wavemon-0.5.0z/lhist_scr.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/lhist_scr.c	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/lhist_scr.c	2005-09-19 10:21:32.000000000 -0600
@@ -57,14 +57,15 @@
 		clip_noise = (iw_stats_cache[i].noise > conf->sig_max ||
 			iw_stats_cache[i].noise < conf->sig_min);
 
-		for (j = y1; j < ysize; j++) mvwaddch(w_lhist, j, x2 - i, ' ');
+		for (j = y1; j < ysize; j++) mvwaddch(w_lhist, j, x2 - i, '*');
 
-		snr = iw_stats_cache[i].signal - iw_stats_cache[i].noise;
+//		snr = iw_stats_cache[i].signal - iw_stats_cache[i].noise;
+		snr=0;
 		if (snr > 0) {
 			if (snr < (conf->sig_max - conf->sig_min)) {
 				wattrset(w_lhist, COLOR_PAIR(CP_STATSNR));
 				for (j = 0; j < snr * ratio; j++)
-					mvwaddch(w_lhist, y2 - j, x2 - i, ' ');
+					mvwaddch(w_lhist, y2 - j, x2 - i, '*');
 				wattroff(w_lhist, COLOR_PAIR(CP_STATSNR));
 				wattrset(w_lhist, COLOR_PAIR(CP_STATBKG));
 				while (j < y2) mvwaddch(w_lhist, y2 - j, x2 - i, (j++ % 5 ? ' ' : '-'));
@@ -72,7 +73,7 @@
 			} else {
 				wattrset(w_lhist, COLOR_PAIR(CP_STATSNR));
 				for (j = y1; j <= y2; j++)
-					mvwaddch(w_lhist, j, x2 - i, ' ');
+					mvwaddch(w_lhist, j, x2 - i, '*');
 				wattroff(w_lhist, COLOR_PAIR(CP_STATSNR));
 			}
 		} else {
@@ -122,17 +123,17 @@
 	wattrset(w_key, COLOR_PAIR(CP_STATSIG));
 	waddch(w_key, ACS_HLINE);
 	wattrset(w_key, COLOR_PAIR(CP_STANDARD));
-	sprintf(s, "] sig lvl (%d..%d dBm)  [", conf->sig_min, conf->sig_max);
+	sprintf(s, "] sig (%d..%d dBm)  [", conf->sig_min, conf->sig_max);
 	waddstr(w_key, s);
 	wattrset(w_key, COLOR_PAIR(CP_STATNOISE));
 	waddch(w_key, ACS_HLINE);
 	wattrset(w_key, COLOR_PAIR(CP_STANDARD));
-	sprintf(s, "] ns lvl (dBm)  [");
+	sprintf(s, "] noise");
 	waddstr(w_key, s);
-	wattrset(w_key, COLOR_PAIR(CP_STATSNR));
-	waddch(w_key, ' ');
-	wattrset(w_key, COLOR_PAIR(CP_STANDARD));
-	waddstr(w_key, "] S-N ratio (dB)");
+//	wattrset(w_key, COLOR_PAIR(CP_STATSNR));
+//	waddch(w_key, '*');
+//	wattrset(w_key, COLOR_PAIR(CP_STANDARD));
+//	waddstr(w_key, "] S-N ratio (dB)");
 }
 
 void redraw_lhist()
@@ -165,12 +166,14 @@
 	nodelay(w_menu, FALSE); keypad(w_menu, TRUE);
 	
 	iw_stat_redraw = redraw_lhist;
-	do key = wgetch(w_menu); while (key < 265 || key > 275);
+//	do key = wgetch(w_menu); while (key < 265 || key > 275);
+	do key = wgetch(w_menu); while (key < 49 || key > 59);
 	iw_stat_redraw = NULL;
 	
 	werase(w_lhist); wrefresh(w_lhist); delwin(w_lhist);
 	werase(w_key); wrefresh(w_key); delwin(w_key);
 	werase(w_menu); wrefresh(w_menu); delwin(w_menu);
 	
-	return key - 265;
+//	return key - 265;
+	return key - 49;
 }
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/llist.c /usr6/buildroot/build_arm/wavemon-0.5.0z/llist.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/llist.c	2002-12-21 07:39:33.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/llist.c	2005-09-18 10:30:22.000000000 -0600
@@ -352,7 +352,7 @@
 					*((int *)l->e) = va_arg(*ap, int);
 					break;
 		case 's':	l->e = (void *)malloc(sizeof(char *));
-					(char *)l->e = strdup(va_arg(*ap, char *));
+					l->e = strdup(va_arg(*ap, char *));
 					break;
 		case 'f':	l->e = (void *)malloc(sizeof(double));
 					*((double *)l->e) = va_arg(*ap, double);
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/ui.c /usr6/buildroot/build_arm/wavemon-0.5.0z/ui.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/ui.c	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/ui.c	2005-09-18 20:54:33.000000000 -0600
@@ -27,7 +27,7 @@
 #include "ui.h"
 #include "defs.h"
 
-char *screens[] = { "info", "lhist", "aplst", "", "", "", "prefs", "help", "about", "quit" };
+char *screens[] = { "info", "lhist", "aplst", "prefs", "quit", "", "", "", "", "" };
 
 void wmenubar(WINDOW *win, int active)
 {
@@ -35,8 +35,8 @@
 	int i, j, n = 0;
 	
 	wmove(win, 0, 0);
-	for (i = 0; i < 10; i++) {
-		sprintf(tmp, "F%d", i + 1);
+	for (i = 0; i < 5; i++) {
+		sprintf(tmp, "%d", i + 1);
 		wattrset(win, A_REVERSE | A_BOLD);
 		waddstr(win, tmp);
 		wattroff(win, A_REVERSE | A_BOLD);
@@ -83,13 +83,13 @@
 	wattroff(win, A_BOLD);
 }
 
-void waddbar(WINDOW *win, float v, float minv, float maxv, char y, char x, char maxx, char *cscale, char rev)
+void waddbar(WINDOW *win, float v, float minv, float maxv, int y, int x, int maxx, char *cscale, char rev)
 {
 	int c;
 	int col;
 	int val = 0;
 
-	char steps = maxx - x;
+	int steps = maxx - x;
 
 	val = (v <= maxv ? v : val);
 
@@ -102,10 +102,10 @@
 	while (x + c < maxx) mvwaddch(win, y, x + c++, 183);
 }
 
-void waddthreshold(WINDOW *win, float v, float tv, float minv, float maxv, char y, char x, char maxx, char *cscale, char rev, char tch)
+void waddthreshold(WINDOW *win, float v, float tv, float minv, float maxv, int y, int x, int maxx, char *cscale, char rev, char tch)
 {
 	int col;
-	char steps = maxx - x;
+	int steps = maxx - x;
 
 	if (v < cscale[0]) col = (rev ? 2 : 4) | A_BOLD;
 		else if (v < cscale[1]) col = 3 | A_BOLD;
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/ui.h /usr6/buildroot/build_arm/wavemon-0.5.0z/ui.h
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/ui.h	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/ui.h	2005-09-18 10:30:00.000000000 -0600
@@ -22,5 +22,5 @@
 WINDOW *newwin_title(int h, int w, int x, int y, char *title, char t, char b);
 void waddstr_b(WINDOW *win, char *s);
 void waddstr_center(WINDOW *win, int y, char *s);
-void waddbar(WINDOW *win, float v, float minv, float maxv, char y, char x, char maxx, char *cscale, char rev);
-void waddthreshold(WINDOW *win, float v, float tv, float minv, float maxv, char y, char x, char maxx, char *cscale, char rev, char tch);
+void waddbar(WINDOW *win, float v, float minv, float maxv, int y, int x, int maxx, char *cscale, char rev);
+void waddthreshold(WINDOW *win, float v, float tv, float minv, float maxv, int y, int x, int maxx, char *cscale, char rev, char tch);
Binary files /usr6/buildroot/build_arm/wavemon-0.4.0b/wavemon and /usr6/buildroot/build_arm/wavemon-0.5.0z/wavemon differ
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/wavemon.c /usr6/buildroot/build_arm/wavemon-0.5.0z/wavemon.c
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/wavemon.c	2002-12-21 05:18:30.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/wavemon.c	2005-09-18 21:39:03.000000000 -0600
@@ -170,7 +170,7 @@
 
 	if (conf.dump == 1) {
 	  dump_parameters(&conf);
-	  exit();
+	  exit(0);
 	}
 
 	/* initialize the ncurses interface */
@@ -187,7 +187,7 @@
 	init_pair(CP_ACTIVE, COLOR_CYAN, COLOR_BLUE);
 	init_pair(CP_STATSIG, COLOR_GREEN, COLOR_BLACK);
 	init_pair(CP_STATNOISE, COLOR_RED, COLOR_BLACK);
-	init_pair(CP_STATSNR, COLOR_BLUE, COLOR_BLUE);
+	init_pair(CP_STATSNR, COLOR_BLUE, COLOR_BLACK);
 	init_pair(CP_STATBKG, COLOR_BLUE, COLOR_BLACK);
 	init_pair(CP_STATSIG_S, COLOR_GREEN, COLOR_BLUE);
 	init_pair(CP_STATNOISE_S, COLOR_RED, COLOR_BLUE);
@@ -213,14 +213,14 @@
 					break;
 			case 2: current_scr = scr_aplst;
 					break;
-			case 6: current_scr = scr_conf;
-					break;
-			case 7: current_scr = scr_help;
-					break;
-			case 8: current_scr = scr_about;
+			case 3: current_scr = scr_conf;
 					break;
+//			case 4: current_scr = scr_help;
+//					break;
+//			case 5: current_scr = scr_about;
+//					break;
 		}
-	} while (nextscr != 9);
+	} while (nextscr != 4);
 
 	endwin();
 	dealloc_on_exit();
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/wavemonrc /usr6/buildroot/build_arm/wavemon-0.5.0z/wavemonrc
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/wavemonrc	1969-12-31 17:00:00.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/wavemonrc	2005-09-26 15:08:27.000000000 -0600
@@ -0,0 +1,16 @@
+interface = eth0
+stat_updates = 510
+lhist_slot_size = 4
+info_updates = 10
+override_auto_scale = off
+min_signal_level = -102
+max_signal_level = 10
+min_noise_level = -102
+max_noise_level = 10
+linear_scale = off
+random = off
+lo_threshold_action = disabled
+lo_threshold = -80
+hi_threshold_action = disabled
+hi_threshold = -10
+startup_screen = histogram
diff -urN -X dontdiff /usr6/buildroot/build_arm/wavemon-0.4.0b/wireless.h /usr6/buildroot/build_arm/wavemon-0.5.0z/wireless.h
--- /usr6/buildroot/build_arm/wavemon-0.4.0b/wireless.h	1969-12-31 17:00:00.000000000 -0700
+++ /usr6/buildroot/build_arm/wavemon-0.5.0z/wireless.h	2005-09-15 20:59:07.000000000 -0600
@@ -0,0 +1,773 @@
+/*
+ * This file define a set of standard wireless extensions
+ *
+ * Version :	17	21.6.04
+ *
+ * Authors :	Jean Tourrilhes - HPL - <jt@hpl.hp.com>
+ * Copyright (c) 1997-2004 Jean Tourrilhes, All Rights Reserved.
+ */
+
+#ifndef _LINUX_WIRELESS_H
+#define _LINUX_WIRELESS_H
+
+/************************** DOCUMENTATION **************************/
+/*
+ * Initial APIs (1996 -> onward) :
+ * -----------------------------
+ * Basically, the wireless extensions are for now a set of standard ioctl
+ * call + /proc/net/wireless
+ *
+ * The entry /proc/net/wireless give statistics and information on the
+ * driver.
+ * This is better than having each driver having its entry because
+ * its centralised and we may remove the driver module safely.
+ *
+ * Ioctl are used to configure the driver and issue commands.  This is
+ * better than command line options of insmod because we may want to
+ * change dynamically (while the driver is running) some parameters.
+ *
+ * The ioctl mechanimsm are copied from standard devices ioctl.
+ * We have the list of command plus a structure descibing the
+ * data exchanged...
+ * Note that to add these ioctl, I was obliged to modify :
+ *	# net/core/dev.c (two place + add include)
+ *	# net/ipv4/af_inet.c (one place + add include)
+ *
+ * /proc/net/wireless is a copy of /proc/net/dev.
+ * We have a structure for data passed from the driver to /proc/net/wireless
+ * Too add this, I've modified :
+ *	# net/core/dev.c (two other places)
+ *	# include/linux/netdevice.h (one place)
+ *	# include/linux/proc_fs.h (one place)
+ *
+ * New driver API (2002 -> onward) :
+ * -------------------------------
+ * This file is only concerned with the user space API and common definitions.
+ * The new driver API is defined and documented in :
+ *	# include/net/iw_handler.h
+ *
+ * Note as well that /proc/net/wireless implementation has now moved in :
+ *	# net/core/wireless.c
+ *
+ * Wireless Events (2002 -> onward) :
+ * --------------------------------
+ * Events are defined at the end of this file, and implemented in :
+ *	# net/core/wireless.c
+ *
+ * Other comments :
+ * --------------
+ * Do not add here things that are redundant with other mechanisms
+ * (drivers init, ifconfig, /proc/net/dev, ...) and with are not
+ * wireless specific.
+ *
+ * These wireless extensions are not magic : each driver has to provide
+ * support for them...
+ *
+ * IMPORTANT NOTE : As everything in the kernel, this is very much a
+ * work in progress. Contact me if you have ideas of improvements...
+ */
+
+/***************************** INCLUDES *****************************/
+
+/* To minimise problems in user space, I might remove those headers
+ * at some point. Jean II */
+#include <linux/types.h>		/* for "caddr_t" et al		*/
+#include <linux/socket.h>		/* for "struct sockaddr" et al	*/
+#include <linux/if.h>			/* for IFNAMSIZ and co... */
+
+/***************************** VERSION *****************************/
+/*
+ * This constant is used to know the availability of the wireless
+ * extensions and to know which version of wireless extensions it is
+ * (there is some stuff that will be added in the future...)
+ * I just plan to increment with each new version.
+ */
+#define WIRELESS_EXT	17
+
+/*
+ * Changes :
+ *
+ * V2 to V3
+ * --------
+ *	Alan Cox start some incompatibles changes. I've integrated a bit more.
+ *	- Encryption renamed to Encode to avoid US regulation problems
+ *	- Frequency changed from float to struct to avoid problems on old 386
+ *
+ * V3 to V4
+ * --------
+ *	- Add sensitivity
+ *
+ * V4 to V5
+ * --------
+ *	- Missing encoding definitions in range
+ *	- Access points stuff
+ *
+ * V5 to V6
+ * --------
+ *	- 802.11 support (ESSID ioctls)
+ *
+ * V6 to V7
+ * --------
+ *	- define IW_ESSID_MAX_SIZE and IW_MAX_AP
+ *
+ * V7 to V8
+ * --------
+ *	- Changed my e-mail address
+ *	- More 802.11 support (nickname, rate, rts, frag)
+ *	- List index in frequencies
+ *
+ * V8 to V9
+ * --------
+ *	- Support for 'mode of operation' (ad-hoc, managed...)
+ *	- Support for unicast and multicast power saving
+ *	- Change encoding to support larger tokens (>64 bits)
+ *	- Updated iw_params (disable, flags) and use it for NWID
+ *	- Extracted iw_point from iwreq for clarity
+ *
+ * V9 to V10
+ * ---------
+ *	- Add PM capability to range structure
+ *	- Add PM modifier : MAX/MIN/RELATIVE
+ *	- Add encoding option : IW_ENCODE_NOKEY
+ *	- Add TxPower ioctls (work like TxRate)
+ *
+ * V10 to V11
+ * ----------
+ *	- Add WE version in range (help backward/forward compatibility)
+ *	- Add retry ioctls (work like PM)
+ *
+ * V11 to V12
+ * ----------
+ *	- Add SIOCSIWSTATS to get /proc/net/wireless programatically
+ *	- Add DEV PRIVATE IOCTL to avoid collisions in SIOCDEVPRIVATE space
+ *	- Add new statistics (frag, retry, beacon)
+ *	- Add average quality (for user space calibration)
+ *
+ * V12 to V13
+ * ----------
+ *	- Document creation of new driver API.
+ *	- Extract union iwreq_data from struct iwreq (for new driver API).
+ *	- Rename SIOCSIWNAME as SIOCSIWCOMMIT
+ *
+ * V13 to V14
+ * ----------
+ *	- Wireless Events support : define struct iw_event
+ *	- Define additional specific event numbers
+ *	- Add "addr" and "param" fields in union iwreq_data
+ *	- AP scanning stuff (SIOCSIWSCAN and friends)
+ *
+ * V14 to V15
+ * ----------
+ *	- Add IW_PRIV_TYPE_ADDR for struct sockaddr private arg
+ *	- Make struct iw_freq signed (both m & e), add explicit padding
+ *	- Add IWEVCUSTOM for driver specific event/scanning token
+ *	- Add IW_MAX_GET_SPY for driver returning a lot of addresses
+ *	- Add IW_TXPOW_RANGE for range of Tx Powers
+ *	- Add IWEVREGISTERED & IWEVEXPIRED events for Access Points
+ *	- Add IW_MODE_MONITOR for passive monitor
+ *
+ * V15 to V16
+ * ----------
+ *	- Increase the number of bitrates in iw_range to 32 (for 802.11g)
+ *	- Increase the number of frequencies in iw_range to 32 (for 802.11b+a)
+ *	- Reshuffle struct iw_range for increases, add filler
+ *	- Increase IW_MAX_AP to 64 for driver returning a lot of addresses
+ *	- Remove IW_MAX_GET_SPY because conflict with enhanced spy support
+ *	- Add SIOCSIWTHRSPY/SIOCGIWTHRSPY and "struct iw_thrspy"
+ *	- Add IW_ENCODE_TEMP and iw_range->encoding_login_index
+ *
+ * V16 to V17
+ * ----------
+ *	- Add flags to frequency -> auto/fixed
+ *	- Document (struct iw_quality *)->updated, add new flags (INVALID)
+ *	- Wireless Event capability in struct iw_range
+ *	- Add support for relative TxPower (yick !)
+ */
+
+/**************************** CONSTANTS ****************************/
+
+/* -------------------------- IOCTL LIST -------------------------- */
+
+/* Wireless Identification */
+#define SIOCSIWCOMMIT	0x8B00		/* Commit pending changes to driver */
+#define SIOCGIWNAME	0x8B01		/* get name == wireless protocol */
+/* SIOCGIWNAME is used to verify the presence of Wireless Extensions.
+ * Common values : "IEEE 802.11-DS", "IEEE 802.11-FH", "IEEE 802.11b"...
+ * Don't put the name of your driver there, it's useless. */
+
+/* Basic operations */
+#define SIOCSIWNWID	0x8B02		/* set network id (pre-802.11) */
+#define SIOCGIWNWID	0x8B03		/* get network id (the cell) */
+#define SIOCSIWFREQ	0x8B04		/* set channel/frequency (Hz) */
+#define SIOCGIWFREQ	0x8B05		/* get channel/frequency (Hz) */
+#define SIOCSIWMODE	0x8B06		/* set operation mode */
+#define SIOCGIWMODE	0x8B07		/* get operation mode */
+#define SIOCSIWSENS	0x8B08		/* set sensitivity (dBm) */
+#define SIOCGIWSENS	0x8B09		/* get sensitivity (dBm) */
+
+/* Informative stuff */
+#define SIOCSIWRANGE	0x8B0A		/* Unused */
+#define SIOCGIWRANGE	0x8B0B		/* Get range of parameters */
+#define SIOCSIWPRIV	0x8B0C		/* Unused */
+#define SIOCGIWPRIV	0x8B0D		/* get private ioctl interface info */
+#define SIOCSIWSTATS	0x8B0E		/* Unused */
+#define SIOCGIWSTATS	0x8B0F		/* Get /proc/net/wireless stats */
+/* SIOCGIWSTATS is strictly used between user space and the kernel, and
+ * is never passed to the driver (i.e. the driver will never see it). */
+
+/* Spy support (statistics per MAC address - used for Mobile IP support) */
+#define SIOCSIWSPY	0x8B10		/* set spy addresses */
+#define SIOCGIWSPY	0x8B11		/* get spy info (quality of link) */
+#define SIOCSIWTHRSPY	0x8B12		/* set spy threshold (spy event) */
+#define SIOCGIWTHRSPY	0x8B13		/* get spy threshold */
+
+/* Access Point manipulation */
+#define SIOCSIWAP	0x8B14		/* set access point MAC addresses */
+#define SIOCGIWAP	0x8B15		/* get access point MAC addresses */
+#define SIOCGIWAPLIST	0x8B17		/* Deprecated in favor of scanning */
+#define SIOCSIWSCAN	0x8B18		/* trigger scanning (list cells) */
+#define SIOCGIWSCAN	0x8B19		/* get scanning results */
+
+/* 802.11 specific support */
+#define SIOCSIWESSID	0x8B1A		/* set ESSID (network name) */
+#define SIOCGIWESSID	0x8B1B		/* get ESSID */
+#define SIOCSIWNICKN	0x8B1C		/* set node name/nickname */
+#define SIOCGIWNICKN	0x8B1D		/* get node name/nickname */
+/* As the ESSID and NICKN are strings up to 32 bytes long, it doesn't fit
+ * within the 'iwreq' structure, so we need to use the 'data' member to
+ * point to a string in user space, like it is done for RANGE... */
+
+/* Other parameters useful in 802.11 and some other devices */
+#define SIOCSIWRATE	0x8B20		/* set default bit rate (bps) */
+#define SIOCGIWRATE	0x8B21		/* get default bit rate (bps) */
+#define SIOCSIWRTS	0x8B22		/* set RTS/CTS threshold (bytes) */
+#define SIOCGIWRTS	0x8B23		/* get RTS/CTS threshold (bytes) */
+#define SIOCSIWFRAG	0x8B24		/* set fragmentation thr (bytes) */
+#define SIOCGIWFRAG	0x8B25		/* get fragmentation thr (bytes) */
+#define SIOCSIWTXPOW	0x8B26		/* set transmit power (dBm) */
+#define SIOCGIWTXPOW	0x8B27		/* get transmit power (dBm) */
+#define SIOCSIWRETRY	0x8B28		/* set retry limits and lifetime */
+#define SIOCGIWRETRY	0x8B29		/* get retry limits and lifetime */
+
+/* Encoding stuff (scrambling, hardware security, WEP...) */
+#define SIOCSIWENCODE	0x8B2A		/* set encoding token & mode */
+#define SIOCGIWENCODE	0x8B2B		/* get encoding token & mode */
+/* Power saving stuff (power management, unicast and multicast) */
+#define SIOCSIWPOWER	0x8B2C		/* set Power Management settings */
+#define SIOCGIWPOWER	0x8B2D		/* get Power Management settings */
+
+/* -------------------- DEV PRIVATE IOCTL LIST -------------------- */
+
+/* These 32 ioctl are wireless device private, for 16 commands.
+ * Each driver is free to use them for whatever purpose it chooses,
+ * however the driver *must* export the description of those ioctls
+ * with SIOCGIWPRIV and *must* use arguments as defined below.
+ * If you don't follow those rules, DaveM is going to hate you (reason :
+ * it make mixed 32/64bit operation impossible).
+ */
+#define SIOCIWFIRSTPRIV	0x8BE0
+#define SIOCIWLASTPRIV	0x8BFF
+/* Previously, we were using SIOCDEVPRIVATE, but we now have our
+ * separate range because of collisions with other tools such as
+ * 'mii-tool'.
+ * We now have 32 commands, so a bit more space ;-).
+ * Also, all 'odd' commands are only usable by root and don't return the
+ * content of ifr/iwr to user (but you are not obliged to use the set/get
+ * convention, just use every other two command). More details in iwpriv.c.
+ * And I repeat : you are not forced to use them with iwpriv, but you
+ * must be compliant with it.
+ */
+
+/* ------------------------- IOCTL STUFF ------------------------- */
+
+/* The first and the last (range) */
+#define SIOCIWFIRST	0x8B00
+#define SIOCIWLAST	SIOCIWLASTPRIV		/* 0x8BFF */
+
+/* Even : get (world access), odd : set (root access) */
+#define IW_IS_SET(cmd)	(!((cmd) & 0x1))
+#define IW_IS_GET(cmd)	((cmd) & 0x1)
+
+/* ----------------------- WIRELESS EVENTS ----------------------- */
+/* Those are *NOT* ioctls, do not issue request on them !!! */
+/* Most events use the same identifier as ioctl requests */
+
+#define IWEVTXDROP	0x8C00		/* Packet dropped to excessive retry */
+#define IWEVQUAL	0x8C01		/* Quality part of statistics (scan) */
+#define IWEVCUSTOM	0x8C02		/* Driver specific ascii string */
+#define IWEVREGISTERED	0x8C03		/* Discovered a new node (AP mode) */
+#define IWEVEXPIRED	0x8C04		/* Expired a node (AP mode) */
+
+#define IWEVFIRST	0x8C00
+
+/* ------------------------- PRIVATE INFO ------------------------- */
+/*
+ * The following is used with SIOCGIWPRIV. It allow a driver to define
+ * the interface (name, type of data) for its private ioctl.
+ * Privates ioctl are SIOCIWFIRSTPRIV -> SIOCIWLASTPRIV
+ */
+
+#define IW_PRIV_TYPE_MASK	0x7000	/* Type of arguments */
+#define IW_PRIV_TYPE_NONE	0x0000
+#define IW_PRIV_TYPE_BYTE	0x1000	/* Char as number */
+#define IW_PRIV_TYPE_CHAR	0x2000	/* Char as character */
+#define IW_PRIV_TYPE_INT	0x4000	/* 32 bits int */
+#define IW_PRIV_TYPE_FLOAT	0x5000	/* struct iw_freq */
+#define IW_PRIV_TYPE_ADDR	0x6000	/* struct sockaddr */
+
+#define IW_PRIV_SIZE_FIXED	0x0800	/* Variable or fixed number of args */
+
+#define IW_PRIV_SIZE_MASK	0x07FF	/* Max number of those args */
+
+/*
+ * Note : if the number of args is fixed and the size < 16 octets,
+ * instead of passing a pointer we will put args in the iwreq struct...
+ */
+
+/* ----------------------- OTHER CONSTANTS ----------------------- */
+
+/* Maximum frequencies in the range struct */
+#define IW_MAX_FREQUENCIES	32
+/* Note : if you have something like 80 frequencies,
+ * don't increase this constant and don't fill the frequency list.
+ * The user will be able to set by channel anyway... */
+
+/* Maximum bit rates in the range struct */
+#define IW_MAX_BITRATES		32
+
+/* Maximum tx powers in the range struct */
+#define IW_MAX_TXPOWER		8
+/* Note : if you more than 8 TXPowers, just set the max and min or
+ * a few of them in the struct iw_range. */
+
+/* Maximum of address that you may set with SPY */
+#define IW_MAX_SPY		8
+
+/* Maximum of address that you may get in the
+   list of access points in range */
+#define IW_MAX_AP		64
+
+/* Maximum size of the ESSID and NICKN strings */
+#define IW_ESSID_MAX_SIZE	32
+
+/* Modes of operation */
+#define IW_MODE_AUTO	0	/* Let the driver decides */
+#define IW_MODE_ADHOC	1	/* Single cell network */
+#define IW_MODE_INFRA	2	/* Multi cell network, roaming, ... */
+#define IW_MODE_MASTER	3	/* Synchronisation master or Access Point */
+#define IW_MODE_REPEAT	4	/* Wireless Repeater (forwarder) */
+#define IW_MODE_SECOND	5	/* Secondary master/repeater (backup) */
+#define IW_MODE_MONITOR	6	/* Passive monitor (listen only) */
+
+/* Statistics flags (bitmask in updated) */
+#define IW_QUAL_QUAL_UPDATED	0x1	/* Value was updated since last read */
+#define IW_QUAL_LEVEL_UPDATED	0x2
+#define IW_QUAL_NOISE_UPDATED	0x4
+#define IW_QUAL_QUAL_INVALID	0x10	/* Driver doesn't provide value */
+#define IW_QUAL_LEVEL_INVALID	0x20
+#define IW_QUAL_NOISE_INVALID	0x40
+
+/* Frequency flags */
+#define IW_FREQ_AUTO		0x00	/* Let the driver decides */
+#define IW_FREQ_FIXED		0x01	/* Force a specific value */
+
+/* Maximum number of size of encoding token available
+ * they are listed in the range structure */
+#define IW_MAX_ENCODING_SIZES	8
+
+/* Maximum size of the encoding token in bytes */
+#define IW_ENCODING_TOKEN_MAX	32	/* 256 bits (for now) */
+
+/* Flags for encoding (along with the token) */
+#define IW_ENCODE_INDEX		0x00FF	/* Token index (if needed) */
+#define IW_ENCODE_FLAGS		0xFF00	/* Flags defined below */
+#define IW_ENCODE_MODE		0xF000	/* Modes defined below */
+#define IW_ENCODE_DISABLED	0x8000	/* Encoding disabled */
+#define IW_ENCODE_ENABLED	0x0000	/* Encoding enabled */
+#define IW_ENCODE_RESTRICTED	0x4000	/* Refuse non-encoded packets */
+#define IW_ENCODE_OPEN		0x2000	/* Accept non-encoded packets */
+#define IW_ENCODE_NOKEY		0x0800  /* Key is write only, so not present */
+#define IW_ENCODE_TEMP		0x0400  /* Temporary key */
+
+/* Power management flags available (along with the value, if any) */
+#define IW_POWER_ON		0x0000	/* No details... */
+#define IW_POWER_TYPE		0xF000	/* Type of parameter */
+#define IW_POWER_PERIOD		0x1000	/* Value is a period/duration of  */
+#define IW_POWER_TIMEOUT	0x2000	/* Value is a timeout (to go asleep) */
+#define IW_POWER_MODE		0x0F00	/* Power Management mode */
+#define IW_POWER_UNICAST_R	0x0100	/* Receive only unicast messages */
+#define IW_POWER_MULTICAST_R	0x0200	/* Receive only multicast messages */
+#define IW_POWER_ALL_R		0x0300	/* Receive all messages though PM */
+#define IW_POWER_FORCE_S	0x0400	/* Force PM procedure for sending unicast */
+#define IW_POWER_REPEATER	0x0800	/* Repeat broadcast messages in PM period */
+#define IW_POWER_MODIFIER	0x000F	/* Modify a parameter */
+#define IW_POWER_MIN		0x0001	/* Value is a minimum  */
+#define IW_POWER_MAX		0x0002	/* Value is a maximum */
+#define IW_POWER_RELATIVE	0x0004	/* Value is not in seconds/ms/us */
+
+/* Transmit Power flags available */
+#define IW_TXPOW_TYPE		0x00FF	/* Type of value */
+#define IW_TXPOW_DBM		0x0000	/* Value is in dBm */
+#define IW_TXPOW_MWATT		0x0001	/* Value is in mW */
+#define IW_TXPOW_RELATIVE	0x0002	/* Value is in arbitrary units */
+#define IW_TXPOW_RANGE		0x1000	/* Range of value between min/max */
+
+/* Retry limits and lifetime flags available */
+#define IW_RETRY_ON		0x0000	/* No details... */
+#define IW_RETRY_TYPE		0xF000	/* Type of parameter */
+#define IW_RETRY_LIMIT		0x1000	/* Maximum number of retries*/
+#define IW_RETRY_LIFETIME	0x2000	/* Maximum duration of retries in us */
+#define IW_RETRY_MODIFIER	0x000F	/* Modify a parameter */
+#define IW_RETRY_MIN		0x0001	/* Value is a minimum  */
+#define IW_RETRY_MAX		0x0002	/* Value is a maximum */
+#define IW_RETRY_RELATIVE	0x0004	/* Value is not in seconds/ms/us */
+
+/* Scanning request flags */
+#define IW_SCAN_DEFAULT		0x0000	/* Default scan of the driver */
+#define IW_SCAN_ALL_ESSID	0x0001	/* Scan all ESSIDs */
+#define IW_SCAN_THIS_ESSID	0x0002	/* Scan only this ESSID */
+#define IW_SCAN_ALL_FREQ	0x0004	/* Scan all Frequencies */
+#define IW_SCAN_THIS_FREQ	0x0008	/* Scan only this Frequency */
+#define IW_SCAN_ALL_MODE	0x0010	/* Scan all Modes */
+#define IW_SCAN_THIS_MODE	0x0020	/* Scan only this Mode */
+#define IW_SCAN_ALL_RATE	0x0040	/* Scan all Bit-Rates */
+#define IW_SCAN_THIS_RATE	0x0080	/* Scan only this Bit-Rate */
+/* Maximum size of returned data */
+#define IW_SCAN_MAX_DATA	4096	/* In bytes */
+
+/* Max number of char in custom event - use multiple of them if needed */
+#define IW_CUSTOM_MAX		256	/* In bytes */
+
+/* Event capability macros - in (struct iw_range *)->event_capa
+ * Because we have more than 32 possible events, we use an array of
+ * 32 bit bitmasks. Note : 32 bits = 0x20 = 2^5. */
+#define IW_EVENT_CAPA_BASE(cmd)		((cmd >= SIOCIWFIRSTPRIV) ? \
+					 (cmd - SIOCIWFIRSTPRIV + 0x60) : \
+					 (cmd - SIOCSIWCOMMIT))
+#define IW_EVENT_CAPA_INDEX(cmd)	(IW_EVENT_CAPA_BASE(cmd) >> 5)
+#define IW_EVENT_CAPA_MASK(cmd)		(1 << (IW_EVENT_CAPA_BASE(cmd) & 0x1F))
+/* Event capability constants - event autogenerated by the kernel
+ * This list is valid for most 802.11 devices, customise as needed... */
+#define IW_EVENT_CAPA_K_0	(IW_EVENT_CAPA_MASK(0x8B04) | \
+				 IW_EVENT_CAPA_MASK(0x8B06) | \
+				 IW_EVENT_CAPA_MASK(0x8B1A))
+#define IW_EVENT_CAPA_K_1	(IW_EVENT_CAPA_MASK(0x8B2A))
+/* "Easy" macro to set events in iw_range (less efficient) */
+#define IW_EVENT_CAPA_SET(event_capa, cmd) (event_capa[IW_EVENT_CAPA_INDEX(cmd)] |= IW_EVENT_CAPA_MASK(cmd))
+#define IW_EVENT_CAPA_SET_KERNEL(event_capa) {event_capa[0] |= IW_EVENT_CAPA_K_0; event_capa[1] |= IW_EVENT_CAPA_K_1; }
+
+
+/****************************** TYPES ******************************/
+
+/* --------------------------- SUBTYPES --------------------------- */
+/*
+ *	Generic format for most parameters that fit in an int
+ */
+struct	iw_param
+{
+  __s32		value;		/* The value of the parameter itself */
+  __u8		fixed;		/* Hardware should not use auto select */
+  __u8		disabled;	/* Disable the feature */
+  __u16		flags;		/* Various specifc flags (if any) */
+};
+
+/*
+ *	For all data larger than 16 octets, we need to use a
+ *	pointer to memory allocated in user space.
+ */
+struct	iw_point
+{
+  caddr_t	pointer;	/* Pointer to the data  (in user space) */
+  __u16		length;		/* number of fields or size in bytes */
+  __u16		flags;		/* Optional params */
+};
+
+/*
+ *	A frequency
+ *	For numbers lower than 10^9, we encode the number in 'm' and
+ *	set 'e' to 0
+ *	For number greater than 10^9, we divide it by the lowest power
+ *	of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')...
+ *	The power of 10 is in 'e', the result of the division is in 'm'.
+ */
+struct	iw_freq
+{
+	__s32		m;		/* Mantissa */
+	__s16		e;		/* Exponent */
+	__u8		i;		/* List index (when in range struct) */
+	__u8		flags;		/* Flags (fixed/auto) */
+};
+
+/*
+ *	Quality of the link
+ */
+struct	iw_quality
+{
+	__u8		qual;		/* link quality (%retries, SNR,
+					   %missed beacons or better...) */
+	__u8		level;		/* signal level (dBm) */
+	__u8		noise;		/* noise level (dBm) */
+	__u8		updated;	/* Flags to know if updated */
+};
+
+/*
+ *	Packet discarded in the wireless adapter due to
+ *	"wireless" specific problems...
+ *	Note : the list of counter and statistics in net_device_stats
+ *	is already pretty exhaustive, and you should use that first.
+ *	This is only additional stats...
+ */
+struct	iw_discarded
+{
+	__u32		nwid;		/* Rx : Wrong nwid/essid */
+	__u32		code;		/* Rx : Unable to code/decode (WEP) */
+	__u32		fragment;	/* Rx : Can't perform MAC reassembly */
+	__u32		retries;	/* Tx : Max MAC retries num reached */
+	__u32		misc;		/* Others cases */
+};
+
+/*
+ *	Packet/Time period missed in the wireless adapter due to
+ *	"wireless" specific problems...
+ */
+struct	iw_missed
+{
+	__u32		beacon;		/* Missed beacons/superframe */
+};
+
+/*
+ *	Quality range (for spy threshold)
+ */
+struct	iw_thrspy
+{
+	struct sockaddr		addr;		/* Source address (hw/mac) */
+	struct iw_quality	qual;		/* Quality of the link */
+	struct iw_quality	low;		/* Low threshold */
+	struct iw_quality	high;		/* High threshold */
+};
+
+/* ------------------------ WIRELESS STATS ------------------------ */
+/*
+ * Wireless statistics (used for /proc/net/wireless)
+ */
+struct	iw_statistics
+{
+	__u16		status;		/* Status
+					 * - device dependent for now */
+
+	struct iw_quality	qual;		/* Quality of the link
+						 * (instant/mean/max) */
+	struct iw_discarded	discard;	/* Packet discarded counts */
+	struct iw_missed	miss;		/* Packet missed counts */
+};
+
+/* ------------------------ IOCTL REQUEST ------------------------ */
+/*
+ * This structure defines the payload of an ioctl, and is used 
+ * below.
+ *
+ * Note that this structure should fit on the memory footprint
+ * of iwreq (which is the same as ifreq), which mean a max size of
+ * 16 octets = 128 bits. Warning, pointers might be 64 bits wide...
+ * You should check this when increasing the structures defined
+ * above in this file...
+ */
+union	iwreq_data
+{
+	/* Config - generic */
+	char		name[IFNAMSIZ];
+	/* Name : used to verify the presence of  wireless extensions.
+	 * Name of the protocol/provider... */
+
+	struct iw_point	essid;		/* Extended network name */
+	struct iw_param	nwid;		/* network id (or domain - the cell) */
+	struct iw_freq	freq;		/* frequency or channel :
+					 * 0-1000 = channel
+					 * > 1000 = frequency in Hz */
+
+	struct iw_param	sens;		/* signal level threshold */
+	struct iw_param	bitrate;	/* default bit rate */
+	struct iw_param	txpower;	/* default transmit power */
+	struct iw_param	rts;		/* RTS threshold threshold */
+	struct iw_param	frag;		/* Fragmentation threshold */
+	__u32		mode;		/* Operation mode */
+	struct iw_param	retry;		/* Retry limits & lifetime */
+
+	struct iw_point	encoding;	/* Encoding stuff : tokens */
+	struct iw_param	power;		/* PM duration/timeout */
+	struct iw_quality qual;		/* Quality part of statistics */
+
+	struct sockaddr	ap_addr;	/* Access point address */
+	struct sockaddr	addr;		/* Destination address (hw/mac) */
+
+	struct iw_param	param;		/* Other small parameters */
+	struct iw_point	data;		/* Other large parameters */
+};
+
+/*
+ * The structure to exchange data for ioctl.
+ * This structure is the same as 'struct ifreq', but (re)defined for
+ * convenience...
+ * Do I need to remind you about structure size (32 octets) ?
+ */
+struct	iwreq 
+{
+	union
+	{
+		char	ifrn_name[IFNAMSIZ];	/* if name, e.g. "eth0" */
+	} ifr_ifrn;
+
+	/* Data part (defined just above) */
+	union	iwreq_data	u;
+};
+
+/* -------------------------- IOCTL DATA -------------------------- */
+/*
+ *	For those ioctl which want to exchange mode data that what could
+ *	fit in the above structure...
+ */
+
+/*
+ *	Range of parameters
+ */
+
+struct	iw_range
+{
+	/* Informative stuff (to choose between different interface) */
+	__u32		throughput;	/* To give an idea... */
+	/* In theory this value should be the maximum benchmarked
+	 * TCP/IP throughput, because with most of these devices the
+	 * bit rate is meaningless (overhead an co) to estimate how
+	 * fast the connection will go and pick the fastest one.
+	 * I suggest people to play with Netperf or any benchmark...
+	 */
+
+	/* NWID (or domain id) */
+	__u32		min_nwid;	/* Minimal NWID we are able to set */
+	__u32		max_nwid;	/* Maximal NWID we are able to set */
+
+	/* Old Frequency (backward compat - moved lower ) */
+	__u16		old_num_channels;
+	__u8		old_num_frequency;
+
+	/* Wireless event capability bitmasks */
+	__u32		event_capa[6];
+
+	/* signal level threshold range */
+	__s32		sensitivity;
+
+	/* Quality of link & SNR stuff */
+	/* Quality range (link, level, noise)
+	 * If the quality is absolute, it will be in the range [0 ; max_qual],
+	 * if the quality is dBm, it will be in the range [max_qual ; 0].
+	 * Don't forget that we use 8 bit arithmetics... */
+	struct iw_quality	max_qual;	/* Quality of the link */
+	/* This should contain the average/typical values of the quality
+	 * indicator. This should be the threshold between a "good" and
+	 * a "bad" link (example : monitor going from green to orange).
+	 * Currently, user space apps like quality monitors don't have any
+	 * way to calibrate the measurement. With this, they can split
+	 * the range between 0 and max_qual in different quality level
+	 * (using a geometric subdivision centered on the average).
+	 * I expect that people doing the user space apps will feedback
+	 * us on which value we need to put in each driver... */
+	struct iw_quality	avg_qual;	/* Quality of the link */
+
+	/* Rates */
+	__u8		num_bitrates;	/* Number of entries in the list */
+	__s32		bitrate[IW_MAX_BITRATES];	/* list, in bps */
+
+	/* RTS threshold */
+	__s32		min_rts;	/* Minimal RTS threshold */
+	__s32		max_rts;	/* Maximal RTS threshold */
+
+	/* Frag threshold */
+	__s32		min_frag;	/* Minimal frag threshold */
+	__s32		max_frag;	/* Maximal frag threshold */
+
+	/* Power Management duration & timeout */
+	__s32		min_pmp;	/* Minimal PM period */
+	__s32		max_pmp;	/* Maximal PM period */
+	__s32		min_pmt;	/* Minimal PM timeout */
+	__s32		max_pmt;	/* Maximal PM timeout */
+	__u16		pmp_flags;	/* How to decode max/min PM period */
+	__u16		pmt_flags;	/* How to decode max/min PM timeout */
+	__u16		pm_capa;	/* What PM options are supported */
+
+	/* Encoder stuff */
+	__u16	encoding_size[IW_MAX_ENCODING_SIZES];	/* Different token sizes */
+	__u8	num_encoding_sizes;	/* Number of entry in the list */
+	__u8	max_encoding_tokens;	/* Max number of tokens */
+	/* For drivers that need a "login/passwd" form */
+	__u8	encoding_login_index;	/* token index for login token */
+
+	/* Transmit power */
+	__u16		txpower_capa;	/* What options are supported */
+	__u8		num_txpower;	/* Number of entries in the list */
+	__s32		txpower[IW_MAX_TXPOWER];	/* list, in bps */
+
+	/* Wireless Extension version info */
+	__u8		we_version_compiled;	/* Must be WIRELESS_EXT */
+	__u8		we_version_source;	/* Last update of source */
+
+	/* Retry limits and lifetime */
+	__u16		retry_capa;	/* What retry options are supported */
+	__u16		retry_flags;	/* How to decode max/min retry limit */
+	__u16		r_time_flags;	/* How to decode max/min retry life */
+	__s32		min_retry;	/* Minimal number of retries */
+	__s32		max_retry;	/* Maximal number of retries */
+	__s32		min_r_time;	/* Minimal retry lifetime */
+	__s32		max_r_time;	/* Maximal retry lifetime */
+
+	/* Frequency */
+	__u16		num_channels;	/* Number of channels [0; num - 1] */
+	__u8		num_frequency;	/* Number of entry in the list */
+	struct iw_freq	freq[IW_MAX_FREQUENCIES];	/* list */
+	/* Note : this frequency list doesn't need to fit channel numbers,
+	 * because each entry contain its channel index */
+};
+
+/*
+ * Private ioctl interface information
+ */
+ 
+struct	iw_priv_args
+{
+	__u32		cmd;		/* Number of the ioctl to issue */
+	__u16		set_args;	/* Type and number of args */
+	__u16		get_args;	/* Type and number of args */
+	char		name[IFNAMSIZ];	/* Name of the extension */
+};
+
+/* ----------------------- WIRELESS EVENTS ----------------------- */
+/*
+ * Wireless events are carried through the rtnetlink socket to user
+ * space. They are encapsulated in the IFLA_WIRELESS field of
+ * a RTM_NEWLINK message.
+ */
+
+/*
+ * A Wireless Event. Contains basically the same data as the ioctl...
+ */
+struct iw_event
+{
+	__u16		len;			/* Real lenght of this stuff */
+	__u16		cmd;			/* Wireless IOCTL */
+	union iwreq_data	u;		/* IOCTL fixed payload */
+};
+
+/* Size of the Event prefix (including padding and alignement junk) */
+#define IW_EV_LCP_LEN	(sizeof(struct iw_event) - sizeof(union iwreq_data))
+/* Size of the various events */
+#define IW_EV_CHAR_LEN	(IW_EV_LCP_LEN + IFNAMSIZ)
+#define IW_EV_UINT_LEN	(IW_EV_LCP_LEN + sizeof(__u32))
+#define IW_EV_FREQ_LEN	(IW_EV_LCP_LEN + sizeof(struct iw_freq))
+#define IW_EV_POINT_LEN	(IW_EV_LCP_LEN + sizeof(struct iw_point))
+#define IW_EV_PARAM_LEN	(IW_EV_LCP_LEN + sizeof(struct iw_param))
+#define IW_EV_ADDR_LEN	(IW_EV_LCP_LEN + sizeof(struct sockaddr))
+#define IW_EV_QUAL_LEN	(IW_EV_LCP_LEN + sizeof(struct iw_quality))
+
+/* Note : in the case of iw_point, the extra data will come at the
+ * end of the event */
+
+#endif	/* _LINUX_WIRELESS_H */
