diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-11-15 15:21:03 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-11-15 15:21:03 +0000 |
commit | 1b77a6f4c49b29b83e3063d9deca1a38e97ad897 (patch) | |
tree | 43d1b140fb67816f73b0caa60d0476d0aad77435 /libs/iwinfo/src/iwinfo_madwifi.c | |
parent | 2bfa17e6f415a5d99a2f65dc37e4b8ceac1c3b6a (diff) |
libs/iwinfo: add *_get_freqlist()
Diffstat (limited to 'libs/iwinfo/src/iwinfo_madwifi.c')
-rw-r--r-- | libs/iwinfo/src/iwinfo_madwifi.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libs/iwinfo/src/iwinfo_madwifi.c b/libs/iwinfo/src/iwinfo_madwifi.c index 1fe777f1d5..99c02dcd05 100644 --- a/libs/iwinfo/src/iwinfo_madwifi.c +++ b/libs/iwinfo/src/iwinfo_madwifi.c @@ -494,6 +494,32 @@ int madwifi_get_scanlist(const char *ifname, char *buf, int *len) return ret; } +int madwifi_get_freqlist(const char *ifname, char *buf, int *len) +{ + int i, bl; + struct ieee80211req_chaninfo chans; + struct iwinfo_freqlist_entry entry; + + if( get80211priv(ifname, IEEE80211_IOCTL_GETCHANINFO, &chans, sizeof(chans)) >= 0 ) + { + bl = 0; + + for( i = 0; i < chans.ic_nchans; i++ ) + { + entry.mhz = (int)(chans.ic_chans[i].ic_freq / 1000); + entry.channel = chans.ic_chans[i].ic_ieee; + + memcpy(&buf[bl], &entry, sizeof(struct iwinfo_freqlist_entry)); + bl += sizeof(struct iwinfo_freqlist_entry); + } + + *len = bl; + return 0; + } + + return -1; +} + int madwifi_get_mbssid_support(const char *ifname, int *buf) { /* We assume that multi bssid is always possible */ |