mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-13 02:51:50 +00:00
Only get modem list one time
This commit is contained in:
parent
8d449e9203
commit
5525957681
1 changed files with 12 additions and 7 deletions
|
@ -35,6 +35,17 @@
|
|||
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
|
||||
|
||||
|
||||
%>
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=git-18.243.49640-2f13420" data-strings="{"path":{"resource":"\/luci-static\/resources","browser":"\/cgi-bin\/luci\/admin\/filebrowser"}}"></script>
|
||||
|
@ -780,17 +791,11 @@
|
|||
<select class="cbi-input-select" data-update="change" id="cbid.network.<%=ifname%>.device.modemmanager" name="cbid.network.<%=ifname%>.device.modemmanager" size="1">
|
||||
<%
|
||||
iffind=0
|
||||
iftty = luci.sys.exec("/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("/usr/bin/mmcli -m " .. modemid .. " --output-keyvalue")
|
||||
tty = luci.util.trim(luci.sys.exec("echo '" .. modeminfo .. "' | grep 'modem.generic.device ' | awk -F': ' '{print $2}'"))
|
||||
for _, tty in ipairs(alltty) do
|
||||
%>
|
||||
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
|
||||
<%
|
||||
end
|
||||
end
|
||||
if iffind == 0 and uci:get("network",ifname,"device") ~= nil then
|
||||
%>
|
||||
<option value="<%=uci:get("network",ifname,"device")%>" selected="selected"><%=uci:get("network",ifname,"device")%></option>
|
||||
|
|
Loading…
Reference in a new issue