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

gluon-status-page: use UCI + iwinfo to get channel information

The network.wireless status ubus call only returns the configured
channel from UCI, breaking the status page in outdoor mode, where the
configuration contains 'auto' instead of a number.

Fixes: 0d3fa6b5 ("gluon-status-page: use ubus to get radio channels")
Closes #2336
parent e153ba6b
No related branches found
No related tags found
No related merge requests found
<%- <%-
local iwinfo = require 'iwinfo'
local ubus = require 'ubus' local ubus = require 'ubus'
local unistd = require 'posix.unistd' local unistd = require 'posix.unistd'
local util = require 'gluon.util' local util = require 'gluon.util'
local wireless = require 'gluon.wireless'
local uci = require('simple-uci').cursor()
local translations = {} local translations = {}
local site_i18n = i18n 'gluon-site' local site_i18n = i18n 'gluon-site'
...@@ -35,22 +39,22 @@ ...@@ -35,22 +39,22 @@
return interfaces return interfaces
end end
local function get_radios(uconn) local function get_radios()
local radios = uconn:call("network.wireless", "status", {})
local ret = {} local ret = {}
for radio, info in pairs(radios) do wireless.foreach_radio(uci, function(radio)
if info.up then local channel = iwinfo.nl80211.channel(wireless.find_phy(radio))
if channel then
table.insert(ret, { table.insert(ret, {
name = radio, name = radio['.name'],
channel = info.config.channel, channel = channel,
}) })
end end
end end)
table.sort(ret, function(a, b) table.sort(ret, function(a, b)
return a.name < b.name return a.name < b.name
end) end)
return ret return ret
end end
...@@ -72,10 +76,11 @@ ...@@ -72,10 +76,11 @@
end end
local interfaces = get_interfaces(uconn) local interfaces = get_interfaces(uconn)
local radios = get_radios(uconn)
ubus.close(uconn) ubus.close(uconn)
local radios = get_radios()
local function sorted(t) local function sorted(t)
t = {unpack(t)} t = {unpack(t)}
table.sort(t) table.sort(t)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment