modem更新V1.4.1,添加插件页面选项,添加手动模组扫描功能,添加手动配置模组的功能,修改部分页面翻译
This commit is contained in:
parent
4337313ef1
commit
636317fdeb
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=luci-app-modem
|
||||
LUCI_TITLE:=LuCI support for Modem
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=1.4.0
|
||||
PKG_VERSION:=1.4.1
|
||||
PKG_LICENSE:=GPLv3
|
||||
PKG_LINCESE_FILES:=LICENSE
|
||||
PKF_MAINTAINER:=siriling <siriling@qq.com>
|
||||
|
@ -20,8 +20,8 @@ function index()
|
||||
entry({"admin", "network", "modem", "get_modem_info"}, call("getModemInfo")).leaf = true
|
||||
|
||||
--拨号配置
|
||||
entry({"admin", "network", "modem", "index"},cbi("modem/index"),translate("Dial Config"),20).leaf = true
|
||||
entry({"admin", "network", "modem", "config"}, cbi("modem/config")).leaf = true
|
||||
entry({"admin", "network", "modem", "dial_overview"},cbi("modem/dial_overview"),translate("Dial Overview"),20).leaf = true
|
||||
entry({"admin", "network", "modem", "dial_config"}, cbi("modem/dial_config")).leaf = true
|
||||
entry({"admin", "network", "modem", "get_modems"}, call("getModems"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "get_dial_log_info"}, call("getDialLogInfo"), nil).leaf = true
|
||||
entry({"admin", "network", "modem", "clean_dial_log"}, call("cleanDialLog"), nil).leaf = true
|
||||
@ -39,8 +39,13 @@ function index()
|
||||
entry({"admin", "network", "modem", "send_at_command"}, call("sendATCommand"), nil).leaf = true
|
||||
-- entry({"admin", "network", "modem", "get_modem_debug_info"}, call("getModemDebugInfo"), nil).leaf = true
|
||||
|
||||
--插件设置
|
||||
entry({"admin", "network", "modem", "plugin_config"},cbi("modem/plugin_config"),translate("Plugin Config"),40).leaf = true
|
||||
entry({"admin", "network", "modem", "modem_config"}, cbi("modem/modem_config")).leaf = true
|
||||
entry({"admin", "network", "modem", "modem_scan"}, call("modemScan"), nil).leaf = true
|
||||
|
||||
--插件信息
|
||||
entry({"admin", "network", "modem", "plugin_info"},template("modem/plugin_info"),translate("Plugin Info"),40).leaf = true
|
||||
entry({"admin", "network", "modem", "plugin_info"},template("modem/plugin_info"),translate("Plugin Info"),50).leaf = true
|
||||
entry({"admin", "network", "modem", "get_plugin_info"}, call("getPluginInfo"), nil).leaf = true
|
||||
|
||||
--AT命令旧界面
|
||||
@ -452,7 +457,7 @@ end
|
||||
]]
|
||||
function getModemRemarks(network)
|
||||
local remarks=""
|
||||
uci:foreach("modem", "config", function (config)
|
||||
uci:foreach("modem", "dial-config", function (config)
|
||||
---配置启用,且备注存在
|
||||
if network == config["network"] and config["enable"] == "1" then
|
||||
if config["remarks"] then
|
||||
@ -748,6 +753,19 @@ end
|
||||
-- luci.http.write_json(modem_debug_info)
|
||||
-- end
|
||||
|
||||
--[[
|
||||
@Description 模组扫描
|
||||
]]
|
||||
function modemScan()
|
||||
|
||||
local command="source "..script_path.."modem_scan.sh && modem_scan"
|
||||
local result=shell(command)
|
||||
|
||||
-- 写入Web界面
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(result)
|
||||
end
|
||||
|
||||
--[[
|
||||
@Description 设置插件版本信息
|
||||
@Params
|
||||
|
@ -2,10 +2,10 @@ local dispatcher = require "luci.dispatcher"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local http = require "luci.http"
|
||||
|
||||
m = Map("modem", translate("Modem Config"))
|
||||
m.redirect = dispatcher.build_url("admin", "network", "modem","index")
|
||||
m = Map("modem", translate("Dial Config"))
|
||||
m.redirect = dispatcher.build_url("admin", "network", "modem","dial_overview")
|
||||
|
||||
s = m:section(NamedSection, arg[1], "config", "")
|
||||
s = m:section(NamedSection, arg[1], "dial-config", "")
|
||||
s.addremove = false
|
||||
s.dynamic = false
|
||||
s:tab("general", translate("General Settings"))
|
||||
@ -35,18 +35,29 @@ function getMobileNetwork()
|
||||
network:value("",translate("Mobile network not found"))
|
||||
end
|
||||
|
||||
for i=0,modem_number-1 do
|
||||
-- for i=0,modem_number-1 do
|
||||
-- --获取模块名
|
||||
-- local modem_name = uci:get('modem','modem'..i,'name')
|
||||
-- if modem_name == nil then
|
||||
-- modem_name = "unknown"
|
||||
-- end
|
||||
-- --设置网络
|
||||
-- modem_network = uci:get('modem','modem'..i,'network')
|
||||
-- if modem_network ~= nil then
|
||||
-- network:value(modem_network,modem_network.." ("..translate(modem_name:upper())..")")
|
||||
-- end
|
||||
-- end
|
||||
|
||||
uci:foreach("modem", "modem-device", function (modem_device)
|
||||
|
||||
--获取模块名
|
||||
local modem_name = uci:get('modem','modem'..i,'name')
|
||||
if modem_name == nil then
|
||||
modem_name = "unknown"
|
||||
end
|
||||
--设置网络
|
||||
modem_network = uci:get('modem','modem'..i,'network')
|
||||
if modem_network ~= nil then
|
||||
network:value(modem_network,modem_network.." ("..translate(modem_name:upper())..")")
|
||||
end
|
||||
end
|
||||
local modem_name=modem_device["name"]
|
||||
--获取网络
|
||||
local modem_network=modem_device["network"]
|
||||
|
||||
--设置网络值
|
||||
network:value(modem_network,modem_network.." ("..translate(modem_name:upper())..")")
|
||||
end)
|
||||
end
|
||||
|
||||
getMobileNetwork()
|
@ -2,26 +2,26 @@ local d = require "luci.dispatcher"
|
||||
local uci = luci.model.uci.cursor()
|
||||
|
||||
m = Map("modem")
|
||||
m.title = translate("Dial Config")
|
||||
m.description = translate("Add dialing configuration to all modules on this page")
|
||||
m.title = translate("Dial Overview")
|
||||
m.description = translate("Check and add modem dialing configurations")
|
||||
|
||||
--全局配置
|
||||
s = m:section(NamedSection, "global", "global", translate("Global Config"))
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o = s:option(Flag, "enable", translate("Enable"))
|
||||
o = s:option(Flag, "enable_dial", translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Check to enable all configurations")
|
||||
o.description = translate("Enable dial configurations")
|
||||
|
||||
-- 添加模块状态
|
||||
m:append(Template("modem/modem_status"))
|
||||
|
||||
s = m:section(TypedSection, "config", translate("Config List"))
|
||||
s = m:section(TypedSection, "dial-config", translate("Config List"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.template = "modem/tblsection"
|
||||
s.extedit = d.build_url("admin", "network", "modem", "config", "%s")
|
||||
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)"), "-", "")
|
||||
@ -32,7 +32,7 @@ end
|
||||
function s.remove(uci, t)
|
||||
uci.map.proceed = true
|
||||
uci.map:del(t)
|
||||
luci.http.redirect(d.build_url("admin", "network", "modem","index"))
|
||||
luci.http.redirect(d.build_url("admin", "network", "modem","dial_overview"))
|
||||
end
|
||||
|
||||
o = s:option(Flag, "enable", translate("Enable"))
|
130
luci-app-modem/luasrc/model/cbi/modem/modem_config.lua
Normal file
130
luci-app-modem/luasrc/model/cbi/modem/modem_config.lua
Normal file
@ -0,0 +1,130 @@
|
||||
local dispatcher = require "luci.dispatcher"
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local sys = require "luci.sys"
|
||||
local json = require("luci.jsonc")
|
||||
local script_path="/usr/share/modem/"
|
||||
|
||||
--[[
|
||||
@Description 执行Shell脚本
|
||||
@Params
|
||||
command sh命令
|
||||
]]
|
||||
function shell(command)
|
||||
local odpall = io.popen(command)
|
||||
local odp = odpall:read("*a")
|
||||
odpall:close()
|
||||
return odp
|
||||
end
|
||||
|
||||
--[[
|
||||
@Description 获取支持的模组信息
|
||||
]]
|
||||
function getSupportModems()
|
||||
local command="cat "..script_path.."modem_support.json"
|
||||
local result=json.parse(shell(command))
|
||||
return result["modem_support"]["usb"]
|
||||
end
|
||||
|
||||
--[[
|
||||
@Description 按照制造商给模组分类
|
||||
@Params
|
||||
support_modem 支持的模组
|
||||
]]
|
||||
function getManufacturers(support_modem)
|
||||
|
||||
local manufacturers={}
|
||||
|
||||
for modem in pairs(support_modem) do
|
||||
|
||||
local manufacturer=support_modem[modem]["manufacturer"]
|
||||
if manufacturers[manufacturer] then
|
||||
-- 直接插入
|
||||
table.insert(manufacturers[manufacturer],modem)
|
||||
else
|
||||
-- 不存在先创建一个空表
|
||||
local tmp={}
|
||||
table.insert(tmp,modem)
|
||||
manufacturers[manufacturer]=tmp
|
||||
end
|
||||
end
|
||||
|
||||
return manufacturers
|
||||
end
|
||||
|
||||
m = Map("modem", translate("Modem Config"))
|
||||
m.redirect = dispatcher.build_url("admin", "network", "modem","plugin_config")
|
||||
|
||||
s = m:section(NamedSection, arg[1], "modem-device", "")
|
||||
s.addremove = false
|
||||
s.dynamic = false
|
||||
|
||||
-- 移动网络
|
||||
mobile_network = s:option(ListValue, "network", translate("Mobile Network"))
|
||||
mobile_network.rmempty = true
|
||||
|
||||
-- 获取移动网络
|
||||
function getMobileNetwork()
|
||||
|
||||
--获取所有的网络接口
|
||||
local networks = sys.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null")
|
||||
|
||||
--遍历所有网络接口
|
||||
for network in string.gmatch(networks, "%S+") do
|
||||
|
||||
-- 只处理最上级的网络设备
|
||||
-- local count=$(echo "${network_path}" | grep -o "/net" | wc -l)
|
||||
-- [ "$count" -ge "2" ] && return
|
||||
|
||||
-- 判断路径是否带有usb(排除其他eth网络设备)
|
||||
local command="readlink -f /sys/class/net/"..network
|
||||
local network_path=shell(command)
|
||||
local flag="0"
|
||||
if network_path:find("eth") and not network_path:find("usb") then
|
||||
flag="1"
|
||||
end
|
||||
|
||||
if flag=="0" then
|
||||
if network:find("usb") or network:find("wwan") or network:find("eth") then
|
||||
--设置USB移动网络
|
||||
mobile_network:value(network)
|
||||
elseif network:find("mhi_hwip") or network:find("rmnet_mhi") then
|
||||
--设置PCIE移动网络
|
||||
mobile_network:value(network)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
getMobileNetwork()
|
||||
|
||||
-- 模组名称
|
||||
name = s:option(ListValue, "name", translate("Modem Name"))
|
||||
name.placeholder = translate("Not Null")
|
||||
name.rmempty = false
|
||||
|
||||
-- 获取支持的模组
|
||||
local support_modem=getSupportModems()
|
||||
-- 按照制造商给模组分类
|
||||
local manufacturers=getManufacturers(support_modem)
|
||||
|
||||
for key in pairs(manufacturers) do
|
||||
local modems=manufacturers[key]
|
||||
-- 排序
|
||||
table.sort(modems)
|
||||
|
||||
for i in pairs(modems) do
|
||||
-- 首字母大写
|
||||
local first_str=string.sub(key, 1, 1)
|
||||
local manufacturer = string.upper(first_str)..string.sub(key, 2)
|
||||
-- 设置值
|
||||
name:value(modems[i],manufacturer.." "..modems[i]:upper())
|
||||
end
|
||||
end
|
||||
|
||||
-- AT串口
|
||||
at_port = s:option(Value, "at_port", translate("AT Port"))
|
||||
at_port.placeholder = translate("Not Null")
|
||||
at_port.rmempty = false
|
||||
|
||||
return m
|
76
luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua
Normal file
76
luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua
Normal file
@ -0,0 +1,76 @@
|
||||
local d = require "luci.dispatcher"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local sys = require "luci.sys"
|
||||
local script_path="/usr/share/modem/"
|
||||
|
||||
m = Map("modem")
|
||||
m.title = translate("Plugin Config")
|
||||
m.description = translate("Check and modify the plugin configuration")
|
||||
|
||||
font_red = [[<b style=color:red>]]
|
||||
font_off = [[</b>]]
|
||||
bold_on = [[<strong>]]
|
||||
bold_off = [[</strong>]]
|
||||
|
||||
--全局配置
|
||||
s = m:section(TypedSection, "global", translate("Global Config"))
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
-- 模组扫描
|
||||
o = s:option(Button, "modem_scan", translate("Modem Scan"))
|
||||
o.template = "modem/modem_scan"
|
||||
|
||||
-- 启用手动配置
|
||||
o = s:option(Flag, "manual_configuration", font_red..bold_on..translate("Manual Configuration")..bold_off..font_off)
|
||||
o.rmempty = false
|
||||
o.description = translate("Enable the manual configuration of modem information").." "..font_red..bold_on.. translate("(After enable, the automatic scanning and configuration function for modem information will be disabled)")..bold_off..font_off
|
||||
|
||||
-- 配置模组信息
|
||||
s = m:section(TypedSection, "modem-device", translate("Modem Config"))
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
-- s.sortable = true
|
||||
s.template = "modem/tblsection"
|
||||
s.extedit = d.build_url("admin", "network", "modem", "modem_config", "%s")
|
||||
|
||||
function s.create(uci, t)
|
||||
-- 获取模组序号
|
||||
local modem_no=tonumber(uci.map:get("@global[0]","modem_number")) -- 将字符串转换为数字类型
|
||||
t="modem"..modem_no
|
||||
TypedSection.create(uci, t)
|
||||
-- 设置手动配置
|
||||
uci.map:set(t,"manual","1")
|
||||
luci.http.redirect(uci.extedit:format(t))
|
||||
end
|
||||
|
||||
function s.remove(uci, t)
|
||||
uci.map.proceed = true
|
||||
uci.map:del(t)
|
||||
|
||||
-- 获取模组数量
|
||||
local modem_number=tonumber(uci.map:get("@global[0]","modem_number"))-1
|
||||
-- 设置模组数量
|
||||
uci.map:set("@global[0]","modem_number",modem_number)
|
||||
|
||||
luci.http.redirect(d.build_url("admin", "network", "modem","plugin_config"))
|
||||
end
|
||||
|
||||
-- 移动网络
|
||||
o = s:option(DummyValue, "network", translate("Network"))
|
||||
|
||||
-- 模组名称
|
||||
o = s:option(DummyValue, "name", translate("Modem Name"))
|
||||
o.cfgvalue = function(t, n)
|
||||
local name = (Value.cfgvalue(t, n) or "")
|
||||
return name:upper()
|
||||
end
|
||||
|
||||
-- AT串口
|
||||
-- o = s:option(DummyValue, "at_port", translate("AT Port"))
|
||||
o = s:option(Value, "at_port", translate("AT Port"))
|
||||
o.placeholder = translate("Not Null")
|
||||
o.rmempty = false
|
||||
o.optional = false
|
||||
|
||||
return m
|
@ -516,7 +516,7 @@ end
|
||||
|
||||
<div class="cbi-map" id="cbi-modem">
|
||||
<h2 name="content"><%:Modem Information%></h2>
|
||||
<div class="cbi-map-descr"><%:Check information about adapted modem on this page%></div>
|
||||
<div class="cbi-map-descr"><%:Check the information of the adapted modem%></div>
|
||||
|
||||
<fieldset class="cbi-section" id="cbi-info" style="display: block;">
|
||||
<div class="cbi-section fade-in">
|
||||
|
46
luci-app-modem/luasrc/view/modem/modem_scan.htm
Normal file
46
luci-app-modem/luasrc/view/modem/modem_scan.htm
Normal file
@ -0,0 +1,46 @@
|
||||
<%+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%>" style="vertical-align:middle"/><%:Scaning modem...%>'
|
||||
document.getElementById('modem_scan_description').innerHTML=description;
|
||||
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "modem_scan")%>', null,
|
||||
function(x, data)
|
||||
{
|
||||
// console.log(data);
|
||||
location.href='/cgi-bin/luci/admin/network/modem/plugin_config'
|
||||
|
||||
//启用功能
|
||||
// disabled_function("modem_scan",false);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<style type="text/css"></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 startup, otherwise, manual scanning is necessary%>
|
||||
</div>
|
||||
<%+cbi/valuefooter%>
|
@ -79,7 +79,7 @@
|
||||
|
||||
<div class="cbi-map" id="cbi-modem-debug">
|
||||
<h2 id="content" name="content"><%:Plugin Info%></h2>
|
||||
<div class="cbi-map-descr"><%:View the version information of the plugin%></div>
|
||||
<div class="cbi-map-descr"><%:Check the version information of the plugin%></div>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
div .version {
|
||||
|
@ -1,5 +1,20 @@
|
||||
#
|
||||
# Siriling <siriling@qq.com>, 2023.
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
msgstr ""
|
||||
"Project-Id-Version: luci-app-modem 1.4.1-1\n"
|
||||
"POT-Creation-Date: 2024-04-20 12:07+0100\n"
|
||||
"PO-Revision-Date: 2024-04-24 18:08+0000\n"
|
||||
"Last-Translator: Siriling <siriling@gmail.com>\n"
|
||||
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
|
||||
"openwrt/luciapplicationsmodem/zh_Hans/>\n"
|
||||
"Language: zh_Hans\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 5.5-dev\n"
|
||||
|
||||
msgid "Base Setting"
|
||||
msgstr "基本设置"
|
||||
@ -22,8 +37,8 @@ msgstr "模组调试"
|
||||
msgid "Modem Select"
|
||||
msgstr "模组选择"
|
||||
|
||||
msgid "Check information about adapted modem on this page"
|
||||
msgstr "在此页面查看已适配模组的信息"
|
||||
msgid "Check the information of the adapted modem"
|
||||
msgstr "查看已适配模组的信息"
|
||||
|
||||
msgid "Not adapted to this modem"
|
||||
msgstr "未适配该模组"
|
||||
@ -37,11 +52,11 @@ msgstr "正在加载模组状态"
|
||||
msgid "Loading modem"
|
||||
msgstr "正在加载模组"
|
||||
|
||||
msgid "Dial Config"
|
||||
msgstr "拨号配置"
|
||||
msgid "Dial Overview"
|
||||
msgstr "拨号总览"
|
||||
|
||||
msgid "Add dialing configuration to all modules on this page"
|
||||
msgstr "在此页面给所有模组添加拨号配置"
|
||||
msgid "Check and add modem dialing configurations"
|
||||
msgstr "查看和添加模组拨号配置"
|
||||
|
||||
msgid "Global Config"
|
||||
msgstr "全局配置"
|
||||
@ -70,6 +85,9 @@ msgstr "模式"
|
||||
msgid "Connect Status"
|
||||
msgstr "连接状态"
|
||||
|
||||
msgid "Dial Config"
|
||||
msgstr "拨号配置"
|
||||
|
||||
msgid "Config List"
|
||||
msgstr "配置列表"
|
||||
|
||||
@ -178,8 +196,8 @@ msgstr "模组信息"
|
||||
msgid "No modems found"
|
||||
msgstr "没有找到模组"
|
||||
|
||||
msgid "Check to enable all configurations"
|
||||
msgstr "勾选启用全部配置"
|
||||
msgid "Enable dial configurations"
|
||||
msgstr "启用拨号配置"
|
||||
|
||||
msgid "General Settings"
|
||||
msgstr "通用配置"
|
||||
@ -505,10 +523,37 @@ msgstr "中国电信"
|
||||
msgid "46011"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "Plugin Config"
|
||||
msgstr "插件配置"
|
||||
|
||||
msgid "Check and modify the plugin configuration"
|
||||
msgstr "查看和修改插件配置"
|
||||
|
||||
msgid "Modem Scan"
|
||||
msgstr "模组扫描"
|
||||
|
||||
msgid "Scan"
|
||||
msgstr "扫描"
|
||||
|
||||
msgid "Scaning modem..."
|
||||
msgstr "正在扫描中..."
|
||||
|
||||
msgid "The automatic configuration modem is triggered only at startup, otherwise, manual scanning is necessary"
|
||||
msgstr "自动配置模组只有在启动的时候才会触发,其他情况需要手动点击扫描"
|
||||
|
||||
msgid "Manual Configuration"
|
||||
msgstr "手动配置"
|
||||
|
||||
msgid "Enable the manual configuration of modem information"
|
||||
msgstr "启用手动配置模组信息"
|
||||
|
||||
msgid "(After enable, the automatic scanning and configuration function for modem information will be disabled)"
|
||||
msgstr "(启用后将禁用自动扫描配置模组信息功能)"
|
||||
|
||||
msgid "Plugin Info"
|
||||
msgstr "插件信息"
|
||||
|
||||
msgid "View the version information of the plugin"
|
||||
msgid "Check the version information of the plugin"
|
||||
msgstr "查看插件的版本信息"
|
||||
|
||||
msgid "Plugin Version"
|
||||
|
@ -1 +1,602 @@
|
||||
zh-cn
|
||||
#
|
||||
# Siriling <siriling@qq.com>, 2023.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: luci-app-modem 1.4.1-1\n"
|
||||
"POT-Creation-Date: 2024-04-20 12:07+0100\n"
|
||||
"PO-Revision-Date: 2024-04-24 18:08+0000\n"
|
||||
"Last-Translator: Siriling <siriling@gmail.com>\n"
|
||||
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
|
||||
"openwrt/luciapplicationsmodem/zh_Hans/>\n"
|
||||
"Language: zh_Hans\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 5.5-dev\n"
|
||||
|
||||
msgid "Base Setting"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "Modem"
|
||||
msgstr "移动通信模组"
|
||||
|
||||
msgid "Modem Config"
|
||||
msgstr "模组配置"
|
||||
|
||||
msgid "Modem Status"
|
||||
msgstr "模组状态"
|
||||
|
||||
msgid "Modem Name"
|
||||
msgstr "模组名称"
|
||||
|
||||
msgid "Modem Debug"
|
||||
msgstr "模组调试"
|
||||
|
||||
msgid "Modem Select"
|
||||
msgstr "模组选择"
|
||||
|
||||
msgid "Check the information of the adapted modem"
|
||||
msgstr "查看已适配模组的信息"
|
||||
|
||||
msgid "Not adapted to this modem"
|
||||
msgstr "未适配该模组"
|
||||
|
||||
msgid "Loading modem information"
|
||||
msgstr "正在加载模组信息"
|
||||
|
||||
msgid "Loading modem status"
|
||||
msgstr "正在加载模组状态"
|
||||
|
||||
msgid "Loading modem"
|
||||
msgstr "正在加载模组"
|
||||
|
||||
msgid "Dial Overview"
|
||||
msgstr "拨号总览"
|
||||
|
||||
msgid "Check and add modem dialing configurations"
|
||||
msgstr "查看和添加模组拨号配置"
|
||||
|
||||
msgid "Global Config"
|
||||
msgstr "全局配置"
|
||||
|
||||
msgid "Dial Log"
|
||||
msgstr "拨号日志"
|
||||
|
||||
msgid "Download Log"
|
||||
msgstr "下载日志"
|
||||
|
||||
msgid "connect"
|
||||
msgstr "已连接"
|
||||
|
||||
msgid "disconnect"
|
||||
msgstr "未连接"
|
||||
|
||||
msgid "disabled"
|
||||
msgstr "未启用"
|
||||
|
||||
msgid "Data Interface"
|
||||
msgstr "数据接口"
|
||||
|
||||
msgid "Mode"
|
||||
msgstr "模式"
|
||||
|
||||
msgid "Connect Status"
|
||||
msgstr "连接状态"
|
||||
|
||||
msgid "Dial Config"
|
||||
msgstr "拨号配置"
|
||||
|
||||
msgid "Config List"
|
||||
msgstr "配置列表"
|
||||
|
||||
msgid "Debug Your Module"
|
||||
msgstr "调试你的模组"
|
||||
|
||||
msgid "Select a modem for debugging"
|
||||
msgstr "选择一个模组进行调试"
|
||||
|
||||
msgid "Network Preferences"
|
||||
msgstr "网络偏好"
|
||||
|
||||
msgid "Self Test"
|
||||
msgstr "自检"
|
||||
|
||||
msgid "Current"
|
||||
msgstr "当前"
|
||||
|
||||
msgid "Option"
|
||||
msgstr "选项"
|
||||
|
||||
msgid "Config"
|
||||
msgstr "配置"
|
||||
|
||||
msgid "Item"
|
||||
msgstr "项目"
|
||||
|
||||
msgid "Voltage"
|
||||
msgstr "电压"
|
||||
|
||||
msgid "Status"
|
||||
msgstr "状态"
|
||||
|
||||
msgid "Abnormal"
|
||||
msgstr "异常"
|
||||
|
||||
msgid "Normal"
|
||||
msgstr "正常"
|
||||
|
||||
msgid "Low"
|
||||
msgstr "偏低"
|
||||
|
||||
msgid "Somewhat High"
|
||||
msgstr "偏高"
|
||||
|
||||
msgid "Excessively High"
|
||||
msgstr "过高"
|
||||
|
||||
msgid "AT Command"
|
||||
msgstr "AT命令"
|
||||
|
||||
msgid "Quick Option"
|
||||
msgstr "快捷选项"
|
||||
|
||||
msgid "Auto"
|
||||
msgstr "自动"
|
||||
|
||||
msgid "Custom"
|
||||
msgstr "自定义"
|
||||
|
||||
msgid "Quick Commands"
|
||||
msgstr "快捷命令"
|
||||
|
||||
msgid "Enter Command"
|
||||
msgstr "输入命令"
|
||||
|
||||
msgid "Apply"
|
||||
msgstr "应用"
|
||||
|
||||
msgid "Send"
|
||||
msgstr "发送"
|
||||
|
||||
msgid "Clean"
|
||||
msgstr "清空"
|
||||
|
||||
msgid "Response"
|
||||
msgstr "响应"
|
||||
|
||||
msgid "Return to old page"
|
||||
msgstr "返回旧界面"
|
||||
|
||||
msgid "Return to modem debug"
|
||||
msgstr "返回模组调试界面"
|
||||
|
||||
msgid "Custom quick commands"
|
||||
msgstr "自定义快捷命令"
|
||||
|
||||
msgid "Customize your quick commands"
|
||||
msgstr "自定义你的快捷命令"
|
||||
|
||||
msgid "Custom Commands"
|
||||
msgstr "自定义命令"
|
||||
|
||||
msgid "Serial Number"
|
||||
msgstr "序号"
|
||||
|
||||
msgid "Description"
|
||||
msgstr "描述"
|
||||
|
||||
msgid "Command"
|
||||
msgstr "命令"
|
||||
|
||||
msgid "Modem Information"
|
||||
msgstr "模组信息"
|
||||
|
||||
msgid "No modems found"
|
||||
msgstr "没有找到模组"
|
||||
|
||||
msgid "Enable dial configurations"
|
||||
msgstr "启用拨号配置"
|
||||
|
||||
msgid "General Settings"
|
||||
msgstr "通用配置"
|
||||
|
||||
msgid "Advanced Settings"
|
||||
msgstr "高级配置"
|
||||
|
||||
msgid "Remarks"
|
||||
msgstr "备注"
|
||||
|
||||
msgid "Mobile Network"
|
||||
msgstr "移动网络"
|
||||
|
||||
msgid "UNKNOWN"
|
||||
msgstr "未知"
|
||||
|
||||
msgid "Unknown"
|
||||
msgstr "未知"
|
||||
|
||||
msgid "unknown"
|
||||
msgstr "未知"
|
||||
|
||||
msgid "Mobile network not found"
|
||||
msgstr "未发现移动网络"
|
||||
|
||||
msgid "The network device was not found"
|
||||
msgstr "找不到网络设备"
|
||||
|
||||
msgid "Only display the modes available for the adaptation modem"
|
||||
msgstr "仅显示适配模组可用的拨号模式"
|
||||
|
||||
msgid "Config ID"
|
||||
msgstr "配置 ID"
|
||||
|
||||
msgid "Dial Tool"
|
||||
msgstr "拨号工具"
|
||||
|
||||
msgid "After switching the dialing tool, it may be necessary to restart the module or restart the router to recognize the module."
|
||||
msgstr "切换拨号工具后,可能需要重启模组或重启路由器才能识别模组。"
|
||||
|
||||
msgid "Auto Choose"
|
||||
msgstr "自动选择"
|
||||
|
||||
msgid "quectel-CM"
|
||||
msgstr "移远模组拨号工具"
|
||||
|
||||
msgid "mmcli"
|
||||
msgstr "调制解调器管理工具"
|
||||
|
||||
msgid "PDP Type"
|
||||
msgstr "网络类型"
|
||||
|
||||
msgid "Network Bridge"
|
||||
msgstr "网络桥接"
|
||||
|
||||
msgid "After checking, enable network interface bridge."
|
||||
msgstr "勾选后,启用网络接口桥接。"
|
||||
|
||||
msgid "APN"
|
||||
msgstr "接入点"
|
||||
|
||||
msgid "China Mobile"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "China Unicom"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "China Telecom"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "China Broadcast"
|
||||
msgstr "中国广电"
|
||||
|
||||
msgid "Skytone"
|
||||
msgstr "天际通"
|
||||
|
||||
msgid "Authentication Type"
|
||||
msgstr "认证类型"
|
||||
|
||||
msgid "PAP/CHAP (both)"
|
||||
msgstr "PAP/CHAP (均使用)"
|
||||
|
||||
msgid "NONE"
|
||||
msgstr "无"
|
||||
|
||||
msgid "PAP/CHAP Username"
|
||||
msgstr "PAP/CHAP 用户名"
|
||||
|
||||
msgid "PAP/CHAP Password"
|
||||
msgstr "PAP/CHAP 密码"
|
||||
|
||||
msgid "Message"
|
||||
msgstr "信息"
|
||||
|
||||
msgid "Base Information"
|
||||
msgstr "基本信息"
|
||||
|
||||
msgid "Manufacturer"
|
||||
msgstr "制造商"
|
||||
|
||||
msgid "Revision"
|
||||
msgstr "固件版本"
|
||||
|
||||
msgid "AT Port"
|
||||
msgstr "AT串口"
|
||||
|
||||
msgid "Temperature"
|
||||
msgstr "温度"
|
||||
|
||||
msgid "Update Time"
|
||||
msgstr "更新时间"
|
||||
|
||||
msgid "SIM Information"
|
||||
msgstr "SIM卡信息"
|
||||
|
||||
msgid "Unknown SIM card status"
|
||||
msgstr "未知SIM卡状态"
|
||||
|
||||
msgid "SIM card not inserted"
|
||||
msgstr "SIM卡未插入"
|
||||
|
||||
msgid "ISP"
|
||||
msgstr "运营商"
|
||||
|
||||
msgid "SIM Status"
|
||||
msgstr "SIM卡状态"
|
||||
|
||||
msgid "miss"
|
||||
msgstr "未插入"
|
||||
|
||||
msgid "locked"
|
||||
msgstr "锁定"
|
||||
|
||||
msgid "SIM Slot"
|
||||
msgstr "SIM卡卡槽"
|
||||
|
||||
msgid "SIM Number"
|
||||
msgstr "SIM卡号码"
|
||||
|
||||
msgid "IMEI"
|
||||
msgstr "国际移动设备识别码"
|
||||
|
||||
msgid "IMSI"
|
||||
msgstr "国际移动用户识别码"
|
||||
|
||||
msgid "ICCID"
|
||||
msgstr "集成电路卡识别码"
|
||||
|
||||
msgid "Network Information"
|
||||
msgstr "网络信息"
|
||||
|
||||
msgid "Network Type"
|
||||
msgstr "网络类型"
|
||||
|
||||
msgid "Tx Rate"
|
||||
msgstr "上传速率"
|
||||
|
||||
msgid "Rx Rate"
|
||||
msgstr "下载速率"
|
||||
|
||||
msgid "RSSI"
|
||||
msgstr "接收信号强度指示"
|
||||
|
||||
msgid "BER"
|
||||
msgstr "信道误码率"
|
||||
|
||||
msgid "Cell Information"
|
||||
msgstr "小区信息"
|
||||
|
||||
msgid "Network Mode"
|
||||
msgstr "网络模式"
|
||||
|
||||
msgid "NR5G-SA Mode"
|
||||
msgstr "NR5G-SA 模式"
|
||||
|
||||
msgid "EN-DC Mode"
|
||||
msgstr "EN-DC 模式"
|
||||
|
||||
msgid "LTE Mode"
|
||||
msgstr "LTE 模式"
|
||||
|
||||
msgid "WCDMA Mode"
|
||||
msgstr "WCDMA 模式"
|
||||
|
||||
msgid "MCC"
|
||||
msgstr "移动国家代码"
|
||||
|
||||
msgid "MNC"
|
||||
msgstr "移动网络代码"
|
||||
|
||||
msgid "Duplex Mode"
|
||||
msgstr "双工模式"
|
||||
|
||||
msgid "LAC"
|
||||
msgstr "位置区码"
|
||||
|
||||
msgid "Cell ID"
|
||||
msgstr "小区ID"
|
||||
|
||||
msgid "Physical Cell ID"
|
||||
msgstr "物理小区ID"
|
||||
|
||||
msgid "TAC"
|
||||
msgstr "跟踪区编码"
|
||||
|
||||
msgid "ARFCN"
|
||||
msgstr "绝对射频信道号"
|
||||
|
||||
msgid "EARFCN"
|
||||
msgstr "E-UTRA绝对射频信道号"
|
||||
|
||||
msgid "UARFCN"
|
||||
msgstr "UTRA绝对射频信道号"
|
||||
|
||||
msgid "Band"
|
||||
msgstr "频段"
|
||||
|
||||
msgid "Freq band indicator"
|
||||
msgstr "频带指示"
|
||||
|
||||
msgid "UL Bandwidth"
|
||||
msgstr "上行带宽"
|
||||
|
||||
msgid "DL Bandwidth"
|
||||
msgstr "下行带宽"
|
||||
|
||||
msgid "RSRP"
|
||||
msgstr "参考信号接收功率"
|
||||
|
||||
msgid "RSRQ"
|
||||
msgstr "参考信号接收质量"
|
||||
|
||||
msgid "RSSI"
|
||||
msgstr "接收信号强度指示"
|
||||
|
||||
msgid "SINR"
|
||||
msgstr "信号与干扰加噪声比"
|
||||
|
||||
msgid "RSSNR"
|
||||
msgstr "信号干扰比"
|
||||
|
||||
msgid "SCS"
|
||||
msgstr "NR子载波间隔"
|
||||
|
||||
msgid "CQI"
|
||||
msgstr "信道质量指示"
|
||||
|
||||
msgid "TX Power"
|
||||
msgstr "TX 功率"
|
||||
|
||||
msgid "PSC"
|
||||
msgstr "主扰码"
|
||||
|
||||
msgid "RAC"
|
||||
msgstr "路由区域码"
|
||||
|
||||
msgid "RSCP"
|
||||
msgstr "接收信号码功率"
|
||||
|
||||
msgid "每比特能量与干扰功率密度(干扰比)之比"
|
||||
msgstr "Eb/Io"
|
||||
|
||||
msgid "每比特能量与噪声功率密度(噪声比)之比"
|
||||
msgstr "Eb/No"
|
||||
|
||||
msgid "每码片能量与干扰功率密度(干扰比)之比"
|
||||
msgstr "Ec/Io"
|
||||
|
||||
msgid "每码片能量与噪声功率密度(噪声比)之比"
|
||||
msgstr "Ec/No"
|
||||
|
||||
msgid "Physical Channel"
|
||||
msgstr "物理信道"
|
||||
|
||||
msgid "Spreading Factor"
|
||||
msgstr "扩频因子"
|
||||
|
||||
msgid "Slot"
|
||||
msgstr "插槽格式"
|
||||
|
||||
msgid "Speech Code"
|
||||
msgstr "语音编码"
|
||||
|
||||
msgid "Compression Mode"
|
||||
msgstr "压缩模式"
|
||||
|
||||
msgid "RxLev"
|
||||
msgstr "接收信号功率"
|
||||
|
||||
msgid "CHN-CMCC"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "CMCC"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "46000"
|
||||
msgstr "中国移动"
|
||||
|
||||
msgid "CHN-UNICOM"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "UNICOM"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "CUCC"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "46001"
|
||||
msgstr "中国联通"
|
||||
|
||||
msgid "CHN-CT"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "CHN-TELECOM"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "CTCC"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "CT"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "46011"
|
||||
msgstr "中国电信"
|
||||
|
||||
msgid "Plugin Config"
|
||||
msgstr "插件配置"
|
||||
|
||||
msgid "Check and modify the plugin configuration"
|
||||
msgstr "查看和修改插件配置"
|
||||
|
||||
msgid "Modem Scan"
|
||||
msgstr "模组扫描"
|
||||
|
||||
msgid "Scan"
|
||||
msgstr "扫描"
|
||||
|
||||
msgid "Scaning modem..."
|
||||
msgstr "正在扫描中..."
|
||||
|
||||
msgid "The automatic configuration modem is triggered only at startup, otherwise, manual scanning is necessary"
|
||||
msgstr "自动配置模组只有在启动的时候才会触发,其他情况需要手动点击扫描"
|
||||
|
||||
msgid "Manual Configuration"
|
||||
msgstr "手动配置"
|
||||
|
||||
msgid "Enable the manual configuration of modem information"
|
||||
msgstr "启用手动配置模组信息"
|
||||
|
||||
msgid "(After enable, the automatic scanning function for modem information will be disabled)"
|
||||
msgstr "(启用后将禁用自动扫描模组信息功能)"
|
||||
|
||||
msgid "Plugin Info"
|
||||
msgstr "插件信息"
|
||||
|
||||
msgid "Check the version information of the plugin"
|
||||
msgstr "查看插件的版本信息"
|
||||
|
||||
msgid "Plugin Version"
|
||||
msgstr "插件版本"
|
||||
|
||||
msgid "Dial Tool Info"
|
||||
msgstr "拨号工具信息"
|
||||
|
||||
msgid "quectel-CM Version"
|
||||
msgstr "quectel-CM 版本"
|
||||
|
||||
msgid "modemmanager Version"
|
||||
msgstr "modemmanager 版本"
|
||||
|
||||
msgid "Modem General Driver Info"
|
||||
msgstr "模组通用信息"
|
||||
|
||||
msgid "Driver Type"
|
||||
msgstr "驱动类型"
|
||||
|
||||
msgid "Kernel Model"
|
||||
msgstr "内核模块"
|
||||
|
||||
msgid "USB Network"
|
||||
msgstr "USB网络"
|
||||
|
||||
msgid "Serial Port"
|
||||
msgstr "串口"
|
||||
|
||||
msgid "Loaded"
|
||||
msgstr "已加载"
|
||||
|
||||
msgid "Not loaded"
|
||||
msgstr "未加载"
|
||||
|
||||
msgid "Modem USB Driver Info"
|
||||
msgstr "模组USB驱动信息"
|
||||
|
||||
msgid "Modem PCIE Driver Info"
|
||||
msgstr "模组PCIE驱动信息"
|
||||
|
||||
msgid "General"
|
||||
msgstr "通用"
|
||||
|
||||
msgid "Private"
|
||||
msgstr "私有"
|
@ -1,7 +1,8 @@
|
||||
|
||||
config global 'global'
|
||||
option enable '1'
|
||||
option enable_dial '1'
|
||||
option modem_number '0'
|
||||
option manual_configuration '0'
|
||||
|
||||
config custom-commands
|
||||
option description '****************通用****************'
|
||||
|
@ -13,7 +13,7 @@ MODEM_RUNDIR="/var/run/modem"
|
||||
MODEM_RUN_CONFIG="${MODEM_RUNDIR}/config.cache"
|
||||
|
||||
#导入组件工具
|
||||
source "${SCRIPT_DIR}/modem_debug.sh"
|
||||
source "${SCRIPT_DIR}/modem_scan.sh"
|
||||
|
||||
#设置拨号模式
|
||||
# $1:拨号模式
|
||||
@ -557,7 +557,7 @@ stop_dial()
|
||||
#获取模组的拨号模式
|
||||
[ -z "${modem_no}" ] && return 0
|
||||
local mode=$(get_mode ${modem_no})
|
||||
[ -z "$mode" ] && return
|
||||
[ -z "$mode" ] || [ "$mode" = "unknown" ] && return
|
||||
|
||||
#根据不同的拨号模式停止拨号
|
||||
if [ "$mode" = "qmi" ]; then
|
||||
@ -615,9 +615,7 @@ dial()
|
||||
local mode
|
||||
while true; do
|
||||
mode=$(get_mode ${modem_no})
|
||||
if [ -n "$mode" ]; then
|
||||
break
|
||||
fi
|
||||
[ -n "$mode" ] && [ "$mode" != "unknown" ] && break
|
||||
sleep 5s
|
||||
done
|
||||
|
||||
@ -660,25 +658,97 @@ dial()
|
||||
# sleep 15
|
||||
}
|
||||
|
||||
#手动设置模组信息
|
||||
manual_set_modem_config()
|
||||
{
|
||||
local manual #手动配置
|
||||
local network #移动网络
|
||||
# local name #模组名称
|
||||
# local at_port #AT串口
|
||||
|
||||
config_get manual $1 manual
|
||||
config_get network $1 network
|
||||
# config_get name $1 name
|
||||
# config_get at_port $1 at_port
|
||||
|
||||
[ -z "$manual" ] || [ "$manual" = "0" ] && return
|
||||
|
||||
#获取网络设备路径
|
||||
local network_path="$(readlink -f /sys/class/net/${network})"
|
||||
|
||||
#只处理最上级的网络设备
|
||||
local count=$(echo "${network_path}" | grep -o "/net" | wc -l)
|
||||
[ "$count" -ge "2" ] && return
|
||||
|
||||
#判断路径是否带有usb(排除其他eth网络设备)
|
||||
if [[ "$network" = *"eth"* ]] && [[ "$network_path" != *"usb"* ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
#获取物理路径
|
||||
local physical_path=$(m_get_device_physical_path ${network_path})
|
||||
|
||||
#获取模组数量
|
||||
local modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||
#模组配置是否存在
|
||||
for i in $(seq 0 $((modem_number-1))); do
|
||||
local modem_network=$(uci -q get modem.modem${i}.network)
|
||||
if [ "$modem_network" = "$network" ]; then
|
||||
# 配置已存在,退出
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
#设置模组硬件配置
|
||||
m_set_modem_hardware_config "${physical_path}"
|
||||
|
||||
#设置模组网络配置
|
||||
m_set_network_config "${network}" "${physical_path}"
|
||||
|
||||
#设置模组串口
|
||||
m_set_modem_port "${physical_path}"
|
||||
|
||||
#获取模组数量
|
||||
local modem_number=$(uci -q get modem.@global[0].modem_number)
|
||||
#获取模组序号
|
||||
local modem_no
|
||||
for i in $(seq 0 $((modem_number-1))); do
|
||||
local modem_path=$(uci -q get modem.modem${i}.path)
|
||||
if [ "$modem_path" = "$physical_path" ]; then
|
||||
modem_no="${i}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
#设置模组配置(由于AT串口已经提前设置,则跳过了模组配置,这里需要手动执行一次)
|
||||
m_set_modem_config "${modem_no}" "${physical_path}"
|
||||
uci commit modem
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "modem"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enable=$(uci -q get modem.@global[0].enable)
|
||||
if [ "$enable" = "0" ]; then
|
||||
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 "config"
|
||||
#手动设置模组信息
|
||||
config_foreach manual_set_modem_config "modem-device"
|
||||
#加载拨号配置
|
||||
config_foreach dial "dial-config"
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
#删除记录文件
|
||||
rm -rf /tmp/modem
|
||||
rm -rf ${MODEM_RUN_CONFIG}
|
||||
#停止qmi、mbim拨号
|
||||
killall quectel-CM >/dev/null 2>&1
|
||||
#停止gobinet、ecm、rndis、ncm拨号
|
||||
|
@ -3,8 +3,9 @@
|
||||
|
||||
uci -q get modem.global >/dev/null || uci -q batch <<-EOF >/dev/null
|
||||
set modem.global=global
|
||||
set modem.global.enable=1
|
||||
set modem.@global[0].enable_dial=1
|
||||
set modem.@global[0].modem_number=0
|
||||
set modem.@global[0].manual_configuration=0
|
||||
commit modem
|
||||
EOF
|
||||
|
||||
|
@ -10,7 +10,6 @@ modem_init()
|
||||
{
|
||||
m_log "info" "Clearing all modem configurations"
|
||||
#清空模组配置
|
||||
local modem_no
|
||||
local modem_count=$(uci -q get modem.@global[0].modem_number)
|
||||
for i in $(seq 0 $((modem_count-1))); do
|
||||
#删除该模组的配置
|
||||
|
@ -207,8 +207,8 @@ modem_network_task()
|
||||
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Start network task" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
|
||||
while true; do
|
||||
#全局
|
||||
local enable=$(uci -q get modem.@global[0].enable)
|
||||
if [ "$enable" != "1" ]; then
|
||||
local enable_dial=$(uci -q get modem.@global[0].enable_dial)
|
||||
if [ "$enable_dial" != "1" ]; then
|
||||
#输出日志
|
||||
echo "[$(date +"%Y-%m-%d %H:%M:%S")] The dialing configuration has been disabled, this network task quit" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
|
||||
break
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#脚本目录
|
||||
SCRIPT_DIR="/usr/share/modem"
|
||||
source "${SCRIPT_DIR}/modem_debug.sh"
|
||||
source "${SCRIPT_DIR}/modem_util.sh"
|
||||
|
||||
#获取设备物理地址
|
||||
# $1:网络设备或串口
|
||||
@ -15,281 +15,67 @@ get_device_physical_path()
|
||||
echo "$device_physical_path"
|
||||
}
|
||||
|
||||
#获取设备总线地址
|
||||
# $1:网络设备
|
||||
# $2:USB或者PCIE标志
|
||||
get_device_bus_path()
|
||||
{
|
||||
local device_physical_path="$(get_device_physical_path $1)"
|
||||
|
||||
local device_bus_path="$device_physical_path"
|
||||
if [ "$2" = "usb" ]; then
|
||||
#USB设备路径需要再获取上一层
|
||||
device_bus_path=$(dirname "$device_bus_path")
|
||||
|
||||
#判断路径是否带有usb(排除其他eth网络设备)
|
||||
if [[ "$device_physical_path" = *"usb"* ]]; then
|
||||
echo "$device_bus_path"
|
||||
fi
|
||||
elif [ "$2" = "pcie" ]; then
|
||||
echo "$device_bus_path"
|
||||
fi
|
||||
}
|
||||
|
||||
#获取USB串口总线地址
|
||||
# $1:USB串口
|
||||
get_usb_device_bus_path()
|
||||
{
|
||||
local device_physical_path="$(get_device_physical_path $1)"
|
||||
|
||||
#获取父路径的上两层
|
||||
local tmp=$(dirname "$device_physical_path")
|
||||
local device_bus_path=$(dirname $tmp)
|
||||
|
||||
echo "$device_bus_path"
|
||||
}
|
||||
|
||||
#获取PCIE串口总线地址
|
||||
# $1:PCIE串口
|
||||
get_pcie_device_bus_path()
|
||||
{
|
||||
local device_physical_path="$(get_device_physical_path $1)"
|
||||
|
||||
local device_bus_path="$device_physical_path"
|
||||
if [ "$device_name" != "mhi_BHI" ]; then #未考虑多个mhi_BHI的情况
|
||||
device_bus_path=$(dirname "$device_physical_path")
|
||||
fi
|
||||
|
||||
echo "$device_bus_path"
|
||||
}
|
||||
|
||||
#设置模组配置
|
||||
# $1:模组序号
|
||||
# $2:设备数据接口
|
||||
# $3:总线地址
|
||||
# $1:网络设备
|
||||
# $2:网络设备系统路径
|
||||
set_modem_config()
|
||||
{
|
||||
#判断地址是否为net
|
||||
local path=$(basename "$3")
|
||||
if [ "$path" = "net" ]; then
|
||||
local network="$(basename $sys_network)"
|
||||
local network_path="$(readlink -f $sys_network)"
|
||||
|
||||
#只处理最上级的网络设备
|
||||
local count=$(echo "${network_path}" | grep -o "/net" | wc -l)
|
||||
[ "$count" -ge "2" ] && return
|
||||
|
||||
#判断路径是否带有usb(排除其他eth网络设备)
|
||||
if [[ "$network" = *"eth"* ]] && [[ "$network_path" != *"usb"* ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
#处理获取到的地址
|
||||
# local substr="${3/\/sys\/devices\//}" #x86平台,替换掉/sys/devices/
|
||||
# local substr="${3/\/sys\/devices\/platform\//}" #arm平台,替换掉/sys/devices/platform/
|
||||
# local substr="${3/\/sys\/devices\/platform\/soc\//}" #arm平台,替换掉/sys/devices/platform/soc/
|
||||
local substr=$3 #路径存在不同,暂不处理
|
||||
#获取物理路径
|
||||
local device_physical_path=$(m_get_device_physical_path ${network_path})
|
||||
#设置物理设备
|
||||
m_set_physical_device "scan" "${network}" "${device_physical_path}"
|
||||
|
||||
#获取网络接口
|
||||
local net_path="$(find $substr -name net | sed -n '1p')"
|
||||
local net_net_interface_path=$net_path
|
||||
|
||||
#子目录下存在网络接口
|
||||
local net_count="$(find $substr -name net | wc -l)"
|
||||
if [ "$net_count" = "2" ]; then
|
||||
net_net_interface_path="$(find $substr -name net | sed -n '2p')"
|
||||
fi
|
||||
local network=$(ls $net_path)
|
||||
local network_interface=$(ls $net_net_interface_path)
|
||||
|
||||
#设置配置
|
||||
uci set modem.modem$1="modem-device"
|
||||
uci set modem.modem$1.data_interface="$2"
|
||||
uci set modem.modem$1.path="$substr"
|
||||
uci set modem.modem$1.network="$network"
|
||||
uci set modem.modem$1.network_interface="$network_interface"
|
||||
|
||||
#增加模组计数
|
||||
modem_count=$((modem_count + 1))
|
||||
#启用拨号
|
||||
enable_dial "${network}"
|
||||
}
|
||||
|
||||
#设置模组串口配置
|
||||
# $modem_count:模组计数
|
||||
# $1:总线地址
|
||||
# $2:串口
|
||||
set_port_config()
|
||||
#设置系统网络设备
|
||||
# $1:系统网络设备列表
|
||||
set_sys_network_config()
|
||||
{
|
||||
#处理获取到的地址
|
||||
# local substr="${1/\/sys\/devices\//}" #x86平台,替换掉/sys/devices/
|
||||
# local substr="${1/\/sys\/devices\/platform\//}" #arm平台,替换掉/sys/devices/platform/
|
||||
# local substr="${1/\/sys\/devices\/platform\/soc\//}" #arm平台,替换掉/sys/devices/platform/soc/
|
||||
local substr=$1 #路径存在不同,暂不处理
|
||||
local sys_networks="$1"
|
||||
|
||||
for i in $(seq 0 $((modem_count-1))); do
|
||||
#当前模组的物理地址
|
||||
local path=$(uci -q get modem.modem$i.path)
|
||||
if [ "$substr" = "$path" ]; then
|
||||
#添加新的串口
|
||||
uci add_list modem.modem${i}.ports="$2"
|
||||
#写入到配置中(解决老版本luci问题)
|
||||
uci commit modem
|
||||
#判断是不是AT串口
|
||||
local response="$(sh ${SCRIPT_DIR}/modem_at.sh $2 'ATI')"
|
||||
local str1="No" #No response from modem.
|
||||
local str2="failed"
|
||||
if [[ "$response" != *"$str1"* ]] && [[ "$response" != *"$str2"* ]] && [ -n "$response" ]; then
|
||||
#原先的AT串口会被覆盖掉(是否需要加判断)
|
||||
uci set modem.modem${i}.at_port="$2"
|
||||
set_modem_info_config "$i" "$2"
|
||||
fi
|
||||
break
|
||||
fi
|
||||
for sys_network in $sys_networks; do
|
||||
local network="$(basename $sys_network)"
|
||||
set_modem_config "${network}" "${sys_network}"
|
||||
done
|
||||
}
|
||||
|
||||
#设置模组信息(名称、制造商、拨号模式)
|
||||
# $modem_count:模组计数
|
||||
# $1:模组序号
|
||||
# $2:AT串口
|
||||
set_modem_info_config()
|
||||
{
|
||||
#获取数据接口
|
||||
local data_interface=$(uci -q get modem.modem$1.data_interface)
|
||||
|
||||
#获取支持的模组
|
||||
local modem_support=$(cat ${SCRIPT_DIR}/modem_support.json)
|
||||
|
||||
#获取模组名
|
||||
local at_response=$(sh ${SCRIPT_DIR}/modem_at.sh $2 "AT+CGMM" | sed -n '2p' | sed 's/\r//g' | tr 'A-Z' 'a-z')
|
||||
|
||||
#获取模组信息
|
||||
local modem_info=$(echo $modem_support | jq '.modem_support.'$data_interface'."'$at_response'"')
|
||||
|
||||
local modem_name
|
||||
local manufacturer
|
||||
local platform
|
||||
local mode
|
||||
local modes
|
||||
if [ "$modem_info" = "null" ]; then
|
||||
modem_name="unknown"
|
||||
manufacturer="unknown"
|
||||
platform="unknown"
|
||||
mode="unknown"
|
||||
modes="qmi gobinet ecm mbim rndis ncm"
|
||||
else
|
||||
#获取模组名
|
||||
modem_name="$at_response"
|
||||
#获取制造商
|
||||
manufacturer=$(echo $modem_info | jq -r '.manufacturer')
|
||||
#获取平台
|
||||
platform=$(echo $modem_info | jq -r '.platform')
|
||||
#获取当前的拨号模式
|
||||
mode=$(source ${SCRIPT_DIR}/$manufacturer.sh && "$manufacturer"_get_mode $2 $platform)
|
||||
#获取支持的拨号模式
|
||||
modes=$(echo $modem_info | jq -r '.modes[]')
|
||||
fi
|
||||
|
||||
#设置模组名
|
||||
uci set modem.modem$1.name="$modem_name"
|
||||
#设置制造商
|
||||
uci set modem.modem$1.manufacturer="$manufacturer"
|
||||
#设置平台
|
||||
uci set modem.modem$1.platform="$platform"
|
||||
#设置当前的拨号模式
|
||||
uci set modem.modem$1.mode="$mode"
|
||||
#设置支持的拨号模式
|
||||
uci -q del modem.modem$1.modes #删除原来的拨号模式列表
|
||||
for mode in $modes; do
|
||||
uci add_list modem.modem$1.modes="$mode"
|
||||
done
|
||||
}
|
||||
|
||||
#设置模组数量
|
||||
set_modem_count()
|
||||
{
|
||||
uci set modem.@global[0].modem_number="$modem_count"
|
||||
|
||||
#数量为0时,清空模组列表
|
||||
if [ "$modem_count" = "0" ]; then
|
||||
for i in $(seq 0 $((modem_count-1))); do
|
||||
uci -q del modem.modem${i}
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
#设置USB模组基本信息
|
||||
# $1:USB网络设备
|
||||
set_usb_modem_config()
|
||||
{
|
||||
for network in $usb_network; do
|
||||
local usb_device_bus_path=$(get_device_bus_path $network "usb")
|
||||
if [ -z "$usb_device_bus_path" ]; then
|
||||
continue
|
||||
else
|
||||
set_modem_config $modem_count "usb" $usb_device_bus_path
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#设置PCIE模组基本信息
|
||||
# $1:PCIE网络设备
|
||||
set_pcie_modem_config()
|
||||
{
|
||||
for network in $pcie_network; do
|
||||
local pcie_device_bus_path=$(get_device_bus_path $network "pcie")
|
||||
if [ -z "$pcie_device_bus_path" ]; then
|
||||
continue
|
||||
else
|
||||
set_modem_config $modem_count "pcie" $pcie_device_bus_path
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
#模组计数
|
||||
modem_count=0
|
||||
#模组支持文件
|
||||
modem_support_file="${SCRIPT_DIR}/modem_support"
|
||||
#设置模组信息
|
||||
modem_scan()
|
||||
{
|
||||
#初始化
|
||||
modem_count=0
|
||||
########设置模组基本信息########
|
||||
#模组配置初始化
|
||||
sh "${SCRIPT_DIR}/modem_init.sh"
|
||||
|
||||
#发起模组添加事件
|
||||
#USB
|
||||
local usb_network
|
||||
usb_network="$(find /sys/class/net -name usb*)" #ECM RNDIS NCM
|
||||
set_usb_modem_config "$usb_network"
|
||||
usb_network="$(find /sys/class/net -name wwan*)" #QMI MBIM
|
||||
set_usb_modem_config "$usb_network"
|
||||
usb_network="$(find /sys/class/net -name eth*)" #RNDIS
|
||||
set_usb_modem_config "$usb_network"
|
||||
local sys_network
|
||||
sys_network="$(find /sys/class/net -name usb*)" #ECM RNDIS NCM
|
||||
set_sys_network_config "$sys_network"
|
||||
sys_network="$(find /sys/class/net -name wwan*)" #QMI MBIM
|
||||
set_sys_network_config "$sys_network"
|
||||
sys_network="$(find /sys/class/net -name eth*)" #RNDIS
|
||||
set_sys_network_config "$sys_network"
|
||||
|
||||
#PCIE
|
||||
local pcie_network
|
||||
pcie_network="$(find /sys/class/net -name mhi_hwip*)" #(通用mhi驱动)
|
||||
set_pcie_modem_config "$pcie_network"
|
||||
pcie_network="$(find /sys/class/net -name rmnet_mhi*)" #(制造商mhi驱动)
|
||||
set_pcie_modem_config "$pcie_network"
|
||||
sys_network="$(find /sys/class/net -name mhi_hwip*)" #(通用mhi驱动)
|
||||
set_sys_network_config "$sys_network"
|
||||
sys_network="$(find /sys/class/net -name rmnet_mhi*)" #(制造商mhi驱动)
|
||||
set_sys_network_config "$sys_network"
|
||||
|
||||
########设置模组串口########
|
||||
#清除原串口配置
|
||||
for i in $(seq 0 $((modem_count-1))); do
|
||||
uci -q del modem.modem$i.ports
|
||||
done
|
||||
#USB串口
|
||||
local usb_port=$(find /dev -name ttyUSB*)
|
||||
for port in $usb_port; do
|
||||
local usb_port_device_bus_path="$(get_usb_device_bus_path $port)"
|
||||
set_port_config $usb_port_device_bus_path $port
|
||||
done
|
||||
#PCIE串口
|
||||
local pcie_port
|
||||
pcie_port=$(find /dev -name wwan*)
|
||||
for port in $pcie_port; do
|
||||
local pcie_port_device_bus_path="$(get_pcie_device_bus_path $port)"
|
||||
set_port_config $pcie_port_device_bus_path $port
|
||||
done
|
||||
pcie_port=$(find /dev -name mhi*)
|
||||
for port in $pcie_port; do
|
||||
local pcie_port_device_bus_path="$(get_pcie_device_bus_path $port)"
|
||||
set_port_config $pcie_port_device_bus_path $port
|
||||
done
|
||||
########设置模组数量########
|
||||
set_modem_count
|
||||
|
||||
#写入到配置中
|
||||
uci commit modem
|
||||
echo "modem scan complete"
|
||||
}
|
||||
|
||||
#测试时打开
|
||||
|
@ -11,8 +11,8 @@ modem_scan_task()
|
||||
{
|
||||
sleep 8s #刚开机需要等待移动网络出来
|
||||
while true; do
|
||||
enable=$(uci -q get modem.@global[0].enable)
|
||||
if [ "$enable" = "1" ]; then
|
||||
enable_dial=$(uci -q get modem.@global[0].enable_dial)
|
||||
if [ "$enable_dial" = "1" ]; then
|
||||
#扫描模块
|
||||
debug "开启模块扫描任务"
|
||||
modem_scan
|
||||
|
@ -123,7 +123,7 @@ m_get_physical_path_status()
|
||||
[ -f "${MODEM_PHYSICAL_DEVICE_CACHE}" ] || return
|
||||
|
||||
#获取状态(不包含注释并且包含physical_path的行,获取以,分割的第二个字符串)
|
||||
awk -v physical_path="${physical_path}" -F',' '!/^#/ && $0 ~ physical_path { print $3 }' "${MODEM_PHYSICAL_DEVICE_CACHE}"
|
||||
awk -v physical_path="${physical_path}" -F',' '!/^#/ && $0 ~ physical_path { print $2 }' "${MODEM_PHYSICAL_DEVICE_CACHE}"
|
||||
}
|
||||
|
||||
#设置设备物理路径状态
|
||||
@ -243,7 +243,10 @@ m_set_modem_hardware_config()
|
||||
|
||||
#是否是第一次添加(初始化模组)
|
||||
local count=$(grep -o "processed" ${MODEM_PHYSICAL_DEVICE_CACHE} | wc -l)
|
||||
[ "$count" -le "0" ] && {
|
||||
#是否开启手动配置
|
||||
local manual_configuration=$(uci -q get modem.@global[0].manual_configuration)
|
||||
[ "$count" = "0" ] && [ "$manual_configuration" = "0" ] && {
|
||||
#模组配置初始化
|
||||
sh "${SCRIPT_DIR}/modem_init.sh"
|
||||
}
|
||||
|
||||
@ -316,6 +319,11 @@ m_set_usb_device()
|
||||
# m_set_modem_hardware_config "${physical_path}"
|
||||
|
||||
elif [ "$action" = "remove" ]; then
|
||||
|
||||
#手动配置
|
||||
local manual_configuration=$(uci -q get modem.@global[0].manual_configuration)
|
||||
[ "${manual_configuration}" = "1" ] && return
|
||||
|
||||
#删除模组配置
|
||||
m_del_modem_config "${physical_path}"
|
||||
fi
|
||||
@ -403,8 +411,11 @@ m_set_modem_config()
|
||||
local at_port=$(uci -q get modem.modem${modem_no}.at_port)
|
||||
|
||||
#获取模组名称
|
||||
local at_command="AT+CGMM?"
|
||||
local modem_name=$(at ${at_port} ${at_command} | grep "+CGMM: " | awk -F'"' '{print $2}' | tr 'A-Z' 'a-z')
|
||||
local modem_name=$(uci -q get modem.modem${modem_no}.name)
|
||||
[ -z "$modem_name" ] && {
|
||||
local at_command="AT+CGMM?"
|
||||
modem_name=$(at ${at_port} ${at_command} | grep "+CGMM: " | awk -F'"' '{print $2}' | tr 'A-Z' 'a-z')
|
||||
}
|
||||
|
||||
#获取模组支持列表
|
||||
local modem_support=$(cat ${SCRIPT_DIR}/modem_support.json)
|
||||
@ -442,6 +453,7 @@ 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 -q del modem.modem${modem_no}.modes #删除原来的拨号模式列表
|
||||
for mode in $modes; do
|
||||
uci add_list modem.modem${modem_no}.modes="${mode}"
|
||||
done
|
||||
@ -633,10 +645,10 @@ enable_dial()
|
||||
local i=0
|
||||
while true; do
|
||||
#查看该网络设备的配置是否启用
|
||||
local modem_network=$(uci -q get modem.@config[${i}].network)
|
||||
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.@config[${i}].enable)
|
||||
local enable=$(uci -q get modem.@dial-config[${i}].enable)
|
||||
if [ "$enable" = "1" ]; then
|
||||
service modem reload
|
||||
break
|
||||
@ -655,12 +667,12 @@ disable_dial()
|
||||
local i=0
|
||||
while true; do
|
||||
#查看该网络设备的配置是否启用
|
||||
local modem_network=$(uci -q get modem.@config[${i}].network)
|
||||
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.@config[${i}].enable)
|
||||
local enable=$(uci -q get modem.@dial-config[${i}].enable)
|
||||
if [ "$enable" = "1" ]; then
|
||||
uci set modem.@config[${i}].enable=0
|
||||
uci set modem.@dial-config[${i}].enable=0
|
||||
uci commit modem
|
||||
service modem reload
|
||||
break
|
||||
@ -743,7 +755,7 @@ m_set_modem_port()
|
||||
}
|
||||
|
||||
#设置物理设备
|
||||
# $1:事件行为(add,remove,bind)
|
||||
# $1:事件行为(add,remove,bind,scan)
|
||||
# $2:网络设备
|
||||
# $3:物理路径
|
||||
m_set_physical_device()
|
||||
@ -770,6 +782,16 @@ m_set_physical_device()
|
||||
elif [ "$action" = "remove" ]; then
|
||||
#删除模组配置
|
||||
m_del_modem_config "${physical_path}"
|
||||
elif [ "$action" = "scan" ]; then
|
||||
|
||||
#设置模组硬件配置
|
||||
m_set_modem_hardware_config "${physical_path}"
|
||||
|
||||
#设置模组网络配置
|
||||
m_set_network_config "${network}" "${physical_path}"
|
||||
|
||||
#设置模组串口
|
||||
m_set_modem_port "${physical_path}"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -797,6 +819,10 @@ m_set_network_device()
|
||||
#上报事件
|
||||
m_report_event "${action}" "net" "${network}" "${network_path}"
|
||||
|
||||
#手动配置
|
||||
local manual_configuration=$(uci -q get modem.@global[0].manual_configuration)
|
||||
[ "${manual_configuration}" = "1" ] && return
|
||||
|
||||
if [ "$action" = "add" ]; then
|
||||
|
||||
if [ "$data_interface" = "usb" ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user