%+header%> <% local uci = require("luci.model.uci").cursor() local net = require "luci.model.network".init() local fs = require "nixio.fs" local sys = require "luci.sys" local ut = require "luci.util" local ifaces = sys.net:devices() local ifttyu = nixio.fs.glob("/dev/ttyUSB*") local ifttyc = nixio.fs.glob("/dev/cdc-wdm*") local sqm = luci.sys.exec("opkg list-installed | grep -q luci-app-sqm && echo -n '1' || echo -n '0'") local qos = luci.sys.exec("opkg list-installed | grep -q luci-app-qos && echo -n '1' || echo -n '0'") menuentry = uci:get("openmptcprouter","settings","menu") or "openmptcprouter" function device_notvirtual(dev) if dev:match("^eth.*") or dev:match("^wwan.*") or dev:match("^tun.*") or dev:match("/") then return true end networks = net:get_networks() for _, iface in ipairs(networks) do local ifacen = iface:name() local ifacename = uci:get("network",ifacen,"device") local ifacetype = uci:get("network",ifacen,"type") or "" local ifaceproto = uci:get("network",ifacen,"proto") or "" --if ifacename == dev and (ifacetype == "macvlan" or ifacetype == "bridge" or ifaceproto == "6in4") then if ifacename == dev and (ifacetype == "macvlan" or ifaceproto == "6in4") then return false end end return true end function splitstring(inputstr, sep) if inputstr == nil then return "" end if sep == nil then sep = "%s" end local t={} for str in string.gmatch(inputstr, "([^"..sep.."]+)") do table.insert(t, str) end return t end alltty = {} iftty = luci.sys.exec("timeout 1 /usr/bin/mmcli -L") for listtty in iftty:gmatch("([^\r\n]*)[\r\n]") do modemid = luci.util.trim(luci.sys.exec("echo '" .. listtty .. "' | awk -F' ' '{print $1}' | awk -F/ '{print $6}'")) if modemid ~= '' then modeminfo = luci.sys.exec("timeout 1 /usr/bin/mmcli -m " .. modemid .. " --output-keyvalue") tty = luci.util.trim(luci.sys.exec("echo '" .. modeminfo .. "' | grep 'modem.generic.device ' | awk -F': ' '{print $2}'")) table.insert(alltty, tty) end end %> <% if stderr and #stderr > 0 then %>
<%=pcdata(stderr)%><% end %> <%+footer%>