nl80211_get_freqlist.lua

#!/usr/bin/env eco

local nl80211 = require 'eco.nl80211'

local freqlist, err = nl80211.get_freqlist('phy0')
if not freqlist then
    print(err)
    return
end

for _, info in ipairs(freqlist) do
    io.write(info.freq .. ' MHz')
    io.write('(Band: ', info.band .. ' GHz, Channel: ', info.channel, ') ')

    local flags = {}

    for flag in pairs(info.flags) do
        flags[#flags + 1] = flag
    end

    if #flags > 0 then
        io.write('[', table.concat(flags, ', '), ']')
    end

    io.write('\n')
end
generated by LDoc 1.5.0 Last updated 2026-04-09 14:48:22