summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-05-14 13:23:14 +0000
committerOlivier Blin <oblin@mandriva.com>2008-05-14 13:23:14 +0000
commitb33260d9695b8fd781188854f4fe26272edd0f8c (patch)
treea0af0a86537a961a1c43927d714efa2f4e3ba698
parent02ebd73327358617d2bb8d902a3d756641c978df (diff)
downloaddrakx-net-b33260d9695b8fd781188854f4fe26272edd0f8c.tar
drakx-net-b33260d9695b8fd781188854f4fe26272edd0f8c.tar.gz
drakx-net-b33260d9695b8fd781188854f4fe26272edd0f8c.tar.bz2
drakx-net-b33260d9695b8fd781188854f4fe26272edd0f8c.tar.xz
drakx-net-b33260d9695b8fd781188854f4fe26272edd0f8c.zip
try to normalize signal level reported by wpa_supplicant only if some values are greater than 100
-rw-r--r--lib/network/monitor.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/network/monitor.pm b/lib/network/monitor.pm
index 31bc8cc..f6828db 100644
--- a/lib/network/monitor.pm
+++ b/lib/network/monitor.pm
@@ -37,14 +37,18 @@ sub list_wireless {
$networks{$ap}{ap} ||= $ap;
#- wpa_supplicant may list the network two times, use ||=
$networks{$ap}{frequency} ||= $frequency;
- #- signal level is really too high in wpa_supplicant
- #- this should be standardized at some point
- $networks{$ap}{signal_strength} ||= int($signal_strength/3.5);
+ $networks{$ap}{signal_strength} ||= $signal_strength;
my $adhoc = $flags =~ s/\[ibss\]//i;
$networks{$ap}{mode} ||= $adhoc ? "Ad-Hoc" : "Managed";
$networks{$ap}{flags} ||= $flags;
$networks{$ap}{essid} ||= $essid;
}
+ if (any { $_->{signal_strength} > 100 } %networks) {
+ #- signal level is really too high in wpa_supplicant
+ #- this should be standardized at some point
+ $_->{signal_strength} = int($_->{signal_strength}/3.5);
+ }
+
#- network id / ssid / bssid / flags
while ($list =~ /^(\d+)\t(.*?)\t(.*?)\t(.*)$/mg) {
foreach my $net (uniq(if_($networks{$3}, $networks{$3}), grep { $_->{essid} eq $2 } values(%networks))) {