diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-09-28 06:54:04 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-09-28 06:54:04 +0000 |
commit | 07fafab9c16ec600d6621c9c67d7474c63ff705b (patch) | |
tree | 427aab09af5ca4f10c6b325a0d566ed4bf964625 /contrib/package/iwinfo/src/iwinfo.lua | |
parent | 16d65c96b035a10aa93a96e5a789ebef9ca3a76d (diff) |
[libiwinfo] introduce country() and countrylist() (ISO3166 to driver code mapping)
Diffstat (limited to 'contrib/package/iwinfo/src/iwinfo.lua')
-rwxr-xr-x | contrib/package/iwinfo/src/iwinfo.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/package/iwinfo/src/iwinfo.lua b/contrib/package/iwinfo/src/iwinfo.lua index caa2816fe0..f7dbf42fdb 100755 --- a/contrib/package/iwinfo/src/iwinfo.lua +++ b/contrib/package/iwinfo/src/iwinfo.lua @@ -132,6 +132,25 @@ function print_assoclist(api, dev) print("") end +function print_countrylist(api, dev) + local iw = iwinfo[api] + local cl = iw.countrylist(dev) + local cc = iw.country(dev) + local ce + + if cl and #cl > 0 then + for _, ce in ipairs(cl) do + printf("%s %4s %s", + (cc == ce.alpha2) and "*" or " ", + ce.ccode, ce.name) + end + else + print("No country code information available") + end + + print("") +end + if #arg ~= 2 then print("Usage:") @@ -140,6 +159,7 @@ if #arg ~= 2 then print(" iwinfo <device> txpowerlist") print(" iwinfo <device> freqlist") print(" iwinfo <device> assoclist") + print(" iwinfo <device> countrylist") os.exit(1) end @@ -166,6 +186,9 @@ elseif arg[2]:match("^f") then elseif arg[2]:match("^a") then print_assoclist(api, dev) +elseif arg[2]:match("^c") then + print_countrylist(api, dev) + else print("Unknown command: " .. arg[2]) end |