summaryrefslogtreecommitdiffhomepage
path: root/libs/iwinfo/src/iwinfo_wext.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-11-15 15:21:03 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-11-15 15:21:03 +0000
commit1b77a6f4c49b29b83e3063d9deca1a38e97ad897 (patch)
tree43d1b140fb67816f73b0caa60d0476d0aad77435 /libs/iwinfo/src/iwinfo_wext.c
parent2bfa17e6f415a5d99a2f65dc37e4b8ceac1c3b6a (diff)
libs/iwinfo: add *_get_freqlist()
Diffstat (limited to 'libs/iwinfo/src/iwinfo_wext.c')
-rw-r--r--libs/iwinfo/src/iwinfo_wext.c31
1 files changed, 31 insertions, 0 deletions
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) &range;
+ 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 */