From d2c7747851945f77dd6327bd0afb7415be5d1c4d Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 9 Aug 2009 02:45:05 +0000 Subject: libs/iwinfo: fix broadcom signal calculation in master mode --- libs/iwinfo/src/iwinfo_wl.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libs') diff --git a/libs/iwinfo/src/iwinfo_wl.c b/libs/iwinfo/src/iwinfo_wl.c index 37f4de14ac..3362475012 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; } -- cgit v1.2.3