Skip to content
Snippets Groups Projects
Commit fadfc64e authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-luci-wifi-config: don't use luci.sys.wifi.getiwinfo()

Directly using libiwinfo is more reliable.
parent f4a3f73f
No related branches found
No related tags found
No related merge requests found
local uci = luci.model.uci.cursor() local uci = luci.model.uci.cursor()
local fs = require 'nixio.fs' local fs = require 'nixio.fs'
local iwinfo = require 'iwinfo'
local function find_phy_by_path(path) local function find_phy_by_path(path)
...@@ -17,9 +18,9 @@ local function find_phy_by_macaddr(macaddr) ...@@ -17,9 +18,9 @@ local function find_phy_by_macaddr(macaddr)
end end
end end
local function txpower_list(iw) local function txpower_list(phy)
local list = iw.txpwrlist or { } local list = iwinfo.nl80211.txpwrlist(phy) or { }
local off = tonumber(iw.txpower_offset) or 0 local off = tonumber(iwinfo.nl80211.txpower_offset(phy)) or 0
local new = { } local new = { }
local prev = -1 local prev = -1
local _, val local _, val
...@@ -93,9 +94,7 @@ for _, radio in ipairs(radios) do ...@@ -93,9 +94,7 @@ for _, radio in ipairs(radios) do
end end
if phy then if phy then
local iw = luci.sys.wifi.getiwinfo(phy) local txpowers = txpower_list(phy)
if iw then
local txpowers = txpower_list(iw)
if #txpowers > 1 then if #txpowers > 1 then
local tp = p:option(ListValue, radio .. '_txpower', translate("Transmission power")) local tp = p:option(ListValue, radio .. '_txpower', translate("Transmission power"))
...@@ -112,7 +111,6 @@ for _, radio in ipairs(radios) do ...@@ -112,7 +111,6 @@ for _, radio in ipairs(radios) do
end end
end end
end end
end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment