summaryrefslogtreecommitdiffhomepage
path: root/libs/iwinfo
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-08-09 02:45:05 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-08-09 02:45:05 +0000
commitd2c7747851945f77dd6327bd0afb7415be5d1c4d (patch)
treefc226f8e0929b74f307df19319366f84026ec8d8 /libs/iwinfo
parent87460e8a05faef9c4bb2c68735eef4f5c5ac15d0 (diff)
libs/iwinfo: fix broadcom signal calculation in master mode
Diffstat (limited to 'libs/iwinfo')
-rw-r--r--libs/iwinfo/src/iwinfo_wl.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libs/iwinfo/src/iwinfo_wl.c b/libs/iwinfo/src/iwinfo_wl.c
index 37f4de14a..336247501 100644
--- a/libs/iwinfo/src/iwinfo_wl.c
+++ b/libs/iwinfo/src/iwinfo_wl.c
@@ -152,16 +152,14 @@ int wl_get_signal(const char *ifname, int *buf)
wl_ioctl(ifname, WLC_GET_BSS_INFO, tmp, WLC_IOCTL_MAXLEN);
- rssi = 0;
- rssi_count = 0;
-
if( !wl_ioctl(ifname, WLC_GET_AP, &ap, sizeof(ap)) && !ap )
{
- rssi = tmp[WL_BSS_RSSI_OFFSET];
- rssi_count = 1;
+ *buf = tmp[WL_BSS_RSSI_OFFSET];
}
else
{
+ rssi = rssi_count = 0;
+
/* Calculate average rssi from conntected stations */
if( (macs = wl_read_assoclist(ifname)) != NULL )
{
@@ -171,16 +169,16 @@ int wl_get_signal(const char *ifname, int *buf)
if( !wl_ioctl(ifname, WLC_GET_RSSI, &starssi, 12) )
{
- rssi += starssi.rssi;
+ rssi -= starssi.rssi;
rssi_count++;
}
}
free(macs);
}
- }
- *buf = (rssi == 0 || rssi_count == 0) ? 1 : (rssi / rssi_count);
+ *buf = (rssi == 0 || rssi_count == 0) ? 1 : -(rssi / rssi_count);
+ }
return 0;
}