X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/2e82ad88dc26d520f6cb25c56c9744f018124cc6..ce022c47710859a697219ab87d1db655332c4d62:/package/openwrt/wlcompat.c?ds=inline diff --git a/package/openwrt/wlcompat.c b/package/openwrt/wlcompat.c index aab6dada6..b6a9c20b7 100644 --- a/package/openwrt/wlcompat.c +++ b/package/openwrt/wlcompat.c @@ -1,5 +1,26 @@ -// insert header here -// mbm. gpl. +/* + * wlcompat.c + * + * Copyright (C) 2005 Mike Baker, + * Felix Fietkau + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ + #include #include @@ -134,9 +155,10 @@ static int wlcompat_get_scan(struct net_device *dev, wl_bss_info_t *bss_info; char *info_ptr; char *current_ev = extra; + char *current_val; char *end_buf = extra + IW_SCAN_MAX_DATA; struct iw_event iwe; - int i; + int i, j; if (wl_ioctl(dev, WLC_SCAN_RESULTS, buf, WLC_IOCTL_MAXLEN) < 0) return -EAGAIN; @@ -165,6 +187,25 @@ static int wlcompat_get_scan(struct net_device *dev, iwe.u.freq.m = bss_info->channel; current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); + /* add quality statistics */ + iwe.cmd = IWEVQUAL; + iwe.u.qual.level = bss_info->RSSI; + iwe.u.qual.noise = bss_info->phy_noise; + iwe.u.qual.qual = 0; + current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_QUAL_LEN); + + /* send rate information */ + iwe.cmd = SIOCGIWRATE; + current_val = current_ev + IW_EV_LCP_LEN; + iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; + + for(j = 0 ; j < bss_info->rateset.count ; j++) { + iwe.u.bitrate.value = ((bss_info->rateset.rates[j] & 0x7f) * 500000); + current_val = iwe_stream_add_value(current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN); + } + if((current_val - current_ev) > IW_EV_LCP_LEN) + current_ev = current_val; + info_ptr += sizeof(wl_bss_info_t); if (bss_info->ie_length % 4) info_ptr += bss_info->ie_length + 4 - (bss_info->ie_length % 4);