1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Fix wizard modem list error when empty

This commit is contained in:
Ycarus (Yannick Chabanois) 2020-09-13 08:41:21 +02:00
parent 539a566ada
commit b9f79acfae

View file

@ -531,13 +531,15 @@ end
iffind=0
iftty = luci.sys.exec("/usr/bin/mmcli -L")
for listtty in iftty:gmatch("([^\r\n]*)[\r\n]") do
modemid = luci.sys.exec("echo '" .. listtty .. "' | awk -F' ' '{print $1}' | awk -F/ '{print $6}'")
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.sys.exec("echo '" .. modeminfo .. "' | grep 'modem.generic.device ' | awk -F': ' '{print $2}'")
tty = luci.util.trim(luci.sys.exec("echo '" .. modeminfo .. "' | grep 'modem.generic.device ' | awk -F': ' '{print $2}'"))
%>
<option value="<%=tty%>"<% if uci:get("network",ifname,"device") == tty then iffind = 1 %> selected="selected"<% end %>><%=tty%></option>
<%
end
end
if iffinf == 0 and uci:get("network",ifname,"device") ~= nil then
%>
<option value="<%=uci:get("network",ifname,"device")%>" selected="selected"><%=uci:get("network",ifname,"device")%></option>