Skip to content
Snippets Groups Projects
Commit 2ddf77fc authored by Matthias Schiffer's avatar Matthias Schiffer Committed by GitHub
Browse files

Merge pull request #990 from freifunk-ffm/christf_get_mesh_interfaces

gluon-core: add function to gluon.util that returns all active mesh-devices
parents cd4753aa e41e5cb8
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,6 @@ local uci = require('luci.model.uci').cursor() ...@@ -38,7 +38,6 @@ local uci = require('luci.model.uci').cursor()
local lutil = require 'luci.util' local lutil = require 'luci.util'
local fs = require 'nixio.fs' local fs = require 'nixio.fs'
module 'gluon.util' module 'gluon.util'
function exec(...) function exec(...)
...@@ -74,6 +73,16 @@ function node_id() ...@@ -74,6 +73,16 @@ function node_id()
return string.gsub(sysconfig.primary_mac, ':', '') return string.gsub(sysconfig.primary_mac, ':', '')
end end
function get_mesh_devices(uconn)
local dump = uconn:call("network.interface", "dump", {})
local devices = {}
for _, interface in ipairs(dump.interface) do
if ( (interface.proto == "gluon_mesh") and interface.up ) then
table.insert(devices, interface.device)
end
end
return devices
end
local function find_phy_by_path(path) local function find_phy_by_path(path)
for phy in fs.glob('/sys/devices/' .. path .. '/ieee80211/phy*') do for phy in fs.glob('/sys/devices/' .. path .. '/ieee80211/phy*') do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment