mirror of https://github.com/aredn/aredn.git
Merge: feature: snrlog updates to handle host name change and lack of hostname or ip info
This commit is contained in:
commit
13c3d88c72
|
@ -40,6 +40,7 @@ $sigdir="/sys/kernel/debug/ieee80211/phy0/netdev\:wlan0/stations";
|
||||||
$nf = `iw wlan0 survey dump | grep -A 1 'in use' | tail -1`;
|
$nf = `iw wlan0 survey dump | grep -A 1 'in use' | tail -1`;
|
||||||
$nf =~ s/^[^-\d]*([-\d]+).*$/$1/;
|
$nf =~ s/^[^-\d]*([-\d]+).*$/$1/;
|
||||||
chomp $nf;
|
chomp $nf;
|
||||||
|
|
||||||
if (! -e $tmpdir ) { system("mkdir $tmpdir > /dev/null"); }
|
if (! -e $tmpdir ) { system("mkdir $tmpdir > /dev/null"); }
|
||||||
|
|
||||||
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
|
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
|
||||||
|
@ -48,6 +49,11 @@ $d = sprintf ("%02d/%02d %02d:%02d:%02d",$mon+1, $mday,$hour, $min, $sec);
|
||||||
foreach $sigmac ( `ls $sigdir` )
|
foreach $sigmac ( `ls $sigdir` )
|
||||||
{
|
{
|
||||||
chomp $sigmac;
|
chomp $sigmac;
|
||||||
|
$filename = `ls $tmpdir/$sigmac*` ;
|
||||||
|
$filename =~ /^.*\/([^-]*)-(.*)$/;
|
||||||
|
$isFile = $1;
|
||||||
|
$hnamef = $2;
|
||||||
|
|
||||||
chomp ($ip = `cat /proc/net/arp | grep $sigmac | cut -f1 -d\" "`);
|
chomp ($ip = `cat /proc/net/arp | grep $sigmac | cut -f1 -d\" "`);
|
||||||
$hname="";
|
$hname="";
|
||||||
foreach(`nslookup $ip`)
|
foreach(`nslookup $ip`)
|
||||||
|
@ -57,7 +63,43 @@ foreach $sigmac ( `ls $sigdir` )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (($hnamef and $hnamef eq $hname ) or ($hname and ! $isFile ))
|
||||||
|
{
|
||||||
$sigdat = "$sigmac-$hname";
|
$sigdat = "$sigmac-$hname";
|
||||||
|
}
|
||||||
|
elsif ( $hnamef eq $ip and $hname )
|
||||||
|
{
|
||||||
|
system("mv $tmpdir/$sigmac-$ip $tmpdir/$sigmac-$hname > /dev/null");
|
||||||
|
$sigdat = "$sigmac-$hname";
|
||||||
|
}
|
||||||
|
elsif ($hname and ! $hnamef and $isFile )
|
||||||
|
{
|
||||||
|
system("mv $tmpdir/$sigmac- $tmpdir/$sigmac-$hname > /dev/null");
|
||||||
|
$sigdat = "$sigmac-$hname";
|
||||||
|
}
|
||||||
|
elsif (( $hnamef eq $ip) or ( $ip and ! $isFile ))
|
||||||
|
{
|
||||||
|
$sigdat = "$sigmac-$ip";
|
||||||
|
}
|
||||||
|
elsif ( $isFile and ! $hnamef and $ip )
|
||||||
|
{
|
||||||
|
system("mv $tmpdir/$sigmac- $tmpdir/$sigmac-$ip > /dev/null");
|
||||||
|
$sigdat = "$sigmac-$ip";
|
||||||
|
}
|
||||||
|
elsif ($hnamef and ! $hname )
|
||||||
|
{
|
||||||
|
$sigdat = "$sigmac-$hnamef";
|
||||||
|
}
|
||||||
|
elsif ( $hnamef and $hname and $hnamef ne $hname )
|
||||||
|
{
|
||||||
|
system("mv $tmpdir/$sigmac-$hnamef $tmpdir/$sigmac-$hname > /dev/null");
|
||||||
|
$sigdat = "$sigmac-$hname";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sigdat = "$sigmac-";
|
||||||
|
}
|
||||||
|
|
||||||
chomp ($siglevel = `cat $sigdir/$sigmac/last_signal`) ;
|
chomp ($siglevel = `cat $sigdir/$sigmac/last_signal`) ;
|
||||||
if ($siglevel < -100 or $siglevel >= 0 ) { next; }
|
if ($siglevel < -100 or $siglevel >= 0 ) { next; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue