From 1b77a6f4c49b29b83e3063d9deca1a38e97ad897 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 15 Nov 2009 15:21:03 +0000 Subject: libs/iwinfo: add *_get_freqlist() --- libs/iwinfo/src/iwinfo_wext.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'libs/iwinfo/src/iwinfo_wext.c') diff --git a/libs/iwinfo/src/iwinfo_wext.c b/libs/iwinfo/src/iwinfo_wext.c index 387cb13b44..eebaea6af8 100644 --- a/libs/iwinfo/src/iwinfo_wext.c +++ b/libs/iwinfo/src/iwinfo_wext.c @@ -394,6 +394,37 @@ int wext_get_txpwrlist(const char *ifname, char *buf, int *len) return -1; } +int wext_get_freqlist(const char *ifname, char *buf, int *len) +{ + struct iwreq wrq; + struct iw_range range; + struct iwinfo_freqlist_entry entry; + int i, bl; + + wrq.u.data.pointer = (caddr_t) ⦥ + wrq.u.data.length = sizeof(struct iw_range); + wrq.u.data.flags = 0; + + if(wext_ioctl(ifname, SIOCGIWRANGE, &wrq) >= 0) + { + bl = 0; + + for(i = 0; i < range.num_frequency; i++) + { + entry.mhz = wext_freq2mhz(&range.freq[i]); + entry.channel = range.freq[i].i; + + memcpy(&buf[bl], &entry, sizeof(struct iwinfo_freqlist_entry)); + bl += sizeof(struct iwinfo_freqlist_entry); + } + + *len = bl; + return 0; + } + + return -1; +} + int wext_get_mbssid_support(const char *ifname, int *buf) { /* No multi bssid support atm */ -- cgit v1.2.3