summaryrefslogtreecommitdiff
path: root/openwrt/target/linux/package/wlcompat
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2005-11-11 16:04:02 +0000
committerFelix Fietkau <nbd@openwrt.org>2005-11-11 16:04:02 +0000
commitd912196f677bcba32d0703ffb76fd30f94bdae79 (patch)
treeaea4317d42d4a6798a06db99837bff7e4d50a42c /openwrt/target/linux/package/wlcompat
parent2cba595a9272b6c6a9b6b4e8575a04a3eaeb5108 (diff)
downloadmtk-20170518-d912196f677bcba32d0703ffb76fd30f94bdae79.zip
mtk-20170518-d912196f677bcba32d0703ffb76fd30f94bdae79.tar.gz
mtk-20170518-d912196f677bcba32d0703ffb76fd30f94bdae79.tar.bz2
fix noise/signal level display (fixes #20)
SVN-Revision: 2421
Diffstat (limited to 'openwrt/target/linux/package/wlcompat')
-rw-r--r--openwrt/target/linux/package/wlcompat/wlcompat.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/openwrt/target/linux/package/wlcompat/wlcompat.c b/openwrt/target/linux/package/wlcompat/wlcompat.c
index 07e8db0..3baeb43 100644
--- a/openwrt/target/linux/package/wlcompat/wlcompat.c
+++ b/openwrt/target/linux/package/wlcompat/wlcompat.c
@@ -225,7 +225,7 @@ struct iw_statistics *wlcompat_get_wireless_stats(struct net_device *dev)
{
wl_bss_info_t *bss_info = (wl_bss_info_t *) buf;
get_pktcnt_t pkt;
- int rssi, noise;
+ int rssi, noise, ap;
memset(&wstats, 0, sizeof(wstats));
memset(&pkt, 0, sizeof(pkt));
@@ -234,12 +234,18 @@ struct iw_statistics *wlcompat_get_wireless_stats(struct net_device *dev)
wl_ioctl(dev, WLC_GET_BSS_INFO, bss_info, WLC_IOCTL_MAXLEN);
wl_ioctl(dev, WLC_GET_PKTCNTS, &pkt, sizeof(pkt));
- // somehow the structure doesn't fit here
- noise = buf[0x50];
- rssi = buf[0x52];
+ wl_ioctl(dev, WLC_GET_AP, &ap, sizeof(ap));
+ if (!ap) {
+ // somehow the structure doesn't fit here
+ rssi = buf[82];
+ noise = buf[84];
+ } else {
+ noise = 0;
+ rssi = 0;
+ }
wstats.qual.level = rssi;
- wstats.qual.noise = -100 + noise;
+ wstats.qual.noise = noise;
wstats.discard.misc = pkt.rx_bad_pkt;
wstats.discard.retries = pkt.tx_bad_pkt;