qmodem: add pcie support
This commit is contained in:
parent
424ef4677f
commit
d7d36b2678
@ -1,4 +1,5 @@
|
|||||||
-- Copyright 2024 Siriling <siriling@qq.com>
|
-- Copyright 2024 Siriling <siriling@qq.com>
|
||||||
|
-- Copyright 2024 FJR <fjrcn@outlook.com>
|
||||||
module("luci.controller.qmodem", package.seeall)
|
module("luci.controller.qmodem", package.seeall)
|
||||||
local http = require "luci.http"
|
local http = require "luci.http"
|
||||||
local fs = require "nixio.fs"
|
local fs = require "nixio.fs"
|
||||||
@ -23,9 +24,12 @@ function index()
|
|||||||
entry({"admin", "network", "qmodem", "dial_config"}, cbi("qmodem/dial_config")).leaf = true
|
entry({"admin", "network", "qmodem", "dial_config"}, cbi("qmodem/dial_config")).leaf = true
|
||||||
entry({"admin", "network", "qmodem", "modems_dial_overview"}, call("getOverviews"), nil).leaf = true
|
entry({"admin", "network", "qmodem", "modems_dial_overview"}, call("getOverviews"), nil).leaf = true
|
||||||
--模块调试
|
--模块调试
|
||||||
entry({"admin", "network", "qmodem", "modem_debug"},template("qmodem/modem_debug"),luci.i18n.translate("QModem Debug"),4).leaf = true
|
entry({"admin", "network", "qmodem", "modem_debug"},template("qmodem/modem_debug"),luci.i18n.translate("Advance Modem Settings"),4).leaf = true
|
||||||
entry({"admin", "network", "qmodem", "send_at_command"}, call("sendATCommand"), nil).leaf = true
|
entry({"admin", "network", "qmodem", "send_at_command"}, call("sendATCommand"), nil).leaf = true
|
||||||
entry({"admin", "network", "qmodem", "modem_scan"}, call("modemScan"), nil).leaf = true
|
|
||||||
|
--Qmodem设置
|
||||||
|
entry({"admin", "network", "qmodem", "settings"}, cbi("qmodem/settings"), luci.i18n.translate("QModem Settings"),100).leaf = true
|
||||||
|
entry({"admin", "network", "qmodem", "slot_config"}, cbi("qmodem/slot_config")).leaf = true
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
@ -214,15 +218,3 @@ function sendATCommand()
|
|||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(response)
|
luci.http.write_json(response)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
|
||||||
@Description 模组扫描
|
|
||||||
]]
|
|
||||||
function modemScan()
|
|
||||||
|
|
||||||
local command=script_path.."modem_scan.sh scan"
|
|
||||||
local result=shell(command)
|
|
||||||
-- 写入Web界面
|
|
||||||
luci.http.prepare_content("application/json")
|
|
||||||
luci.http.write_json(result)
|
|
||||||
end
|
|
||||||
|
@ -2,7 +2,7 @@ local dispatcher = require "luci.dispatcher"
|
|||||||
local uci = require "luci.model.uci".cursor()
|
local uci = require "luci.model.uci".cursor()
|
||||||
local http = require "luci.http"
|
local http = require "luci.http"
|
||||||
|
|
||||||
m = Map("qmodem", translate("Dial Config"))
|
m = Map("qmodem", translate("Modem Configuration"))
|
||||||
m.redirect = dispatcher.build_url("admin", "network", "qmodem","dial_overview")
|
m.redirect = dispatcher.build_url("admin", "network", "qmodem","dial_overview")
|
||||||
|
|
||||||
s = m:section(NamedSection, arg[1], "modem-device", "")
|
s = m:section(NamedSection, arg[1], "modem-device", "")
|
||||||
@ -14,25 +14,44 @@ s:tab("advanced", translate("Advanced Settings"))
|
|||||||
--------general--------
|
--------general--------
|
||||||
|
|
||||||
-- 是否启用
|
-- 是否启用
|
||||||
enable = s:taboption("general", Flag, "enable_dial", translate("enable_dial"))
|
enable = s:taboption("general", Flag, "enable_dial", translate("Enable Dial"))
|
||||||
enable.default = "0"
|
enable.default = "0"
|
||||||
enable.rmempty = false
|
enable.rmempty = false
|
||||||
|
|
||||||
-- 别名
|
-- 别名
|
||||||
alias = s:taboption("general", Value, "alias", translate("Alias"))
|
alias = s:taboption("general", Value, "alias", translate("Modem Alias"))
|
||||||
alias.rmempty = true
|
alias.rmempty = true
|
||||||
|
|
||||||
-- AT串口
|
-- AT串口
|
||||||
at_port = s:taboption("general",Value, "at_port", translate("AT Port"))
|
at_port = s:taboption("general",Value, "at_port", translate("AT Port"))
|
||||||
|
sms_at_port = s:taboption("general",Value, "sms_at_port", translate("SMS AT Port"))
|
||||||
|
sms_at_port.rmempty = true
|
||||||
|
valid_at_ports = uci:get("qmodem",arg[1],"valid_at_ports")
|
||||||
|
avalible_ports = uci:get("qmodem",arg[1],"ports")
|
||||||
|
for i1,v1 in ipairs(avalible_ports) do
|
||||||
|
for i2,v2 in ipairs(valid_at_ports) do
|
||||||
|
if v1 == v2 then
|
||||||
|
valid=true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not valid then
|
||||||
|
msg = v1 .. translate("(Not PASS)")
|
||||||
|
else
|
||||||
|
msg = v1 .. translate("(PASSED)")
|
||||||
|
end
|
||||||
|
at_port:value(v1,msg)
|
||||||
|
sms_at_port:value(v1,msg)
|
||||||
|
end
|
||||||
|
|
||||||
at_port.placeholder = translate("Not null")
|
at_port.placeholder = translate("Not null")
|
||||||
at_port.rmempty = false
|
at_port.rmempty = false
|
||||||
|
|
||||||
ra_master = s:taboption("advanced", Flag, "ra_master", translate("RA Master"))
|
ra_master = s:taboption("advanced", Flag, "ra_master", translate("RA Master"))
|
||||||
ra_master.description = translate("After checking, This interface will enable IPV6 RA Master.Only one interface can be set to RA Master.")
|
ra_master.description = translate("Once checking, This interface will enable IPV6 RA Master.Only one interface can be set to RA Master.")
|
||||||
ra_master.default = "0"
|
ra_master.default = "0"
|
||||||
|
|
||||||
extend_prefix = s:taboption("advanced", Flag, "extend_prefix", translate("Extend Prefix"))
|
extend_prefix = s:taboption("advanced", Flag, "extend_prefix", translate("Extend Prefix"))
|
||||||
extend_prefix.description = translate("After checking, the prefix will be apply to lan zone")
|
extend_prefix.description = translate("Once checking, the prefix will be apply to lan zone")
|
||||||
extend_prefix.default = "0"
|
extend_prefix.default = "0"
|
||||||
|
|
||||||
-- 网络类型
|
-- 网络类型
|
||||||
@ -119,11 +138,5 @@ metric = s:taboption("advanced", Value, "metric", translate("Metric"))
|
|||||||
metric.description = translate("The metric value is used to determine the priority of the route. The smaller the value, the higher the priority. Cannot duplicate.")
|
metric.description = translate("The metric value is used to determine the priority of the route. The smaller the value, the higher the priority. Cannot duplicate.")
|
||||||
metric.default = "10"
|
metric.default = "10"
|
||||||
|
|
||||||
-- 配置ID
|
|
||||||
id = s:taboption("advanced", ListValue, "id", translate("Config ID"))
|
|
||||||
id.rmempty = false
|
|
||||||
id:value(arg[1])
|
|
||||||
-- uci:set('modem',arg[1],'id',arg[1])
|
|
||||||
|
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
@ -1,35 +1,22 @@
|
|||||||
local d = require "luci.dispatcher"
|
local d = require "luci.dispatcher"
|
||||||
local uci = luci.model.uci.cursor()
|
|
||||||
local sys = require "luci.sys"
|
local sys = require "luci.sys"
|
||||||
|
|
||||||
m = Map("qmodem")
|
m = Map("qmodem")
|
||||||
m.title = translate("Dial Overview")
|
m.title = translate("Dial Overview")
|
||||||
m.description = translate("Check and add modem dialing configurations")
|
|
||||||
|
|
||||||
--全局配置
|
--全局配置
|
||||||
s = m:section(NamedSection, "global", "global", translate("Global Config"))
|
s = m:section(NamedSection, "main", "main", translate("Global Config"))
|
||||||
s.anonymous = true
|
s.anonymous = true
|
||||||
s.addremove = false
|
s.addremove = false
|
||||||
|
|
||||||
-- 模组扫描
|
o = s:option(Flag, "enable_dial", translate("Enable Dial")..translate("(Global)"))
|
||||||
o = s:option(Button, "modem_scan", translate("Modem Scan"))
|
|
||||||
o.template = "qmodem/modem_scan"
|
|
||||||
|
|
||||||
-- 启用手动配置
|
|
||||||
o = s:option(Flag, "manual_configuration", translate("Manual Configuration"))
|
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
o.description = translate("Enable the manual configuration of modem information").." " translate("(After enable, the automatic scanning and configuration function for modem information will be disabled)")
|
|
||||||
|
|
||||||
|
|
||||||
o = s:option(Flag, "enable_dial", translate("Enable Dial"))
|
o = s:option(Button, "reload_dial", translate("Restart Dial Service"))
|
||||||
o.rmempty = false
|
|
||||||
o.description = translate("Enable dial configurations")
|
|
||||||
|
|
||||||
o = s:option(Button, "reload_dial", translate("Reload Dial Configurations"))
|
|
||||||
o.inputstyle = "apply"
|
o.inputstyle = "apply"
|
||||||
o.description = translate("Manually Reload dial configurations When the dial configuration fails to take effect")
|
|
||||||
o.write = function()
|
o.write = function()
|
||||||
sys.call("/etc/init.d/qmodem_network reload")
|
sys.call("/etc/init.d/qmodem_network reload > /dev/null 2>&1")
|
||||||
luci.http.redirect(d.build_url("admin", "network", "qmodem", "dial_overview"))
|
luci.http.redirect(d.build_url("admin", "network", "qmodem", "dial_overview"))
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -38,17 +25,17 @@ s.addremove = ture
|
|||||||
s.template = "cbi/tblsection"
|
s.template = "cbi/tblsection"
|
||||||
s.extedit = d.build_url("admin", "network", "qmodem", "dial_config", "%s")
|
s.extedit = d.build_url("admin", "network", "qmodem", "dial_config", "%s")
|
||||||
|
|
||||||
o = s:option(Flag, "enable_dial", translate("enable_dial"))
|
o = s:option(Flag, "enable_dial", translate("Enable Dial"))
|
||||||
o.width = "5%"
|
o.width = "5%"
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
|
|
||||||
o = s:option(DummyValue, "name", translate("Modem Name"))
|
o = s:option(DummyValue, "name", translate("Modem Model"))
|
||||||
o.cfgvalue = function(t, n)
|
o.cfgvalue = function(t, n)
|
||||||
local name = (Value.cfgvalue(t, n) or "")
|
local name = (Value.cfgvalue(t, n) or "")
|
||||||
return name:upper()
|
return name:upper()
|
||||||
end
|
end
|
||||||
|
|
||||||
o = s:option(DummyValue, "alias", translate("Alias"))
|
o = s:option(DummyValue, "alias", translate("Modem Alias"))
|
||||||
o.cfgvalue = function(t, n)
|
o.cfgvalue = function(t, n)
|
||||||
local alias = (Value.cfgvalue(t, n) or "-")
|
local alias = (Value.cfgvalue(t, n) or "-")
|
||||||
return alias
|
return alias
|
||||||
@ -62,9 +49,6 @@ o.cfgvalue = function(t, n)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
o = s:option(DummyValue, "pdp_type", translate("PDP Type"))
|
o = s:option(DummyValue, "pdp_type", translate("PDP Type"))
|
||||||
o.cfgvalue = function(t, n)
|
o.cfgvalue = function(t, n)
|
||||||
local pdp_type = (Value.cfgvalue(t, n) or "")
|
local pdp_type = (Value.cfgvalue(t, n) or "")
|
||||||
@ -86,7 +70,7 @@ o.cfgvalue = function(t, n)
|
|||||||
return apn
|
return apn
|
||||||
end
|
end
|
||||||
|
|
||||||
remove_btn = s:option(Button, "_remove", translate("Remove"))
|
remove_btn = s:option(Button, "_remove", translate("Remove Modem"))
|
||||||
remove_btn.inputstyle = "remove"
|
remove_btn.inputstyle = "remove"
|
||||||
function remove_btn.write(self, section)
|
function remove_btn.write(self, section)
|
||||||
local shell
|
local shell
|
||||||
|
62
luci/luci-app-qmodem/luasrc/model/cbi/qmodem/settings.lua
Normal file
62
luci/luci-app-qmodem/luasrc/model/cbi/qmodem/settings.lua
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
local sys = require "luci.sys"
|
||||||
|
local d = require "luci.dispatcher"
|
||||||
|
m = Map("qmodem")
|
||||||
|
m.title = translate("QModem Setting")
|
||||||
|
|
||||||
|
this_page = d.build_url("admin", "network", "qmodem", "settings")
|
||||||
|
s = m:section(NamedSection, "main", "main", translate("Modem Probe setting"))
|
||||||
|
manual_configuration = s:option(Flag, "manual_configuration", translate("Block Auto Probe/Remove"))
|
||||||
|
manual_configuration.description = translate("If enabled, the modem auto scan will be blocked.")
|
||||||
|
|
||||||
|
enable_pcie_scan = s:option(Flag, "enable_pcie_scan", translate("Enable PCIE Scan"))
|
||||||
|
enable_pcie_scan.description = translate("Once enabled, the PCIe ports will be scanned on every boot.")
|
||||||
|
|
||||||
|
enable_usb_scan = s:option(Flag, "enable_usb_scan",translate("Enable USB Scan"))
|
||||||
|
enable_usb_scan.description = translate("Once enabled, the USB ports will be scanned on every boot.")
|
||||||
|
|
||||||
|
try_vendor_preset_usb = s:option(Flag,"try_preset_usb",translate("Try Preset USB Port"))
|
||||||
|
try_vendor_preset_usb.description = translate("Attempt to use pre-configured USB settings from the cpe vendor.")
|
||||||
|
|
||||||
|
try_vendor_preset_pcie = s:option(Flag,"try_preset_pcie",translate("Try Preset PCIE Port"))
|
||||||
|
try_vendor_preset_pcie.description = translate("Attempt to use pre-configured PCIE settings from the cpe vendor.")
|
||||||
|
|
||||||
|
o = s:option(Button, "scan_pcie", translate("Scan PCIE Manually"))
|
||||||
|
o.inputstyle = "apply"
|
||||||
|
o.write = function()
|
||||||
|
sys.call("/usr/share/qmodem/modem_scan.sh scan 0 pcie > /dev/null 2>&1")
|
||||||
|
luci.http.redirect(this_page)
|
||||||
|
end
|
||||||
|
|
||||||
|
o = s:option(Button, "scan_usb", translate("Scan USB Manually"))
|
||||||
|
o.inputstyle = "apply"
|
||||||
|
o.write = function()
|
||||||
|
sys.call("/usr/share/qmodem/modem_scan.sh scan 0 usb > /dev/null 2>&1")
|
||||||
|
luci.http.redirect(this_page)
|
||||||
|
end
|
||||||
|
|
||||||
|
o = s:option(Button, "scan_all", translate("Scan ALL Manually"))
|
||||||
|
o.inputstyle = "apply"
|
||||||
|
o.write = function()
|
||||||
|
sys.call("/usr/share/qmodem/modem_scan.sh scan > /dev/null 2>&1")
|
||||||
|
luci.http.redirect(this_page)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "modem-slot", translate("Modem Slot Config List"))
|
||||||
|
s.addremove = true
|
||||||
|
s.template = "cbi/tblsection"
|
||||||
|
s.extedit = d.build_url("admin", "network", "qmodem", "slot_config", "%s")
|
||||||
|
s.sectionhead = translate("Config Name")
|
||||||
|
slot_type = s:option(DummyValue, "type", translate("Slot Type"))
|
||||||
|
slot_type.cfgvalue = function(t, n)
|
||||||
|
local name = translate(Value.cfgvalue(t, n) or "")
|
||||||
|
return name:upper()
|
||||||
|
end
|
||||||
|
|
||||||
|
slot_path = s:option(DummyValue, "slot", translate("Slot Path"))
|
||||||
|
slot_path.cfgvalue = function(t, n)
|
||||||
|
local path = (Value.cfgvalue(t, n) or "")
|
||||||
|
return path
|
||||||
|
end
|
||||||
|
|
||||||
|
return m
|
55
luci/luci-app-qmodem/luasrc/model/cbi/qmodem/slot_config.lua
Normal file
55
luci/luci-app-qmodem/luasrc/model/cbi/qmodem/slot_config.lua
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
m = Map("qmodem", translate("Slot Configuration"))
|
||||||
|
m.redirect = luci.dispatcher.build_url("admin", "network", "qmodem","settings")
|
||||||
|
|
||||||
|
s = m:section(NamedSection, arg[1], "modem-device", "")
|
||||||
|
|
||||||
|
slot_type = s:option(ListValue, "type", translate("Slot Type"))
|
||||||
|
slot_type:value("usb", translate("USB"))
|
||||||
|
slot_type:value("pcie", translate("PCIE"))
|
||||||
|
|
||||||
|
slot = s:option(Value, "slot", translate("Slot ID"))
|
||||||
|
|
||||||
|
|
||||||
|
local pcie_slots = io.popen("ls /sys/bus/pci/devices/")
|
||||||
|
for line in pcie_slots:lines() do
|
||||||
|
slot:value(line,line.."[pcie]")
|
||||||
|
end
|
||||||
|
pcie_slots:close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sim_led = s:option(Value, "sim_led", translate("SIM LED"))
|
||||||
|
sim_led.rmempty = true
|
||||||
|
|
||||||
|
|
||||||
|
net_led = s:option(Value, "net_led", translate("NET LED"))
|
||||||
|
net_led.rmempty = true
|
||||||
|
local leds = io.popen("ls /sys/class/leds/")
|
||||||
|
for line in leds:lines() do
|
||||||
|
net_led:value(line,line)
|
||||||
|
sim_led:value(line,line)
|
||||||
|
end
|
||||||
|
|
||||||
|
ethernet_5g = s:option(Value, "ethernet_5g", translate("Enable 5G Ethernet"))
|
||||||
|
ethernet_5g.rmempty = true
|
||||||
|
ethernet_5g.description = translate("For 5G modules using the Ethernet PHY connection, please specify the network interface name. (e.g., eth0, eth1)")
|
||||||
|
local net = io.popen("ls /sys/class/net/")
|
||||||
|
for line in net:lines() do
|
||||||
|
ethernet_5g:value(line,line)
|
||||||
|
end
|
||||||
|
net:close()
|
||||||
|
|
||||||
|
associated_usb = s:option(Value, "associated_usb", translate("Associated USB"))
|
||||||
|
associated_usb.rmempty = true
|
||||||
|
associated_usb.description = translate("For M.2 slots with both PCIe and USB support, specify the associated USB port (for ttyUSB access)")
|
||||||
|
associated_usb:depends("type", "pcie")
|
||||||
|
local usb_slots = io.popen("ls /sys/bus/usb/devices/")
|
||||||
|
for line in usb_slots:lines() do
|
||||||
|
if not line:match("usb%d+") then
|
||||||
|
slot:value(line,line.."[usb]")
|
||||||
|
associated_usb:value(line,line)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
usb_slots:close()
|
||||||
|
return m
|
@ -78,7 +78,7 @@
|
|||||||
this.connect_state = 0;
|
this.connect_state = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
entry.value = '<%:unknown%>';
|
entry.value = '<%:Unknown%>';
|
||||||
this.connect_state = -1;
|
this.connect_state = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,38 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.cbi-progressbar {
|
||||||
|
border: 1px solid var(--border-color-high,var(--progressbarColor));
|
||||||
|
border-radius: 3px;
|
||||||
|
position: relative;
|
||||||
|
min-width: 170px;
|
||||||
|
height: 8px;
|
||||||
|
margin: 1.4em 0 4px 0;
|
||||||
|
background: var(--background-color-medium,var(--progressbarColor));
|
||||||
|
}
|
||||||
|
|
||||||
|
.cbi-progressbar > div {
|
||||||
|
background: var(--primary-color-medium,var(--progressbar));
|
||||||
|
height: 100%;
|
||||||
|
transition: width .25s ease-in;
|
||||||
|
width: 0%;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cbi-progressbar::before {
|
||||||
|
position: absolute;
|
||||||
|
top: -1.4em;
|
||||||
|
left: 0;
|
||||||
|
content: attr(title);
|
||||||
|
white-space: pre;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
class LuciTable{
|
class LuciTable{
|
||||||
@ -23,7 +54,7 @@ class LuciTable{
|
|||||||
fieldset.className="cbi-section";
|
fieldset.className="cbi-section";
|
||||||
//set fieldset Header name
|
//set fieldset Header name
|
||||||
var legend = document.createElement('legend');
|
var legend = document.createElement('legend');
|
||||||
var title_span = document.createElement('span');
|
var title_span = document.createElement('h2');
|
||||||
title_span.className="panel-title"
|
title_span.className="panel-title"
|
||||||
//init table
|
//init table
|
||||||
var table = document.createElement('table');
|
var table = document.createElement('table');
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
<%+cbi/valueheader%>
|
|
||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
|
|
||||||
// 禁用功能
|
|
||||||
function disabled_function(function_name,status)
|
|
||||||
{
|
|
||||||
//模组扫描
|
|
||||||
if (function_name=="modem_scan")
|
|
||||||
{
|
|
||||||
//模组扫描按钮
|
|
||||||
document.getElementById('modem_scan_button').disabled=status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 模组扫描
|
|
||||||
function modem_scan()
|
|
||||||
{
|
|
||||||
//禁用功能
|
|
||||||
disabled_function("modem_scan",true);
|
|
||||||
|
|
||||||
//修改描述信息
|
|
||||||
var description='<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>"/><%:Scaning modem...%>'
|
|
||||||
document.getElementById('modem_scan_description').innerHTML=description;
|
|
||||||
|
|
||||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "qmodem", "modem_scan")%>', null,
|
|
||||||
function(x, data)
|
|
||||||
{
|
|
||||||
// console.log(data);
|
|
||||||
location.href='/cgi-bin/luci/admin/network/qmodem/dial_overview'
|
|
||||||
|
|
||||||
//启用功能
|
|
||||||
// disabled_function("modem_scan",false);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
/* 加载中样式 */
|
|
||||||
#modem_scan_description img {
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<input class="btn cbi-button cbi-button-apply" type="button" id="modem_scan_button" value="<%:Scan%>" onclick="modem_scan()" alt="<%:Scan%>" title="<%:Scan%>"/>
|
|
||||||
<div class="cbi-value-description" id="modem_scan_description">
|
|
||||||
<%:The automatic configuration modem is triggered only at modem startup, otherwise, manual scanning is necessary%>
|
|
||||||
</div>
|
|
||||||
<%+cbi/valuefooter%>
|
|
449
luci/luci-app-qmodem/po/template/qmodem.po
Normal file
449
luci/luci-app-qmodem/po/template/qmodem.po
Normal file
@ -0,0 +1,449 @@
|
|||||||
|
#controller/qmodem.lua
|
||||||
|
msgid "QModem"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "QModem Information"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Dial Overview"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Advance Modem Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "QModem Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# model/cbi/dial_config.lua
|
||||||
|
msgid "Modem Configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "General Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Advanced Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Enable Dial"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Alias"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "AT Port"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "SMS AT Port"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "RA Master"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "After checking, This interface will enable IPV6 RA Master.Only one interface can be set to RA Master."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Extend Prefix"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Once checking, the prefix will be apply to lan zone"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "PDP Type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Auto Choose"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "China Mobile"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "China Unicom"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msigd "China Telecom"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "China Broadcast"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Skytone"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Authentication Type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "None"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "PAP"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "CHAP"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "PAP/CHAP (both)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "PAP/CHAP Username"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "PAP/CHAP Password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "PIN Code"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "If the PIN code is not set, leave it blank."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "If solt 2 config is not set,will use slot 1 config."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "The metric value is used to determine the priority of the route. The smaller the value, the higher the priority. Cannot duplicate."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#odel/cbi/dial_overview.lua
|
||||||
|
msgid "Dial Overview"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Global Config"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Enable Dial"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "(Global)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Restart Dial Service"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Config List"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Model"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Alias"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Status"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Remove Modem"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# model/cbi/settings.lua
|
||||||
|
msgid "QModem Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Probe setting"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Block Auto Probe/Remove"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "If enabled, the modem auto scan will be blocked."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Enable PCIE Scan"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Once enabled, the PCIe ports will be scanned on every boot."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Enable USB Scan"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Once enabled, the USB ports will be scanned on every boot."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Try Preset USB Port"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Attempt to use pre-configured USB settings from the cpe vendor."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Try Preset PCIE Port"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Attempt to use pre-configured PCIE settings from the cpe vendor."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Scan ALL Manually"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Scan PCIE manually."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Scan USB Manually"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Slot Config List"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Slot Type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Slot Path"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Config Name"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# model/cbi/slot_config.lua
|
||||||
|
msgid "Slot Configuration"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Slot Type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Slot ID"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "SIM LED"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "NET LED"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Enable 5G Ethernet"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "If a 5G module is connected to the Ethernet PHY, please specify the associated interface name here."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Associated USB"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "If a USB modem is connected to the USB port, please specify the associated USB port here.(for tty port)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# view/qmodem/dial_overview.htm
|
||||||
|
msgid "Connected"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Disconnected"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Unknown"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Download"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Clear"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Status"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Log"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# view/qmodem/modem_debug.htm
|
||||||
|
msgid "Lock Band"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Select All"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Submit"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Rat Prefer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Current Mode%"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Dial Mode"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Neighbor Cell"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Lock Cell Setting"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "RAT"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "PCI"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "ARFCN"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "TAC"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Band"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "SCS"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Status"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Copy"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Set IMEI"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Modem Name"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Warning!"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# root/usr/share/qmodem/fibocom.sh
|
||||||
|
msgid "Voltage"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Temperature"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Manufacturer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "SIM Status"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Internet Service Provider"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "SIM Slot"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "SIM Number"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "International Mobile Equipment Identity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "International Mobile Subscriber Identity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Integrate Circuit Card Identity"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Network Type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Channel Quality Indicator for Uplink"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Channel Quality Indicator for Downlink"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Access Maximum Bit Rate for Uplink"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Access Maximum Bit Rate for Downlink"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Transmit Rate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Receive Rate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Network Mode"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Mobile Country Code"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Mobile Network Code"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Duplex Mode"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Physical Cell ID"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Tracking area code of cell servedby neighbor Enb"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Absolute Radio-Frequency Channel Number"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Band"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "DL Bandwidth"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Reference Signal Received Power"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Reference Signal Received Quality"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Signal to Interference plus Noise Ratio Bandwidth"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Received Signal Level"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "SCS"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Serving Cell Receive Level"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "E-UTRA Absolute Radio Frequency Channel Number"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Freq band indicator"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "UL Bandwidth"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "DL Bandwidth"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Received Signal Strength Indicator"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Radio Signal Strength Noise Ratio"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Channel Quality Indicator"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "TX Power"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "ocation Area Code"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Speech Code"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Ec/No"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Ec/Io"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Spreading Factor"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Compression Mode"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "RxLev"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
# root/usr/share/qmodem/generic.sh
|
||||||
|
msgid " "SIM Error,Error code:" "warning""
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Connect Status"
|
||||||
|
msgstr ""
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,15 @@
|
|||||||
config global 'global'
|
config main 'main'
|
||||||
option enable_dial '1'
|
option enable_dial '1'
|
||||||
option modem_number '0'
|
option modem_number '0'
|
||||||
option manual_configuration '0'
|
option manual_configuration '0'
|
||||||
|
option enable_pcie_scan "1"
|
||||||
|
option enable_usb_scan "0"
|
||||||
|
option try_preset_usb "1"
|
||||||
|
option try_preset_pcie "1"
|
||||||
|
|
||||||
|
config modem-slot 'm2_0'
|
||||||
|
option type 'pcie'
|
||||||
|
option slot '0001:11:00.0'
|
||||||
|
option net_led 'B:LED3'
|
||||||
|
option associated_usb '8-1'
|
||||||
|
option sim_led 'G:LED2'
|
||||||
|
@ -8,21 +8,92 @@ USE_PROCD=1
|
|||||||
start_service() {
|
start_service() {
|
||||||
|
|
||||||
config_load qmodem
|
config_load qmodem
|
||||||
config_foreach mk_rundir modem-device
|
config_foreach _mk_rundir modem-device
|
||||||
config_get manual_configuration global manual_configuration
|
config_get manual_configuration main manual_configuration 0
|
||||||
|
config_get enable_pcie main enable_pcie_scan 0
|
||||||
|
config_get enable_usb main enable_usb_scan 0
|
||||||
|
config_get try_preset_usb main try_vendor_preset_usb 1
|
||||||
|
config_get try_preset_pcie main try_vendor_preset_pcie 1
|
||||||
|
#once enabled, skip all check or scan
|
||||||
[ "$manual_configuration" -eq 1 ] && return
|
[ "$manual_configuration" -eq 1 ] && return
|
||||||
logger -t modem_init "modem init"
|
|
||||||
config_foreach try_modem_device modem-device
|
#enabled by default
|
||||||
config_foreach try_modem modem-slot
|
if [ "$try_vendor_preset_pcie" -eq 1 ];then
|
||||||
|
_try_vendor_preset_pcie
|
||||||
|
fi
|
||||||
|
if [ "$try_vendor_preset_usb" -eq 1 ];then
|
||||||
|
_try_vendor_preset_usb
|
||||||
|
fi
|
||||||
|
|
||||||
|
#not enabled by default
|
||||||
|
if [ "$enable_usb_scan" -eq 1 ];then
|
||||||
|
_scan_usb
|
||||||
|
fi
|
||||||
|
if [ "$enable_pcie_scan" -eq 1 ];then
|
||||||
|
_scan_pcie
|
||||||
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mk_rundir()
|
_try_vendor_preset_usb()
|
||||||
|
{
|
||||||
|
config_foreach _try_usb_device modem-device
|
||||||
|
config_foreach _try_usb_slot modem-slot
|
||||||
|
}
|
||||||
|
|
||||||
|
_try_vendor_preset_pcie()
|
||||||
|
{
|
||||||
|
config_foreach _try_pcie_device modem-device
|
||||||
|
config_foreach _try_pcie_slot modem-slot
|
||||||
|
}
|
||||||
|
|
||||||
|
_try_pcie_slot()
|
||||||
|
{
|
||||||
|
config_get type "$1" type
|
||||||
|
[ "$1" == "pcie" ] && _try_slot
|
||||||
|
}
|
||||||
|
|
||||||
|
_try_usb_slot()
|
||||||
|
{
|
||||||
|
config_get type "$1" type
|
||||||
|
[ "$1" == "usb" ] && _try_slot
|
||||||
|
}
|
||||||
|
|
||||||
|
_try_usb_device()
|
||||||
|
{
|
||||||
|
config_get data_interface $1 data_interface
|
||||||
|
[ "$data_interface" == "usb" ] && _try_device
|
||||||
|
}
|
||||||
|
|
||||||
|
_try_pcie_device()
|
||||||
|
{
|
||||||
|
config_get data_interface $1 data_interface
|
||||||
|
[ "$data_interface" == "pcie" ] && _try_device
|
||||||
|
}
|
||||||
|
|
||||||
|
_scan_usb()
|
||||||
|
{
|
||||||
|
procd_open_instance "scan_usb"
|
||||||
|
#delay 15 second ,scan all usb device
|
||||||
|
procd_set_param command "ash" "/usr/share/modem/modem_scan.sh" "scan" "15" "usb"
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
_scan_pcie()
|
||||||
|
{
|
||||||
|
procd_open_instance "scan_pcie"
|
||||||
|
#delay 3 second ,scan all pcie device
|
||||||
|
procd_set_param command "ash" "/usr/share/modem/modem_scan.sh" "scan" "3" "pcie"
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
_mk_rundir()
|
||||||
{
|
{
|
||||||
modem_cfg="$1"
|
modem_cfg="$1"
|
||||||
mkdir -p "/var/run/modem/${modem_cfg}_dir"
|
mkdir -p "/var/run/modem/${modem_cfg}_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
try_modem()
|
_try_slot()
|
||||||
{
|
{
|
||||||
config_get slot "$1" slot
|
config_get slot "$1" slot
|
||||||
config_get type "$1" type
|
config_get type "$1" type
|
||||||
@ -45,7 +116,7 @@ try_modem()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
try_modem_device()
|
_try_device()
|
||||||
{
|
{
|
||||||
config_get path "$1" path
|
config_get path "$1" path
|
||||||
if [ ! -d "$path" ]; then
|
if [ ! -d "$path" ]; then
|
||||||
|
@ -20,7 +20,7 @@ start_service() {
|
|||||||
|
|
||||||
#加载模组配置
|
#加载模组配置
|
||||||
config_load qmodem
|
config_load qmodem
|
||||||
config_get enabled global enable_dial
|
config_get enabled main enable_dial
|
||||||
[ "$enabled" = "0" ] && config_foreach hang_modem modem-device && stop
|
[ "$enabled" = "0" ] && config_foreach hang_modem modem-device && stop
|
||||||
config_foreach run_modem modem-device
|
config_foreach run_modem modem-device
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ source /usr/share/libubox/jshn.sh
|
|||||||
method=$1
|
method=$1
|
||||||
config_section=$2
|
config_section=$2
|
||||||
at_port=$(uci get qmodem.$config_section.at_port)
|
at_port=$(uci get qmodem.$config_section.at_port)
|
||||||
|
sms_at_port=$(uci get qmodem.$config_section.sms_at_port)
|
||||||
vendor=$(uci get qmodem.$config_section.manufacturer)
|
vendor=$(uci get qmodem.$config_section.manufacturer)
|
||||||
platform=$(uci get qmodem.$config_section.platform)
|
platform=$(uci get qmodem.$config_section.platform)
|
||||||
define_connect=$(uci get qmodem.$config_section.define_connect)
|
define_connect=$(uci get qmodem.$config_section.define_connect)
|
||||||
@ -28,6 +29,7 @@ try_cache() {
|
|||||||
function_name=$3
|
function_name=$3
|
||||||
current_time=$(date +%s)
|
current_time=$(date +%s)
|
||||||
file_time=$(stat -t $cache_file | awk '{print $14}')
|
file_time=$(stat -t $cache_file | awk '{print $14}')
|
||||||
|
[ -z "$file_time" ] && file_time=0
|
||||||
if [ ! -f $cache_file ] || [ $(($current_time - $file_time)) -gt $cache_timeout ]; then
|
if [ ! -f $cache_file ] || [ $(($current_time - $file_time)) -gt $cache_timeout ]; then
|
||||||
touch $cache_file
|
touch $cache_file
|
||||||
json_add_array modem_info
|
json_add_array modem_info
|
||||||
@ -42,10 +44,12 @@ try_cache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_sms(){
|
get_sms(){
|
||||||
|
[ -n "$sms_at_port" ] && at_port=$sms_at_port
|
||||||
cache_timeout=$1
|
cache_timeout=$1
|
||||||
cache_file=$2
|
cache_file=$2
|
||||||
current_time=$(date +%s)
|
current_time=$(date +%s)
|
||||||
file_time=$(stat -t $cache_file | awk '{print $14}')
|
file_time=$(stat -t $cache_file | awk '{print $14}')
|
||||||
|
[ -z "$file_time" ] && file_time=0
|
||||||
if [ ! -f $cache_file ] || [ $(($current_time - $file_time)) -gt $cache_timeout ]; then
|
if [ ! -f $cache_file ] || [ $(($current_time - $file_time)) -gt $cache_timeout ]; then
|
||||||
touch $cache_file
|
touch $cache_file
|
||||||
sms_tool_q -d $at_port -j recv > $cache_file
|
sms_tool_q -d $at_port -j recv > $cache_file
|
||||||
@ -128,6 +132,7 @@ case $method in
|
|||||||
cmd_json=$3
|
cmd_json=$3
|
||||||
phone_number=$(echo $cmd_json | jq -r '.phone_number')
|
phone_number=$(echo $cmd_json | jq -r '.phone_number')
|
||||||
message_content=$(echo $cmd_json | jq -r '.message_content')
|
message_content=$(echo $cmd_json | jq -r '.message_content')
|
||||||
|
[ -n "$sms_at_port" ] && at_port=$sms_at_port
|
||||||
sms_tool_q -d $at_port send "$phone_number" "$message_content" > /dev/null
|
sms_tool_q -d $at_port send "$phone_number" "$message_content" > /dev/null
|
||||||
json_select result
|
json_select result
|
||||||
if [ "$?" == 0 ]; then
|
if [ "$?" == 0 ]; then
|
||||||
@ -141,6 +146,7 @@ case $method in
|
|||||||
;;
|
;;
|
||||||
"send_raw_pdu")
|
"send_raw_pdu")
|
||||||
cmd=$3
|
cmd=$3
|
||||||
|
[ -n "$sms_at_port" ] && at_port=$sms_at_port
|
||||||
res=$(sms_tool_q -d $at_port send_raw_pdu "$cmd" )
|
res=$(sms_tool_q -d $at_port send_raw_pdu "$cmd" )
|
||||||
json_select result
|
json_select result
|
||||||
if [ "$?" == 0 ]; then
|
if [ "$?" == 0 ]; then
|
||||||
@ -154,6 +160,7 @@ case $method in
|
|||||||
"delete_sms")
|
"delete_sms")
|
||||||
json_select result
|
json_select result
|
||||||
index=$3
|
index=$3
|
||||||
|
[ -n "$sms_at_port" ] && at_port=$sms_at_port
|
||||||
for i in $index; do
|
for i in $index; do
|
||||||
sms_tool_q -d $at_port delete $i > /dev/null
|
sms_tool_q -d $at_port delete $i > /dev/null
|
||||||
touch /tmp/cache_sms_$2
|
touch /tmp/cache_sms_$2
|
||||||
|
@ -11,31 +11,44 @@ debug_subject="modem_dial"
|
|||||||
source "${SCRIPT_DIR}/generic.sh"
|
source "${SCRIPT_DIR}/generic.sh"
|
||||||
touch $log_file
|
touch $log_file
|
||||||
|
|
||||||
|
get_led()
|
||||||
|
{
|
||||||
|
config_foreach get_led_by_slot modem-slot
|
||||||
|
}
|
||||||
|
|
||||||
|
get_led_by_slot()
|
||||||
|
{
|
||||||
|
local cfg="$1"
|
||||||
|
config_get slot "$cfg" slot
|
||||||
|
if [ "$modem_slot" = "$slot" ];then
|
||||||
|
config_get sim_led "$cfg" sim_led
|
||||||
|
config_get net_led "$cfg" net_led
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_associate_ethernet_by_path()
|
||||||
|
{
|
||||||
|
local cfg="$1"
|
||||||
|
config_get slot "$cfg" slot
|
||||||
|
config_get ethernet "$cfg" ethernet
|
||||||
|
if [ "$modem_slot" = "$slot" ];then
|
||||||
|
config_get ethernet_5g "$cfg" ethernet_5g
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
set_led()
|
set_led()
|
||||||
{
|
{
|
||||||
local type=$1
|
local type=$1
|
||||||
local modem_config=$2
|
local modem_config=$2
|
||||||
local value=$3
|
local value=$3
|
||||||
case $data_interface in
|
get_led "$modem_slot"
|
||||||
usb)
|
|
||||||
config_get sim_led u$modem_config sim_led
|
|
||||||
config_get net_led u$modem_config net_led
|
|
||||||
;;
|
|
||||||
pcie)
|
|
||||||
config_get sim_led p$modem_config sim_led
|
|
||||||
config_get net_led p$modem_config net_led
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
#usb
|
|
||||||
config_get sim_led u$modem_config sim_led
|
|
||||||
config_get net_led u$modem_config net_led
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
case $type in
|
case $type in
|
||||||
sim)
|
sim)
|
||||||
|
[ -z "$sim_led" ] && return
|
||||||
echo $value > /sys/class/leds/$sim_led/brightness
|
echo $value > /sys/class/leds/$sim_led/brightness
|
||||||
;;
|
;;
|
||||||
net)
|
net)
|
||||||
|
[ -z "$net_led" ] && return
|
||||||
uci set system.led_${net_led}.dev=$value
|
uci set system.led_${net_led}.dev=$value
|
||||||
uci commit system
|
uci commit system
|
||||||
/etc/init.d/led restart
|
/etc/init.d/led restart
|
||||||
@ -71,6 +84,10 @@ get_driver()
|
|||||||
mode="rndis"
|
mode="rndis"
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
"mhi_netdev")
|
||||||
|
mode="mhi"
|
||||||
|
break
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -z "$mode" ]; then
|
if [ -z "$mode" ]; then
|
||||||
mode="unknown"
|
mode="unknown"
|
||||||
@ -122,8 +139,10 @@ update_config()
|
|||||||
config_get define_connect $modem_config define_connect
|
config_get define_connect $modem_config define_connect
|
||||||
config_get ra_master $modem_config ra_master
|
config_get ra_master $modem_config ra_master
|
||||||
config_get extend_prefix $modem_config extend_prefix
|
config_get extend_prefix $modem_config extend_prefix
|
||||||
config_get global_dial global enable_dial
|
config_get global_dial main enable_dial
|
||||||
config_get ethernet_5g u$modem_config ethernet
|
# config_get ethernet_5g u$modem_config ethernet 转往口获取命令更新,待测试
|
||||||
|
get_associate_ethernet_by_path
|
||||||
|
modem_slot=$(basename $modem_path)
|
||||||
config_get alias $modem_config alias
|
config_get alias $modem_config alias
|
||||||
driver=$(get_driver)
|
driver=$(get_driver)
|
||||||
update_sim_slot
|
update_sim_slot
|
||||||
@ -422,6 +441,9 @@ dial(){
|
|||||||
"mbim")
|
"mbim")
|
||||||
mbim_dial
|
mbim_dial
|
||||||
;;
|
;;
|
||||||
|
"mhi")
|
||||||
|
mhi_dial
|
||||||
|
;;
|
||||||
"ncm")
|
"ncm")
|
||||||
at_dial_monitor
|
at_dial_monitor
|
||||||
;;
|
;;
|
||||||
@ -484,19 +506,24 @@ hang()
|
|||||||
"mbim")
|
"mbim")
|
||||||
wwan_hang
|
wwan_hang
|
||||||
;;
|
;;
|
||||||
|
"mhi")
|
||||||
|
wwan_hang
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
flush_if
|
flush_if
|
||||||
}
|
}
|
||||||
|
|
||||||
mbim_dial(){
|
mbim_dial(){
|
||||||
modem_path=$1
|
|
||||||
modem_dial=$2
|
|
||||||
if [ -z "$apn" ];then
|
if [ -z "$apn" ];then
|
||||||
apn="auto"
|
apn="auto"
|
||||||
fi
|
fi
|
||||||
qmi_dial
|
qmi_dial
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mhi_dial()
|
||||||
|
{
|
||||||
|
qmi_dial
|
||||||
|
}
|
||||||
qmi_dial()
|
qmi_dial()
|
||||||
{
|
{
|
||||||
cmd_line="quectel-CM"
|
cmd_line="quectel-CM"
|
||||||
@ -525,6 +552,7 @@ qmi_dial()
|
|||||||
fi
|
fi
|
||||||
if [ -n "$modem_netcard" ]; then
|
if [ -n "$modem_netcard" ]; then
|
||||||
qmi_if=$(echo "$modem_netcard" | cut -d_ -f1)
|
qmi_if=$(echo "$modem_netcard" | cut -d_ -f1)
|
||||||
|
qmi_if=$(echo "$modem_netcard" | cut -d. -f1)
|
||||||
cmd_line="${cmd_line} -i ${qmi_if}"
|
cmd_line="${cmd_line} -i ${qmi_if}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -4,24 +4,47 @@ action=$1
|
|||||||
config=$2
|
config=$2
|
||||||
slot_type=$3
|
slot_type=$3
|
||||||
modem_support=$(cat /usr/share/qmodem/modem_support.json)
|
modem_support=$(cat /usr/share/qmodem/modem_support.json)
|
||||||
|
source /lib/functions.sh
|
||||||
source /usr/share/qmodem/modem_util.sh
|
source /usr/share/qmodem/modem_util.sh
|
||||||
|
|
||||||
|
get_associate_usb()
|
||||||
|
{
|
||||||
|
target_slot=$1
|
||||||
|
config_load qmodem
|
||||||
|
config_foreach _get_associated_usb_by_path modem-slot
|
||||||
|
}
|
||||||
|
|
||||||
|
_get_associated_usb_by_path()
|
||||||
|
{
|
||||||
|
local cfg="$1"
|
||||||
|
echo $target_slot
|
||||||
|
config_get _get_slot $cfg slot
|
||||||
|
if [ "$target_slot" == "$_get_slot" ];then
|
||||||
|
config_get associated_usb $cfg associated_usb
|
||||||
|
echo \[$target_slot\]associated_usb:$associated_usb
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
scan()
|
scan()
|
||||||
{
|
{
|
||||||
|
local slot_type=$1
|
||||||
|
if [ "$slot_type" == "usb" ] || [ -z "$slot_type" ];then
|
||||||
scan_usb
|
scan_usb
|
||||||
scan_pcie
|
|
||||||
#remove duplicate
|
|
||||||
usb_slots=$(echo $usb_slots | uniq )
|
usb_slots=$(echo $usb_slots | uniq )
|
||||||
pcie_slots=$(echo $pcie_slots | uniq )
|
|
||||||
for slot in $usb_slots; do
|
for slot in $usb_slots; do
|
||||||
slot_type="usb"
|
slot_type="usb"
|
||||||
add $slot
|
add $slot
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
if [ "$slot_type" == "pcie" ] || [ -z "$slot_type" ];then
|
||||||
|
scan_pcie
|
||||||
|
pcie_slots=$(echo $pcie_slots | uniq )
|
||||||
for slot in $pcie_slots; do
|
for slot in $pcie_slots; do
|
||||||
slot_type="pcie"
|
slot_type="pcie"
|
||||||
add $slot
|
add $slot
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_usb()
|
scan_usb()
|
||||||
@ -35,7 +58,7 @@ scan_usb()
|
|||||||
[ -z "$netdev_path" ] && continue
|
[ -z "$netdev_path" ] && continue
|
||||||
[ -z "$(echo $netdev_path | grep usb)" ] && continue
|
[ -z "$(echo $netdev_path | grep usb)" ] && continue
|
||||||
usb_slot=$(basename $(dirname $netdev_path))
|
usb_slot=$(basename $(dirname $netdev_path))
|
||||||
echo "netdev_path: $netdev_path usb slot: $usb_slot"
|
m_debug "netdev_path: $netdev_path usb slot: $usb_slot"
|
||||||
[ -z "$usb_slots" ] && usb_slots="$usb_slot" || usb_slots="$usb_slots $usb_slot"
|
[ -z "$usb_slots" ] && usb_slots="$usb_slot" || usb_slots="$usb_slots $usb_slot"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@ -43,8 +66,93 @@ scan_usb()
|
|||||||
|
|
||||||
scan_pcie()
|
scan_pcie()
|
||||||
{
|
{
|
||||||
#not implemented
|
#beta
|
||||||
echo "scan_pcie"
|
m_debug "scan_pcie"
|
||||||
|
pcie_net_device_prefixs="rmnet"
|
||||||
|
pcie_slots=""
|
||||||
|
for pcie_net_device_prefix in $pcie_net_device_prefixs; do
|
||||||
|
pcie_netdev=$(ls /sys/class/net | grep -E "${pcie_net_device_prefix}")
|
||||||
|
for netdev in $pcie_netdev; do
|
||||||
|
netdev_path=$(readlink -f "/sys/class/net/$netdev/device/")
|
||||||
|
[ -z "$netdev_path" ] && continue
|
||||||
|
[ -z "$(echo $netdev_path | grep pcie)" ] && continue
|
||||||
|
pcie_slot=$(basename $(dirname $netdev_path))
|
||||||
|
[ "$pcie_slot" == "net" ] && continue
|
||||||
|
m_debug "netdev_path: $netdev_path pcie slot: $pcie_slot"
|
||||||
|
[ -z "$pcie_slots" ] && pcie_slots="$pcie_slot" || pcie_slots="$pcie_slots $pcie_slot"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
scan_pcie_slot_interfaces()
|
||||||
|
{
|
||||||
|
local slot=$1
|
||||||
|
local slot_path="/sys/bus/pci/devices/$slot"
|
||||||
|
net_devices=""
|
||||||
|
dun_devices=""
|
||||||
|
[ ! -d "$slot_path" ] && return
|
||||||
|
local short_slot_name=`echo ${slot:2:-2} |tr ":" "."`
|
||||||
|
local slot_interfaces=$(ls $slot_path | grep -E "_${short_slot_name}_")
|
||||||
|
for interface in $slot_interfaces; do
|
||||||
|
unset device
|
||||||
|
unset dun_device
|
||||||
|
interface_driver_path="$slot_path/$interface/driver"
|
||||||
|
[ ! -d "$interface_driver_path" ] && continue
|
||||||
|
interface_driver=$(basename $(readlink $interface_driver_path))
|
||||||
|
[ -z "$interface_driver" ] && continue
|
||||||
|
case $interface_driver in
|
||||||
|
mhi_netdev)
|
||||||
|
net_path="$slot_path/$interface/net"
|
||||||
|
[ ! -d "$net_path" ] && continue
|
||||||
|
device=$(ls $net_path)
|
||||||
|
[ -z "$net_devices" ] && net_devices="$device" || net_devices="$net_devices $device"
|
||||||
|
;;
|
||||||
|
mhi_uci_q)
|
||||||
|
dun_device=$(ls "$slot_path/$interface/mhi_uci_q" | grep mhi_DUN)
|
||||||
|
[ -z "$dun_device" ] && continue
|
||||||
|
dun_device_path="$slot_path/$interface/mhi_uci_q/$dun_device"
|
||||||
|
[ ! -d "$dun_device_path" ] && continue
|
||||||
|
dun_device_path=$(readlink -f "$dun_device_path")
|
||||||
|
[ ! -d "$dun_device_path" ] && continue
|
||||||
|
dun_device=$(basename "$dun_device_path")
|
||||||
|
[ -z "$dun_device" ] && continue
|
||||||
|
[ -z "$dun_devices" ] && dun_devices="$dun_device" || dun_devices="$dun_devices $dun_device"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
m_debug "net_devices: $net_devices dun_devices: $dun_devices"
|
||||||
|
at_ports="$dun_devices"
|
||||||
|
[ -n "$net_devices" ] && get_associate_usb $slot
|
||||||
|
if [ -n "$associated_usb" ]; then
|
||||||
|
echo checking associated_usb: $associated_usb
|
||||||
|
local assoc_usb_path="/sys/bus/usb/devices/$associated_usb"
|
||||||
|
[ ! -d "$assoc_usb_path" ] && return
|
||||||
|
local slot_interfaces=$(ls $assoc_usb_path | grep -E "$associated_usb:[0-9]\.[0-9]+")
|
||||||
|
echo checking slot_interfaces: $slot_interfaces
|
||||||
|
for interface in $slot_interfaces; do
|
||||||
|
unset device
|
||||||
|
unset ttyUSB_device
|
||||||
|
unset ttyACM_device
|
||||||
|
interface_driver_path="$assoc_usb_path/$interface/driver"
|
||||||
|
[ ! -d "$interface_driver_path" ] && continue
|
||||||
|
interface_driver=$(basename $(readlink $interface_driver_path))
|
||||||
|
[ -z "$interface_driver" ] && continue
|
||||||
|
case $interface_driver in
|
||||||
|
option|\
|
||||||
|
usbserial)
|
||||||
|
ttyUSB_device=$(ls "$assoc_usb_path/$interface/" | grep ttyUSB)
|
||||||
|
ttyACM_device=$(ls "$assoc_usb_path/$interface/" | grep ttyACM)
|
||||||
|
[ -z "$ttyUSB_device" ] && [ -z "$ttyACM_device" ] && continue
|
||||||
|
[ -n "$ttyUSB_device" ] && device="$ttyUSB_device"
|
||||||
|
[ -n "$ttyACM_device" ] && device="$ttyACM_device"
|
||||||
|
[ -z "$tty_devices" ] && tty_devices="$device" || tty_devices="$tty_devices $device"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
at_ports="$at_ports $tty_devices"
|
||||||
|
fi
|
||||||
|
|
||||||
|
validate_at_port
|
||||||
}
|
}
|
||||||
|
|
||||||
scan_usb_slot_interfaces()
|
scan_usb_slot_interfaces()
|
||||||
@ -96,7 +204,7 @@ validate_at_port()
|
|||||||
for at_port in $at_ports; do
|
for at_port in $at_ports; do
|
||||||
dev_path="/dev/$at_port"
|
dev_path="/dev/$at_port"
|
||||||
[ ! -e "$dev_path" ] && continue
|
[ ! -e "$dev_path" ] && continue
|
||||||
res=$(at $dev_path "AT")
|
res=$(at $dev_path "ATI")
|
||||||
[ -z "$res" ] && continue
|
[ -z "$res" ] && continue
|
||||||
[ "$res" == *"No"* ] && [ "$res" == *"failed"* ] && continue #for sms_tools No response from modem
|
[ "$res" == *"No"* ] && [ "$res" == *"failed"* ] && continue #for sms_tools No response from modem
|
||||||
valid_at_port="$at_port"
|
valid_at_port="$at_port"
|
||||||
@ -155,17 +263,21 @@ add()
|
|||||||
#slot_type is usb or pcie
|
#slot_type is usb or pcie
|
||||||
#section name is replace slot .:- with _
|
#section name is replace slot .:- with _
|
||||||
section_name=$(echo $slot | sed 's/[\.:-]/_/g')
|
section_name=$(echo $slot | sed 's/[\.:-]/_/g')
|
||||||
is_exist=$(uci get qmodem.$section_name)
|
is_exist=$(uci -q get qmodem.$section_name)
|
||||||
case $slot_type in
|
case $slot_type in
|
||||||
"usb")
|
"usb")
|
||||||
scan_usb_slot_interfaces $slot
|
scan_usb_slot_interfaces $slot
|
||||||
|
modem_path="/sys/bus/usb/devices/$slot/"
|
||||||
;;
|
;;
|
||||||
"pcie")
|
"pcie")
|
||||||
#not implemented
|
#under test
|
||||||
|
scan_pcie_slot_interfaces $slot
|
||||||
|
modem_path="/sys/bus/pci/devices/$slot/"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
for at_port in $valid_at_ports; do
|
for at_port in $valid_at_ports; do
|
||||||
get_modem_model "/dev/$at_port"
|
get_modem_model "/dev/$at_port"
|
||||||
|
echo "modem_name:$modem_name"
|
||||||
[ $? -eq 0 ] && break
|
[ $? -eq 0 ] && break
|
||||||
done
|
done
|
||||||
[ -z "$modem_name" ] && lock -u /tmp/lock/modem_add_$slot && return
|
[ -z "$modem_name" ] && lock -u /tmp/lock/modem_add_$slot && return
|
||||||
@ -185,17 +297,17 @@ add()
|
|||||||
else
|
else
|
||||||
#aqcuire lock
|
#aqcuire lock
|
||||||
lock /tmp/lock/modem_add
|
lock /tmp/lock/modem_add
|
||||||
modem_count=$(uci get qmodem.@global[0].modem_count)
|
modem_count=$(uci get qmodem.main.modem_count)
|
||||||
[ -z "$modem_count" ] && modem_count=0
|
[ -z "$modem_count" ] && modem_count=0
|
||||||
modem_count=$(($modem_count+1))
|
modem_count=$(($modem_count+1))
|
||||||
uci set qmodem.@global[0].modem_count=$modem_count
|
uci set qmodem.main.modem_count=$modem_count
|
||||||
uci set qmodem.$section_name=modem-device
|
uci set qmodem.$section_name=modem-device
|
||||||
uci commit qmodem
|
uci commit qmodem
|
||||||
lock -u /tmp/lock/modem_add
|
lock -u /tmp/lock/modem_add
|
||||||
#release lock
|
#release lock
|
||||||
metric=$(($modem_count+10))
|
metric=$(($modem_count+10))
|
||||||
uci batch << EOF
|
uci batch << EOF
|
||||||
set qmodem.$section_name.path="/sys/bus/usb/devices/$slot/"
|
set qmodem.$section_name.path="$modem_path"
|
||||||
set qmodem.$section_name.data_interface="$slot_type"
|
set qmodem.$section_name.data_interface="$slot_type"
|
||||||
set qmodem.$section_name.enable_dial="1"
|
set qmodem.$section_name.enable_dial="1"
|
||||||
set qmodem.$section_name.pdp_type="ip"
|
set qmodem.$section_name.pdp_type="ip"
|
||||||
@ -235,10 +347,10 @@ remove()
|
|||||||
is_exist=$(uci get qmodem.$section_name)
|
is_exist=$(uci get qmodem.$section_name)
|
||||||
[ -z "$is_exist" ] && return
|
[ -z "$is_exist" ] && return
|
||||||
lock /tmp/lock/modem_remove
|
lock /tmp/lock/modem_remove
|
||||||
modem_count=$(uci get qmodem.@global[0].modem_count)
|
modem_count=$(uci get qmodem.main.modem_count)
|
||||||
[ -z "$modem_count" ] && modem_count=0
|
[ -z "$modem_count" ] && modem_count=0
|
||||||
modem_count=$(($modem_count-1))
|
modem_count=$(($modem_count-1))
|
||||||
uci set qmodem.@global[0].modem_count=$modem_count
|
uci set qmodem.main.modem_count=$modem_count
|
||||||
uci commit qmodem
|
uci commit qmodem
|
||||||
uci batch <<EOF
|
uci batch <<EOF
|
||||||
del qmodem.${section_name}
|
del qmodem.${section_name}
|
||||||
@ -282,7 +394,7 @@ case $action in
|
|||||||
[ -n "$config" ] && delay=$config && sleep $delay
|
[ -n "$config" ] && delay=$config && sleep $delay
|
||||||
lock -n /tmp/lock/modem_scan
|
lock -n /tmp/lock/modem_scan
|
||||||
[ $? -eq 1 ] && exit 0
|
[ $? -eq 1 ] && exit 0
|
||||||
scan
|
scan $slot_type
|
||||||
lock -u /tmp/lock/modem_scan
|
lock -u /tmp/lock/modem_scan
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -247,6 +247,13 @@
|
|||||||
"define_connect":"1",
|
"define_connect":"1",
|
||||||
"modes":["qmi","gobinet","mbim"]
|
"modes":["qmi","gobinet","mbim"]
|
||||||
},
|
},
|
||||||
|
"rm502q-ae":{
|
||||||
|
"manufacturer":"quectel",
|
||||||
|
"platform":"qualcomm",
|
||||||
|
"data_interface":"pcie",
|
||||||
|
"define_connect":"1",
|
||||||
|
"modes":["qmi","gobinet","mbim"]
|
||||||
|
},
|
||||||
"rm520n-gl":{
|
"rm520n-gl":{
|
||||||
"manufacturer":"quectel",
|
"manufacturer":"quectel",
|
||||||
"platform":"qualcomm",
|
"platform":"qualcomm",
|
||||||
|
@ -6,6 +6,7 @@ at()
|
|||||||
local at_port=$1
|
local at_port=$1
|
||||||
local new_str="${2/[$]/$}"
|
local new_str="${2/[$]/$}"
|
||||||
local atcmd="${new_str/\"/\"}"
|
local atcmd="${new_str/\"/\"}"
|
||||||
|
#过滤空行
|
||||||
sms_tool_q -d $at_port at "$atcmd"
|
sms_tool_q -d $at_port at "$atcmd"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user