feat:优化拨号逻辑
当前逻辑:开机触发modem_scan scan到modem则开始拨号
This commit is contained in:
parent
e7131d2883
commit
260548fcb2
@ -5,7 +5,7 @@ local http = require "luci.http"
|
||||
m = Map("modem", translate("Dial Config"))
|
||||
m.redirect = dispatcher.build_url("admin", "network", "modem","dial_overview")
|
||||
|
||||
s = m:section(NamedSection, arg[1], "dial-config", "")
|
||||
s = m:section(NamedSection, arg[1], "modem-device", "")
|
||||
s.addremove = false
|
||||
s.dynamic = false
|
||||
s:tab("general", translate("General Settings"))
|
||||
|
@ -18,25 +18,25 @@ o.description = translate("Enable dial configurations")
|
||||
-- 添加模块状态
|
||||
m:append(Template("modem/modem_status"))
|
||||
|
||||
s = m:section(TypedSection, "dial-config", translate("Config List"))
|
||||
s = m:section(TypedSection, "modem-device", translate("Config List"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.addremove = ture
|
||||
s.template = "modem/tblsection"
|
||||
s.extedit = d.build_url("admin", "network", "modem", "dial_config", "%s")
|
||||
|
||||
function s.create(uci, t)
|
||||
local uuid = string.gsub(luci.sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)"), "-", "")
|
||||
t = uuid
|
||||
TypedSection.create(uci, t)
|
||||
luci.http.redirect(uci.extedit:format(t))
|
||||
end
|
||||
function s.remove(uci, t)
|
||||
uci.map.proceed = true
|
||||
uci.map:del(t)
|
||||
luci.http.redirect(d.build_url("admin", "network", "modem","dial_overview"))
|
||||
end
|
||||
-- function s.create(uci, t)
|
||||
-- local uuid = string.gsub(luci.sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)"), "-", "")
|
||||
-- t = uuid
|
||||
-- TypedSection.create(uci, t)
|
||||
-- luci.http.redirect(uci.extedit:format(t))
|
||||
-- end
|
||||
-- function s.remove(uci, t)
|
||||
-- uci.map.proceed = true
|
||||
-- uci.map:del(t)
|
||||
-- luci.http.redirect(d.build_url("admin", "network", "modem","dial_overview"))
|
||||
-- end
|
||||
|
||||
o = s:option(Flag, "enable", translate("Enable"))
|
||||
o = s:option(Flag, "enable_dial", translate("enable_dial"))
|
||||
o.width = "5%"
|
||||
o.rmempty = false
|
||||
|
||||
|
@ -156,4 +156,7 @@ at_port = s:option(Value, "at_port", translate("AT Port"))
|
||||
at_port.placeholder = translate("Not null")
|
||||
at_port.rmempty = false
|
||||
|
||||
enable_dial = s:option(Flag, "enable_dial", translate("enable_dial"))
|
||||
enable_dial.default = 1
|
||||
enable_dial.rmempty = false
|
||||
return m
|
||||
|
@ -68,6 +68,8 @@ end
|
||||
|
||||
-- AT串口
|
||||
o = s:option(DummyValue, "at_port", translate("AT Port"))
|
||||
|
||||
o = s:option(Flag,'enable_dial',translate('Enable Dial'))
|
||||
-- o = s:option(Value, "at_port", translate("AT Port"))
|
||||
-- o.placeholder = translate("Not null")
|
||||
-- o.rmempty = false
|
||||
|
509
luci-app-modem/luasrc/view/modem/modem_debug_new.htm
Normal file
509
luci-app-modem/luasrc/view/modem/modem_debug_new.htm
Normal file
@ -0,0 +1,509 @@
|
||||
<%+header%>
|
||||
<script type="text/javascript" src="<%=resource%>/xhr.js"></script>
|
||||
<div class="cbi-map" id="cbi-modem-debug">
|
||||
<h2 id="content" name="content">
|
||||
<%:Modem Debug%>
|
||||
</h2>
|
||||
<div class="cbi-map-descr">
|
||||
<%:Debug Your Module%>
|
||||
</div>
|
||||
|
||||
<head>
|
||||
<style type="text/css">
|
||||
/* table {
|
||||
width: 100%;
|
||||
border-spacing: 10px;
|
||||
border: 0px;
|
||||
} */
|
||||
|
||||
tr td:first-child {
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
/* AT命令响应 */
|
||||
/* #response_label {
|
||||
font-size: 15px;
|
||||
} */
|
||||
|
||||
/* 隐藏tab菜单 */
|
||||
.cbi-tabmenu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 隐藏tab内容 */
|
||||
#tab_context {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 隐藏AT命令标题 */
|
||||
#at_command_title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* AT命令响应 */
|
||||
textarea {
|
||||
background: #373737;
|
||||
border: none;
|
||||
color: #FFF;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#popup {
|
||||
width: 560px;
|
||||
height: 190px;
|
||||
padding: 20px;
|
||||
background-color: gainsboro;
|
||||
border-style: solid;
|
||||
position: fixed;
|
||||
top: 40%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
left: 0;
|
||||
right: 0;
|
||||
text-align: center;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#lockcell_feature {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
||||
<div class="cbi-section fade-in">
|
||||
<h3>
|
||||
<%:Message%>
|
||||
</h3>
|
||||
<table class="table" id="message">
|
||||
<tr class="tr">
|
||||
<td colspan="2" class="td left">
|
||||
<div align="left" id="info_message" style="font-size:1.875em">
|
||||
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>"
|
||||
style="vertical-align:middle" />
|
||||
<%:Loading modem%>...
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-modem" style="display: none;">
|
||||
<div class="cbi-section fade-in">
|
||||
<!-- <legend><%:Modem Select%></legend> -->
|
||||
<h3>
|
||||
<%:Modem Select%>
|
||||
</h3>
|
||||
<div class="cbi-section-node">
|
||||
<div class="cbi-value cbi-value-last">
|
||||
<label class="cbi-value-title">
|
||||
<%:Modem Name%>
|
||||
</label>
|
||||
<div class="cbi-value-field">
|
||||
<div class="cbi-checkbox">
|
||||
<select name="modem_select" id="modem_select" class="cbi-input-select"></select>
|
||||
</div>
|
||||
<div class="cbi-value-description">
|
||||
<%:Select a modem for debugging%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<ul class="cbi-tabmenu" id="tab_menu">
|
||||
<li class="cbi-tab" data-tab="mode_tab"><a href="#">
|
||||
<%:Mode%>
|
||||
</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="network_prefer_tab"><a href="#">
|
||||
<%:Network Preferences%>
|
||||
</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="lockband_tab"><a href="#">
|
||||
<%:LockBand Settings%>
|
||||
</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="lockcell_tab"><a href="#">
|
||||
<%:Lock Cell/Arfcn Settings%>
|
||||
</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="self_test_tab"><a href="#">
|
||||
<%:Self Test%>
|
||||
</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="at_command_tab"><a href="#">
|
||||
<%:AT Command%>
|
||||
</a></li>
|
||||
<li class="cbi-tab-disabled" data-tab="set_imei_tab"><a href="#">
|
||||
<%:Set IMEI%>
|
||||
</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="cbi-section-node cbi-section-node-tabbed" id="tab_context">
|
||||
<!-- <div class="cbi-section cbi-tblsection" data-tab-active="true"> -->
|
||||
<div class="cbi-section" data-tab="mode_tab" data-tab-title="<%:Mode%>" data-tab-active="true"
|
||||
style="display: block;">
|
||||
<!-- <legend><%:Mode%></legend> -->
|
||||
<!-- <h3><%:Mode%></h3> -->
|
||||
<table class="table cbi-section-table">
|
||||
<tbody>
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
<th class="th cbi-section-table-cell">
|
||||
<%:Current%>
|
||||
</th>
|
||||
<th class="th cbi-section-table-cell">
|
||||
<%:Config%>
|
||||
</th>
|
||||
<th class="th cbi-section-table-cell cbi-section-actions"></th>
|
||||
</tr>
|
||||
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
|
||||
<td class="td cbi-value-field" data-title="<%:Current%>" id="current_mode"></td>
|
||||
<td class="td cbi-value-field" data-title="<%:Config%>" id="mode_option">
|
||||
<!-- <div>
|
||||
<span class="cbi-radio">
|
||||
<input type="radio" name="mode_option" id="mode_option_qmi" value="qmi" checked="true">
|
||||
<span>QMI</span>
|
||||
</span>
|
||||
<span class="cbi-radio">
|
||||
<input type="radio" name="mode_option" id="mode_option_ecm" value="ecm">
|
||||
<span>ECM</span>
|
||||
</span>
|
||||
<span class="cbi-radio">
|
||||
<input type="radio" name="mode_option" id="mode_option_mbim" value="mbim">
|
||||
<span>MBIM</span>
|
||||
</span>
|
||||
<span class="cbi-radio">
|
||||
<input type="radio" name="mode_option" id="mode_option_rndis" value="rndis">
|
||||
<span>RNDIS</span>
|
||||
</span>
|
||||
<span class="cbi-radio">
|
||||
<input type="radio" name="mode_option" id="mode_option_ncm" value="ncm">
|
||||
<span>NCM</span>
|
||||
</span>
|
||||
</div> -->
|
||||
</td>
|
||||
<td class="td">
|
||||
<div>
|
||||
<input type="button" class="cbi-button-apply" id="mode_button" onclick="set_mode()"
|
||||
alt="<%:Apply%>" value="<%:Apply%>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- <div class="cbi-section cbi-tblsection"> -->
|
||||
<div class="cbi-section" data-tab="network_prefer_tab" data-tab-title="<%:Network Preferences%>"
|
||||
data-tab-active="false" style="display: none;">
|
||||
<!-- <legend><%:Network Preferences%></legend> -->
|
||||
<!-- <h3><%:Network Preferences%></h3> -->
|
||||
<table class="table cbi-section-table">
|
||||
<tbody>
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
<th class="th cbi-section-table-cell">
|
||||
<%:Config%>
|
||||
</th>
|
||||
<th class="th cbi-section-table-cell cbi-section-actions">
|
||||
<%:Apply%>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
|
||||
<td class="td cbi-value-field" data-title="<%:Config%>" id="prefer_custom_config">
|
||||
<div>
|
||||
<span class="cbi-checkbox">
|
||||
<input id="prefer_config_3g" type="checkbox" class="cbi-input-checkbox"
|
||||
value="3g">
|
||||
<span>
|
||||
<%:3G%>
|
||||
</span>
|
||||
</span>
|
||||
<span class="cbi-checkbox">
|
||||
<input id="prefer_config_4g" type="checkbox" class="cbi-input-checkbox"
|
||||
value="4g">
|
||||
<span>
|
||||
<%:4G%>
|
||||
</span>
|
||||
</span>
|
||||
<span class="cbi-checkbox">
|
||||
<input id="prefer_config_5g" type="checkbox" class="cbi-input-checkbox"
|
||||
value="5g">
|
||||
<span>
|
||||
<%:5G%>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="td">
|
||||
<input type="button" class="cbi-button-apply" id="network_prefer_button"
|
||||
onclick="set_network_prefer()" value="<%:Apply%>">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="cbi-section" data-tab="lockband_tab" data-tab-title="<%:LockBand Settings%>"
|
||||
data-tab-active="false" style="display: none;">
|
||||
<!-- <legend><%:Network Preferences%></legend> -->
|
||||
<!-- <h3><%:Network Preferences%></h3> -->
|
||||
<table class="table cbi-section-table">
|
||||
<tbody>
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
<th class="th cbi-section-table-cell">
|
||||
<%:Config%>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="tr cbi-section-table-row">
|
||||
|
||||
<td class="td cbi-value-field" data-title="<%:Config%>" id="lockband_custom_config">
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="button" class="cbi-button-apply" onclick="all_choose_lockband_custom_config()"value="<%:Select All Band%>">
|
||||
<input type="button" class="cbi-button-apply" onclick="set_lockband()" value="<%:Apply%>">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="cbi-section" data-tab="lockcell_tab" data-tab-title="<%:Lock Cell/Arfcn Settings%>"
|
||||
data-tab-active="false" style="display: none;">
|
||||
<h3 id="Lock Cell/Arfcn_title">
|
||||
<%:Current Settings%>
|
||||
</h3>
|
||||
<table class="table" id="CurrentStatus">
|
||||
<tbody id="current_cell_status">
|
||||
</tbody>
|
||||
</table>
|
||||
<h3 id="Lock Cell/Arfcn_title">
|
||||
<%:Available Neighbor%>
|
||||
</h3>
|
||||
<table class="table" id="AvailableNeighbor">
|
||||
<tbody id="neighbor_cell_info">
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- <legend><%:AT Command%></legend> -->
|
||||
<h3 id="Lock Cell/Arfcn_title">
|
||||
<%:Lock Cell/Arfcn Settings%>
|
||||
</h3>
|
||||
<table class="table" id="lockcell_info">
|
||||
<tbody>
|
||||
<tr class="tr">
|
||||
<td class="td left">
|
||||
<%:Select Rat%>
|
||||
</td>
|
||||
<td class="td left">
|
||||
<select name="rat_select" id="rat_select" class="cbi-input-select"
|
||||
onchange="lockcell_rat_onchange()">
|
||||
<option value="0">4G</option>
|
||||
<option value="1">5G</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr">
|
||||
<td class="td left">
|
||||
<%:Enter Arfcn%>
|
||||
</td>
|
||||
<td class="td left">
|
||||
<div>
|
||||
<input type="text" id="arfcn_input" class="cbi-input-text"></input>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr">
|
||||
<td class="td left">
|
||||
<%:Enter PCI%>
|
||||
</td>
|
||||
<td class="td left">
|
||||
<div>
|
||||
<input type="text" id="pci_input" class="cbi-input-text"></input>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr" id="scs_input_tr" style="display:none;">
|
||||
<td class="td left">
|
||||
<%:Enter SCS%>
|
||||
</td>
|
||||
<td class="td left">
|
||||
<select name="rat_select" id="scs_select" class="cbi-input-select">
|
||||
<option value="0">15KHZ</option>
|
||||
<option value="1">30KHZ</option>
|
||||
<option value="2">60KHZ</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr" id="nr_input_tr" style="display:none;">
|
||||
<td class="td left">
|
||||
<%:Enter NRBAND%>
|
||||
</td>
|
||||
<td class="td left">
|
||||
<div>
|
||||
<input type="text" id="nrband_input" class="cbi-input-text"></input>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr">
|
||||
<td class="td left">
|
||||
<%:Submit%>
|
||||
</td>
|
||||
<td class="td left">
|
||||
<div id="lockcell_feature">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<span></span>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<!-- <div class="cbi-section fade-in"> -->
|
||||
<div class="cbi-section" data-tab="self_test_tab" data-tab-title="<%:Self Test%>" data-tab-active="false"
|
||||
style="display: none;">
|
||||
<!-- <legend><%:Self Test%></legend> -->
|
||||
<!-- <h3><%:Self Test%></h3> -->
|
||||
<table class="table cbi-section-table">
|
||||
<tbody>
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
<th class="th cbi-section-table-cell">
|
||||
<%:Item%>
|
||||
</th>
|
||||
<th class="th cbi-section-table-cell">
|
||||
<%:Current%>
|
||||
</th>
|
||||
<th class="th cbi-section-table-cell">
|
||||
<%:Status%>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
|
||||
<td class="td cbi-value-field" data-title="<%:Item%>" id="voltage_label">
|
||||
<%:Voltage%>
|
||||
</td>
|
||||
<td class="td cbi-value-field" data-title="<%:Current%>" id="current_voltage"></td>
|
||||
<td class="td cbi-value-field" data-title="<%:Status%>" id="voltage_status">-</td>
|
||||
</tr>
|
||||
<tr class="tr cbi-section-table-row cbi-rowstyle-2">
|
||||
<td class="td cbi-value-field" data-title="<%:Item%>" id="temperature_label">
|
||||
<%:Temperature%>
|
||||
</td>
|
||||
<td class="td cbi-value-field" data-title="<%:Current%>" id="current_temperature"></td>
|
||||
<td class="td cbi-value-field" data-title="<%:Status%>" id="temperature_status">-</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- <div class="cbi-section fade-in"> -->
|
||||
<div class="cbi-section" data-tab="at_command_tab" data-tab-title="<%:AT Command%>" data-tab-active="false"
|
||||
style="display: none;">
|
||||
<!-- <legend><%:AT Command%></legend> -->
|
||||
<h3 id="at_command_title">
|
||||
<%:AT Command%>
|
||||
</h3>
|
||||
<table class="table" id="at_command_info">
|
||||
<tbody>
|
||||
<!-- <tr class="tr">
|
||||
<td class="td left"><%:Modem Select%></td>
|
||||
<td class="td left"><select name="modem_select" id="modem_select" class="cbi-input-select"></select></td>
|
||||
</tr> -->
|
||||
<tr class="tr">
|
||||
<td class="td left">
|
||||
<%:Quick Option%>
|
||||
</td>
|
||||
<td class="td left" id="quick_option_td">
|
||||
<div>
|
||||
<span class="cbi-radio">
|
||||
<input type="radio" name="quick_option" value="auto" checked="true">
|
||||
<span>
|
||||
<%:Auto%>
|
||||
</span>
|
||||
</span>
|
||||
<span class="cbi-radio">
|
||||
<input type="radio" name="quick_option" value="custom">
|
||||
<span>
|
||||
<%:Custom%>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr">
|
||||
<td class="td left">
|
||||
<%:Quick Commands%>
|
||||
</td>
|
||||
<td class="td left"><select name="command_select" id="command_select"
|
||||
class="cbi-input-select"></select></td>
|
||||
</tr>
|
||||
<tr class="tr">
|
||||
<td class="td left">
|
||||
<%:Enter Command%>
|
||||
</td>
|
||||
<td class="td left">
|
||||
<div>
|
||||
<input type="text" id="at_command" class="cbi-input-text"></input>
|
||||
</div>
|
||||
<div>
|
||||
<input class="cbi-button cbi-button-apply" type="button" value="<%:Send%>"
|
||||
onclick="send_at_command()" alt="<%:Send%>" title="<%:Send%>">
|
||||
<input class="cbi-button cbi-button-reset" type="button" value="<%:Clean%>"
|
||||
onclick="clean_at_command()" alt="<%:Clean%>" title="<%:Clean%>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="tr">
|
||||
<td colspan="2" class="td left">
|
||||
<div id="response_label">
|
||||
<%:Response%>
|
||||
</div><br />
|
||||
<div><textarea readonly="readonly" id="response" rows="20" maxlength="160"></textarea>
|
||||
</div>
|
||||
<div class="cbi-page-actions">
|
||||
<input class="btn cbi-button cbi-button-link" type="button"
|
||||
value="<%:Return to old page%>"
|
||||
onclick="location.href='/cgi-bin/luci/admin/network/modem/at_command_old'"
|
||||
alt="<%:Return to old page%>" title="<%:Return to old page%>">
|
||||
<input class="btn cbi-button cbi-button-link" type="button"
|
||||
value="<%:Custom quick commands%>"
|
||||
onclick="location.href='/cgi-bin/luci/admin/network/modem/quick_commands_config'"
|
||||
alt="<%:Custom quick commands%>" title="<%:Custom quick commands%>">
|
||||
<input class="cbi-button cbi-button-reset" type="button" value="<%:Clean%>"
|
||||
onclick="clean_response()" alt="<%:Clean%>" title="<%:Clean%>">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="cbi-section" data-tab="set_imei_tab" data-tab-title="<%:Set IMEI%>" data-tab-active="false"
|
||||
style="display: none;">
|
||||
<table class="table cbi-section-table">
|
||||
<tbody id="imei_setting">
|
||||
<tr class="tr cbi-section-table-titles anonymous">
|
||||
<th>
|
||||
<%:IMEI%>
|
||||
</th>
|
||||
<th>
|
||||
<%:Set IMEI%>
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="tr">
|
||||
<td class="td" style="width: auto;">
|
||||
<%:IMEI%>
|
||||
</td>
|
||||
<td class="td cbi-value-field">
|
||||
<input type="text" id="imei1_input" class="cbi-input-text"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<input type="button" class="cbi-button-apply" onclick="set_imei()" value="<%:Apply%>">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<%+footer%>
|
63
luci-app-modem/root/etc/init.d/modem_network
Executable file
63
luci-app-modem/root/etc/init.d/modem_network
Executable file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=99
|
||||
STOP=13
|
||||
USE_PROCD=1
|
||||
|
||||
#脚本目录
|
||||
SCRIPT_DIR="/usr/share/modem"
|
||||
|
||||
#运行目录
|
||||
MODEM_RUNDIR="/var/run/modem"
|
||||
MODEM_RUN_CONFIG="${MODEM_RUNDIR}/config.cache"
|
||||
#导入组件工具
|
||||
source "${SCRIPT_DIR}/modem_scan.sh"
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "modem"
|
||||
|
||||
}
|
||||
|
||||
start_service() {
|
||||
mkdir -p $MODEM_RUNDIR
|
||||
local enable_dial=$(uci -q get modem.@global[0].enable_dial)
|
||||
if [ "$enable_dial" = "0" ]; then
|
||||
stop_service
|
||||
else
|
||||
#加载模组配置
|
||||
config_load modem
|
||||
config_foreach dial_modem modem-device
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service()
|
||||
{
|
||||
stop_service
|
||||
start_service
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
#清理运行目录
|
||||
rm -rf $MODEM_RUNDIR
|
||||
config_load modem
|
||||
config_foreach hang_modem modem-device
|
||||
}
|
||||
|
||||
dial_modem()
|
||||
{
|
||||
config_get enable_dial $1 enable_dial
|
||||
if [ "$enable_dial" == "1" ];then
|
||||
procd_open_instance "modem_$1"
|
||||
procd_set_param command "/usr/share/modem/modem_dial.sh" "$1" "dial"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
else
|
||||
hang_modem $1
|
||||
fi
|
||||
}
|
||||
|
||||
hang_modem()
|
||||
{
|
||||
/usr/share/modem/modem_dial.sh $1 hang
|
||||
}
|
21
luci-app-modem/root/etc/init.d/modem_scan
Executable file
21
luci-app-modem/root/etc/init.d/modem_scan
Executable file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=90
|
||||
STOP=13
|
||||
USE_PROCD=1
|
||||
|
||||
#运行目录
|
||||
MODEM_RUNDIR="/var/run/modem"
|
||||
MODEM_RUN_CONFIG="${MODEM_RUNDIR}/config.cache"
|
||||
|
||||
|
||||
|
||||
start_service() {
|
||||
mkdir -p $MODEM_RUNDIR
|
||||
local scan=$(uci -q get modem.@global[0].manual_configuration)
|
||||
echo "scan=$scan"
|
||||
if [ "$scan" = "0" ]; then
|
||||
procd_open_instance "modem_scan_service"
|
||||
procd_set_param command /usr/share/modem/usb_modem_scan.sh
|
||||
procd_close_instance
|
||||
fi
|
||||
}
|
474
luci-app-modem/root/usr/share/modem/modem_dial.sh
Executable file
474
luci-app-modem/root/usr/share/modem/modem_dial.sh
Executable file
@ -0,0 +1,474 @@
|
||||
#!/bin/sh
|
||||
source /lib/functions.sh
|
||||
#运行目录
|
||||
MODEM_RUNDIR="/var/run/modem"
|
||||
#脚本目录
|
||||
SCRIPT_DIR="/usr/share/modem"
|
||||
#导入组件工具
|
||||
source "${SCRIPT_DIR}/modem_debug.sh"
|
||||
get_driver()
|
||||
{
|
||||
for i in $(find $modem_path -name driver);do
|
||||
lsfile=$(ls -l $i)
|
||||
type=${lsfile:0:1}
|
||||
if [ "$type" == "l" ];then
|
||||
link=$(basename $(ls -l $i | awk '{print $11}'))
|
||||
case $link in
|
||||
"qmi_wwan"*)
|
||||
mode="qmi"
|
||||
break
|
||||
;;
|
||||
"cdc_mbim")
|
||||
mode="mbim"
|
||||
break
|
||||
;;
|
||||
"cdc_ncm")
|
||||
mode="ncm"
|
||||
break
|
||||
;;
|
||||
"cdc_ether")
|
||||
mode="ecm"
|
||||
break
|
||||
;;
|
||||
"rndis_host")
|
||||
mode="rndis"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
if [ -z "$mode" ]; then
|
||||
mode="unknown"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
echo $mode
|
||||
}
|
||||
config_load modem
|
||||
modem_config=$1
|
||||
log_path="${MODEM_RUNDIR}/${modem_config}_dial.cache"
|
||||
config_get apn $modem_config apn
|
||||
config_get modem_path $modem_config path
|
||||
config_get modem_dial $modem_config enable_dial
|
||||
config_get dial_tool $modem_config dial_tool
|
||||
config_get pdp_type $modem_config pdp_type
|
||||
config_get network_bridge $modem_config network_bridge
|
||||
config_get apn $modem_config apn
|
||||
config_get username $modem_config username
|
||||
config_get password $modem_config password
|
||||
config_get auth $modem_config auth
|
||||
config_get at_port $modem_config at_port
|
||||
config_get manufacturer $modem_config manufacturer
|
||||
config_get platform $modem_config platform
|
||||
modem_netcard=$(ls $(find $modem_path -name net |tail -1) | awk -F'/' '{print $NF}')
|
||||
interface_name=wwan_5g_$(echo $modem_config | grep -oE "[0-9]+")
|
||||
interface6_name=wwan6_5g_$(echo $modem_config | grep -oE "[0-9]+")
|
||||
ethernet_5g=$(uci -q get modem.global.ethernet)
|
||||
driver=$(get_driver)
|
||||
dial_log "modem_path=$modem_path,driver=$driver,interface=$interface_name,at_port=$at_port" "$log_path"
|
||||
|
||||
check_ip()
|
||||
{
|
||||
case $manufacturer in
|
||||
"quectel")
|
||||
case $platform in
|
||||
"qualcomm")
|
||||
check_ip_command="AT+CGPADDR=1"
|
||||
;;
|
||||
"unisoc")
|
||||
check_ip_command="AT+CGPADDR=1"
|
||||
;;
|
||||
"lte")
|
||||
check_ip_command="AT+CGPADDR=1"
|
||||
;;
|
||||
"lte_mediatek")
|
||||
check_ip_command="AT+CGPADDR=3"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"fibocom")
|
||||
case $platform in
|
||||
"qualcomm")
|
||||
check_ip_command="AT+CGPADDR=1"
|
||||
;;
|
||||
"unisoc")
|
||||
check_ip_command="AT+CGPADDR=1"
|
||||
;;
|
||||
"lte")
|
||||
check_ip_command="AT+CGPADDR=1"
|
||||
;;
|
||||
"mediatek")
|
||||
check_ip_command="AT+CGPADDR=3"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
ipaddr=$(at "$at_port" "$check_ip_command" |grep +CGPADDR:)
|
||||
if [ -n "$ipaddr" ];then
|
||||
ipv6=$(echo $ipaddr | grep -oE "\b([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}\b")
|
||||
ipv4=$(echo $ipaddr | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
|
||||
disallow_ipv4="0.0.0.0"
|
||||
#remove the disallow ip
|
||||
if [ "$ipv4" == *"$disallow_ipv4"* ];then
|
||||
ipv4=""
|
||||
fi
|
||||
connection_status=0
|
||||
if [ -n "$ipv4" ];then
|
||||
connection_status=1
|
||||
fi
|
||||
if [ -n "$ipv6" ];then
|
||||
connection_status=2
|
||||
fi
|
||||
if [ -n "$ipv4" ] && [ -n "$ipv6" ];then
|
||||
connection_status=3
|
||||
fi
|
||||
dial_log "current ip [$ipv6],[$ipv4],connection_status=$connection_status" "$log_path"
|
||||
else
|
||||
connection_status="-1"
|
||||
dial_log "at port response unexpected $ipaddr" "$log_path"
|
||||
fi
|
||||
}
|
||||
|
||||
set_if()
|
||||
{
|
||||
#check if exist
|
||||
interface=$(uci -q get network.$interface_name)
|
||||
if [ -z "$interface" ];then
|
||||
uci set network.${interface_name}=interface
|
||||
uci set network.${interface_name}.proto='dhcp'
|
||||
uci set network.${interface_name}.defaultroute='1'
|
||||
uci set network.${interface_name}.peerdns='0'
|
||||
uci set network.${interface_name}.metric='10'
|
||||
|
||||
|
||||
#添加或修改网络配置
|
||||
uci set network.${interface6_name}='interface'
|
||||
uci set network.${interface6_name}.proto='dhcpv6'
|
||||
uci set network.${interface6_name}.extendprefix='1'
|
||||
uci set network.${interface6_name}.ifname="@${interface_name}"
|
||||
uci set network.${interface6_name}.device="@${interface_name}"
|
||||
uci commit network
|
||||
|
||||
|
||||
local num=$(uci show firewall | grep "name='wan'" | wc -l)
|
||||
local wwan_num=$(uci -q get firewall.@zone[$num].network | grep -w "${interface_name}" | wc -l)
|
||||
if [ "$wwan_num" = "0" ]; then
|
||||
uci add_list firewall.@zone[$num].network="${interface_name}"
|
||||
fi
|
||||
local wwan6_num=$(uci -q get firewall.@zone[$num].network | grep -w "${interface6_name}" | wc -l)
|
||||
if [ "$wwan6_num" = "0" ]; then
|
||||
uci add_list firewall.@zone[$num].network="${interface6_name}"
|
||||
fi
|
||||
uci commit network
|
||||
uci commit firewall
|
||||
dial_log "create interface $interface_name" "$log_path"
|
||||
|
||||
fi
|
||||
|
||||
set_modem_netcard=$modem_netcard
|
||||
if [ -z "$set_modem_netcard" ];then
|
||||
dial_log "no netcard found" "$log_path"
|
||||
fi
|
||||
ethernet_check=$(handle_5gethernet)
|
||||
if [ -n "$ethernet_check" ];then
|
||||
set_modem_netcard=$ethernet_5g
|
||||
fi
|
||||
origin_netcard=$(uci -q get network.$interface_name.ifname)
|
||||
origin_device=$(uci -q get network.$interface_name.device)
|
||||
if [ "$origin_netcard" == "$set_modem_netcard" ] && [ "$origin_device" == "$set_modem_netcard" ];then
|
||||
dial_log "interface $interface_name already set to $set_modem_netcard" "$log_path"
|
||||
else
|
||||
uci set network.${interface_name}.ifname="${set_modem_netcard}"
|
||||
uci set network.${interface_name}.device="${set_modem_netcard}"
|
||||
|
||||
uci commit network
|
||||
/etc/init.d/network restart
|
||||
dial_log "set interface $interface_name to $modem_netcard" "$log_path"
|
||||
fi
|
||||
}
|
||||
|
||||
flush_if()
|
||||
{
|
||||
uci delete network.${interface_name}
|
||||
uci delete network.${interface6_name}
|
||||
uci commit network
|
||||
/etc/init.d/network restart
|
||||
dial_log "delete interface $interface_name" "$log_path"
|
||||
|
||||
}
|
||||
|
||||
dial(){
|
||||
set_if
|
||||
dial_log "dialing $modem_path driver $driver" "$log_path"
|
||||
case $driver in
|
||||
"qmi")
|
||||
qmi_dial
|
||||
;;
|
||||
"mbim")
|
||||
mbim_dial
|
||||
;;
|
||||
"ncm")
|
||||
at_dial_monitor
|
||||
;;
|
||||
"ecm")
|
||||
at_dial_monitor
|
||||
;;
|
||||
"rndis")
|
||||
at_dial_monitor
|
||||
;;
|
||||
*)
|
||||
mbim_dial
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
hang()
|
||||
{
|
||||
if [ "$manufacturer" = "quectel" ]; then
|
||||
at_command="AT+QNETDEVCTL=1,2,1"
|
||||
elif [ "$manufacturer" = "fibocom" ]; then
|
||||
#联发科平台(广和通FM350-GL)
|
||||
if [ "$platform" = "mediatek" ]; then
|
||||
at_command="AT+CGACT=0,3"
|
||||
else
|
||||
at_command="AT+GTRNDIS=0,1"
|
||||
fi
|
||||
elif [ "$manufacturer" = "meig" ]; then
|
||||
at_command="AT$QCRMCALL=0,1,1,2,1"
|
||||
else
|
||||
at_command='ATI'
|
||||
fi
|
||||
|
||||
tmp=$(at "${at_port}" "${at_command}")
|
||||
flush_if
|
||||
}
|
||||
|
||||
mbim_dial(){
|
||||
modem_path=$1
|
||||
modem_dial=$2
|
||||
if [ -z "$apn" ];then
|
||||
apn="auto"
|
||||
fi
|
||||
qmi_dial
|
||||
}
|
||||
|
||||
qmi_dial()
|
||||
{
|
||||
cmd_line="quectel-CM"
|
||||
|
||||
case $pdp_type in
|
||||
"ipv4") cmd_line="$cmd_line -4" ;;
|
||||
"ipv6") cmd_line="$cmd_line -6" ;;
|
||||
"ipv4v6") cmd_line="$cmd_line -4 -6" ;;
|
||||
*) cmd_line="$cmd_line -4 -6" ;;
|
||||
esac
|
||||
|
||||
if [ "$network_bridge" = "1" ]; then
|
||||
cmd_line="$cmd_line -b"
|
||||
fi
|
||||
if [ -n "$apn" ]; then
|
||||
cmd_line="$cmd_line -s $apn"
|
||||
fi
|
||||
if [ -n "$username" ]; then
|
||||
cmd_line="$cmd_line $username"
|
||||
fi
|
||||
if [ -n "$password" ]; then
|
||||
cmd_line="$cmd_line $password"
|
||||
fi
|
||||
if [ "$auth" != "none" ]; then
|
||||
cmd_line="$cmd_line $auth"
|
||||
fi
|
||||
if [ -n "$modem_netcard" ]; then
|
||||
cmd_line="$cmd_line -i $modem_netcard"
|
||||
fi
|
||||
dial_log "dialing $cmd_line" "$log_path"
|
||||
cmd_line="$cmd_line -f $log_path"
|
||||
$cmd_line
|
||||
|
||||
|
||||
}
|
||||
|
||||
at_dial()
|
||||
{
|
||||
if [ -z "$apn" ];then
|
||||
apn="auto"
|
||||
fi
|
||||
if [ -z "$pdp_type" ];then
|
||||
pdp_type="IPV4V6"
|
||||
fi
|
||||
local at_command='AT+COPS=0,0'
|
||||
tmp=$(at "${at_port}" "${at_command}")
|
||||
pdp_type=$(echo $pdp_type | tr 'a-z' 'A-Z')
|
||||
case $manufacturer in
|
||||
"quectel")
|
||||
case $platform in
|
||||
"qualcomm")
|
||||
at_command="AT+QNETDEVCTL=1,3,1"
|
||||
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
|
||||
;;
|
||||
"unisoc")
|
||||
at_command="AT+QNETDEVCTL=1,3,1"
|
||||
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
|
||||
;;
|
||||
"lte")
|
||||
at_command="AT+QNETDEVCTL=1,3,1"
|
||||
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
|
||||
;;
|
||||
*)
|
||||
at_command="AT+QNETDEVCTL=1,3,1"
|
||||
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
"fibocom")
|
||||
case $platform in
|
||||
"qualcomm")
|
||||
at_command="AT+GTRNDIS=1,1"
|
||||
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
|
||||
;;
|
||||
"unisoc")
|
||||
at_command="AT+GTRNDIS=1,1"
|
||||
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
|
||||
;;
|
||||
"lte")
|
||||
at_command="AT+GTRNDIS=1,1"
|
||||
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
|
||||
;;
|
||||
"mediatek")
|
||||
at_command="AT+CGACT=1,3"
|
||||
cgdcont_command="AT+CGDCONT=3,\"$pdp_type\",\"$apn\""
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
esac
|
||||
dial_log "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command" "$log_path"
|
||||
dial_log "dialing vendor:$manufacturer;platform:$platform; $at_command" "$log_path"
|
||||
at "${at_port}" "${cgdcont_command}"
|
||||
at "$at_port" "$at_command"
|
||||
}
|
||||
|
||||
ip_change_fm350()
|
||||
{
|
||||
dial_log "ip_change_fm350" "$log_path"
|
||||
at_command="AT+CGPADDR=3"
|
||||
local ipv4_config=$(at ${at_port} ${at_command} | grep "+CGPADDR: " | awk -F',' '{print $2}' | sed 's/"//g')
|
||||
local public_dns1_ipv4="223.5.5.5"
|
||||
local public_dns2_ipv4="119.29.29.29"
|
||||
local public_dns1_ipv6="2400:3200::1"
|
||||
local public_dns2_ipv6="2402:4e00::"
|
||||
at_command="AT+GTDNS=3" | grep "+GTDNS: "| grep -E '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | sed -n '1p'
|
||||
local ipv4_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $1}')
|
||||
[ -z "$ipv4_dns1" ] && {
|
||||
ipv4_dns1="${public_dns1_ipv4}"
|
||||
}
|
||||
|
||||
local ipv4_dns2=$(echo "${response}" | awk -F'"' '{print $4}' | awk -F',' '{print $1}')
|
||||
[ -z "$ipv4_dns2" ] && {
|
||||
ipv4_dns2="${public_dns2_ipv4}"
|
||||
}
|
||||
|
||||
local ipv6_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $2}')
|
||||
[ -z "$ipv6_dns1" ] && {
|
||||
ipv6_dns1="${public_dns1_ipv6}"
|
||||
}
|
||||
|
||||
local ipv6_dns2=$(echo "${response}" | awk -F'"' '{print $4}' | awk -F',' '{print $2}')
|
||||
[ -z "$ipv6_dns2" ] && {
|
||||
ipv6_dns2="${public_dns2_ipv6}"
|
||||
}
|
||||
uci_ipv4=$(uci -q get network.$interface_name.ipaddr)
|
||||
|
||||
uci set network.${interface_name}.proto='static'
|
||||
uci set network.${interface_name}.ipaddr="${ipv4_config}"
|
||||
uci set network.${interface_name}.netmask='255.255.255.0'
|
||||
uci set network.${interface_name}.gateway="${ipv4_config%.*}.1"
|
||||
uci set network.${interface_name}.peerdns='0'
|
||||
uci -q del network.${interface_name}.dns
|
||||
uci add_list network.${interface_name}.dns="${ipv4_dns1}"
|
||||
uci add_list network.${interface_name}.dns="${ipv4_dns2}"
|
||||
uci commit network
|
||||
/etc/init.d/network restart
|
||||
dial_log "set interface $interface_name to $ipv4_config" "$log_path"
|
||||
|
||||
}
|
||||
|
||||
handle_5gethernet()
|
||||
{
|
||||
case "$driver" in
|
||||
"ncm"|\
|
||||
"ecm"|\
|
||||
"rndis")
|
||||
case "$manufacturer" in
|
||||
"quectel")
|
||||
case "$platform" in
|
||||
"unisoc")
|
||||
check_ethernet_cmd="AT+QCFG=\"ethernet\""
|
||||
time=0
|
||||
while [ $time -lt 5 ]; do
|
||||
result=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $check_ethernet_cmd | grep "+QCFG:")
|
||||
if [ -n "$result" ]; then
|
||||
if [ -n "$(echo $result | grep "ethernet\",1")" ]; then
|
||||
echo "1"
|
||||
dial_log "5G Ethernet mode is enabled" "$log_path"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
sleep 5
|
||||
time=$((time+1))
|
||||
done
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
handle_ip_change()
|
||||
{
|
||||
export ipv4
|
||||
export ipv6
|
||||
export connection_status
|
||||
dial_log "ip changed from $ipv6_cache,$ipv4_cache to $ipv6,$ipv4" "$log_path"
|
||||
case $manufacturer in
|
||||
"fibocom")
|
||||
case $platform in
|
||||
"mediatek")
|
||||
ip_change_fm350
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
at_dial_monitor()
|
||||
{
|
||||
check_ip
|
||||
at_dial
|
||||
ipv4_cache=$ipv4
|
||||
while true; do
|
||||
check_ip
|
||||
if [ $connection_status -eq 0 ];then
|
||||
at_dial
|
||||
else
|
||||
#检测ipv4是否变化
|
||||
if [ "$ipv4" != "$ipv4_cache" ];then
|
||||
handle_ip_change
|
||||
ipv6_cache=$ipv6
|
||||
ipv4_cache=$ipv4
|
||||
fi
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
case $2 in
|
||||
"hang")
|
||||
hang;;
|
||||
"dial")
|
||||
dial;;
|
||||
esac
|
@ -431,6 +431,8 @@ retry_set_modem_config()
|
||||
uci set modem.modem${modem_no}.manufacturer="${manufacturer}"
|
||||
uci set modem.modem${modem_no}.platform="${platform}"
|
||||
uci set modem.modem${modem_no}.define_connect="${define_connect}"
|
||||
uci set modem.modem${modem_no}.enable_dial=1
|
||||
uci set modem.modem${modem_no}.pdp_type="ipv4v6"
|
||||
uci -q del modem.modem${modem_no}.modes #删除原来的拨号模式列表
|
||||
for mode in $modes; do
|
||||
uci add_list modem.modem${modem_no}.modes="${mode}"
|
||||
@ -438,7 +440,6 @@ retry_set_modem_config()
|
||||
|
||||
#设置模组预设
|
||||
m_modem_presets "${at_port}" "${define_connect}"
|
||||
|
||||
#打印日志
|
||||
m_log "info" "Successfully retrying to configure the Modem ${modem_name}"
|
||||
|
||||
@ -529,11 +530,12 @@ m_set_modem_config()
|
||||
uci set modem.modem${modem_no}.manufacturer="${manufacturer}"
|
||||
uci set modem.modem${modem_no}.define_connect="${define_connect}"
|
||||
uci set modem.modem${modem_no}.platform="${platform}"
|
||||
uci set modem.modem${modem_no}.enable_dial=1
|
||||
uci set modem.modem${modem_no}.pdp_type="ipv4v6"
|
||||
uci -q del modem.modem${modem_no}.modes #删除原来的拨号模式列表
|
||||
for mode in $modes; do
|
||||
uci add_list modem.modem${modem_no}.modes="${mode}"
|
||||
done
|
||||
|
||||
#设置模组预设
|
||||
m_modem_presets "${at_port}" "${define_connect}"
|
||||
|
||||
@ -716,22 +718,7 @@ m_set_network_config()
|
||||
# $1:网络设备
|
||||
enable_dial()
|
||||
{
|
||||
local network="$1"
|
||||
|
||||
local i=0
|
||||
while true; do
|
||||
#查看该网络设备的配置是否启用
|
||||
local modem_network=$(uci -q get modem.@dial-config[${i}].network)
|
||||
[ -z "$modem_network" ] && break
|
||||
if [ "$network" = "$modem_network" ]; then
|
||||
local enable=$(uci -q get modem.@dial-config[${i}].enable)
|
||||
if [ "$enable" = "1" ]; then
|
||||
service modem reload
|
||||
break
|
||||
fi
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
/etc/init.d/modem_network restart
|
||||
}
|
||||
|
||||
#禁用拨号
|
||||
|
3
luci-app-modem/root/usr/share/modem/usb_modem_scan.sh
Normal file
3
luci-app-modem/root/usr/share/modem/usb_modem_scan.sh
Normal file
@ -0,0 +1,3 @@
|
||||
sleep 10
|
||||
source /usr/share/modem/modem_scan.sh
|
||||
modem_scan
|
Loading…
x
Reference in New Issue
Block a user