summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/iwinfo/src/iwinfo.lua
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/package/iwinfo/src/iwinfo.lua')
-rwxr-xr-xcontrib/package/iwinfo/src/iwinfo.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/package/iwinfo/src/iwinfo.lua b/contrib/package/iwinfo/src/iwinfo.lua
index caa2816fe..f7dbf42fd 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