diff options
author | Felix Fietkau <nbd@openwrt.org> | 2005-11-11 16:04:02 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2005-11-11 16:04:02 +0000 |
commit | 36808a9ea8841b66f9731ff933a8770da034cbb7 (patch) | |
tree | 7f0d3abf4e8bd4bb4d0fb4821a500f16ddac3e3c | |
parent | acc81afd971d18f4f7974301f4f56386a1562f14 (diff) | |
download | upstream-36808a9ea8841b66f9731ff933a8770da034cbb7.tar.gz upstream-36808a9ea8841b66f9731ff933a8770da034cbb7.tar.bz2 upstream-36808a9ea8841b66f9731ff933a8770da034cbb7.zip |
fix noise/signal level display (fixes #20)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2421 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r-- | target/linux/package/wlcompat/wlcompat.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/target/linux/package/wlcompat/wlcompat.c b/target/linux/package/wlcompat/wlcompat.c index 07e8db0884..3baeb43178 100644 --- a/target/linux/package/wlcompat/wlcompat.c +++ b/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; |