Fix issue where the active SSID does not timeout in iwlist so networks show up after they have disappeared.

fixes BBHN->ticket:30
This commit is contained in:
Conrad Lara - KG6JEI 2014-03-31 22:59:47 -07:00
parent c6a3e7a64e
commit e34b7fcee4
2 changed files with 7 additions and 6 deletions

View File

@ -263,7 +263,7 @@ while(1)
{
if($line =~ /\s+Cell \d+ - Address: (\S+)/)
{
pushAP($signal, $chan, $key, $ssid, $mac, $mode);
if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $mac, $mode) }
$mac = $1;
$mode = "";
}
@ -273,10 +273,11 @@ while(1)
if($line =~ /\bChannel:(\d+)/) { $chan = $1 }
if($line =~ /\bSignal level=([\d-]+)/) { $signal = $1 }
if($line =~ /\bEncryption key:(\w+)/) { $key = $1 }
if($line =~ /\bExtra: Last beacon: (\d+)ms/) { $lastseen = $1 }
}
close(FILE);
pushAP($signal, $chan, $key, $ssid, $mac, $mode);
if ( $lastseen < 10000 ) { pushAP($signal, $chan, $key, $ssid, $mac, $mode) }
sleep 1 if not scalar @list and $loops != 1;
if(not $batch)

View File

@ -553,10 +553,10 @@ sub get_wifi_signal
chomp $ssid;
my ($SignalLevel) = "N/A";
my ($NoiseFloor) = "N/A";
foreach(`iwlist $_[0] scanning essid "$ssid" |grep -A 5 -B 5 "$ssid"`)
foreach(`iwlist $_[0] scanning essid "$ssid" |tr '\n' ' '|sed 's/Cell \\([0-9]\\{2,\\}\\) - Address:/\\nCell \\1 - Address:/g'|grep -i "$ssid"`)
{
next unless /Signal level=([\d\-]+) dBm/;
$SignalLevel=$1;
next unless /.*Signal level=([\d\-]+) dBm.* Extra: Last beacon: ([\d]+)ms/;
if ( $2 < 10000 ) {$SignalLevel=$1;}
}
foreach(`iw dev $_[0] survey dump|grep -A 1 \"\\[in use\\]\"`)