From a05c68c8faeba983073b66576e92acb9b637b621 Mon Sep 17 00:00:00 2001 From: ling <1042585959@qq.com> Date: Thu, 9 May 2024 20:57:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- applications/luci-app-modem/Makefile | 12 +- applications/luci-app-modem/README.md | 4 + .../luasrc/controller/modem.lua | 57 +- .../luasrc/model/cbi/modem/modem_config.lua | 17 +- .../luasrc/model/cbi/modem/plugin_config.lua | 20 +- .../model/cbi/modem/quick_commands_config.lua | 6 +- .../luasrc/view/modem/at_command_old.htm | 21 +- .../view/modem/hide_manual_config_modem.htm | 19 + .../luasrc/view/modem/modem_debug.htm | 45 +- .../luasrc/view/modem/modem_info.htm | 28 +- .../luasrc/view/modem/modem_scan.htm | 9 +- .../luasrc/view/modem/modem_status.htm | 7 +- .../luasrc/view/modem/plugin_info.htm | 28 +- applications/luci-app-modem/po/zh-cn/modem.po | 18 + .../luci-app-modem/po/zh_Hans/modem.po | 18 + .../root/etc/config/custom_at_commands | 332 +++++++ .../luci-app-modem/root/etc/config/modem | 246 +----- .../luci-app-modem/root/etc/init.d/modem | 35 +- .../root/usr/share/modem/at_commands.json | 164 ++++ .../usr/share/modem/custom_at_commands.json | 64 -- .../root/usr/share/modem/fibocom.sh | 94 +- .../usr/share/modem/fibocom_at_commands.json | 34 - .../root/usr/share/modem/meig.sh | 835 ++++++++++++++++++ .../root/usr/share/modem/modem_debug.sh | 1 + .../root/usr/share/modem/modem_info.sh | 21 +- .../usr/share/modem/modem_network_task.sh | 8 +- .../root/usr/share/modem/modem_support.json | 20 +- .../root/usr/share/modem/modem_util.sh | 8 +- .../root/usr/share/modem/quectel.sh | 129 +-- .../usr/share/modem/quectel_at_commands.json | 42 - 30 files changed, 1756 insertions(+), 586 deletions(-) create mode 100644 applications/luci-app-modem/luasrc/view/modem/hide_manual_config_modem.htm create mode 100644 applications/luci-app-modem/root/etc/config/custom_at_commands create mode 100644 applications/luci-app-modem/root/usr/share/modem/at_commands.json delete mode 100644 applications/luci-app-modem/root/usr/share/modem/custom_at_commands.json delete mode 100644 applications/luci-app-modem/root/usr/share/modem/fibocom_at_commands.json create mode 100644 applications/luci-app-modem/root/usr/share/modem/meig.sh delete mode 100644 applications/luci-app-modem/root/usr/share/modem/quectel_at_commands.json diff --git a/applications/luci-app-modem/Makefile b/applications/luci-app-modem/Makefile index d58ae76..7bedbe6 100644 --- a/applications/luci-app-modem/Makefile +++ b/applications/luci-app-modem/Makefile @@ -6,14 +6,22 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-modem LUCI_TITLE:=LuCI support for Modem LUCI_PKGARCH:=all -PKG_VERSION:=1.4.3 +PKG_VERSION:=1.4.4 PKG_LICENSE:=GPLv3 PKG_LINCESE_FILES:=LICENSE PKF_MAINTAINER:=Siriling -LUCI_DEPENDS:=+luci-compat \ +LUCI_DEPENDS:=+luci-compat +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm \ + +kmod-usb-net-qmi-wwan +kmod-usb-net-rndis +kmod-usb-serial-qualcomm \ + +kmod-usb-net-sierrawireless +kmod-usb-ohci +kmod-usb-serial \ + +kmod-usb-serial-option +kmod-usb-wdm \ + +kmod-usb2 +kmod-usb3 \ + +kmod-usb-net-cdc-mbim \ +usbutils \ + +kmod-pcie_mhi \ +pciutils \ +quectel-CM-5G \ + +modemmanager \ + +luci-proto-modemmanager \ +sms-tool \ +jq \ diff --git a/applications/luci-app-modem/README.md b/applications/luci-app-modem/README.md index b288eff..f3cf791 100644 --- a/applications/luci-app-modem/README.md +++ b/applications/luci-app-modem/README.md @@ -33,6 +33,7 @@ | 移远通信 | RM500Q-GL | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | | 移远通信 | RM502Q-AE | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | | 移远通信 | RM502Q-GL | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | +| 移远通信 | RM505Q-AE | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | | 移远通信 | RM520N-CN | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | | 移远通信 | RM520N-GL | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | | 移远通信 | RM500Q-GL | 高通 | PCIE | RMNET,MBIM | @@ -44,3 +45,6 @@ | 广和通 | FM150-AE-01,FM150-AE-11,FM150-AE-21,FM150-NA-01 | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | | 广和通 | FM350-GL | 联发科 | PCIE | MBIM | | 广和通 | FM150-AE-00,FM150-AE-10,FM150-AE-20,FM150-NA-00 | 高通 | PCIE | QMI | +| 美格智能 | SRM815 | 高通 | USB | ECM,MBIM,RNDIS,NCM | +| 美格智能 | SRM825 | 高通 | USB | ECM,MBIM,RNDIS,NCM | +| 美格智能 | SRM825N | 高通 | USB | ECM,MBIM,RNDIS,NCM | diff --git a/applications/luci-app-modem/luasrc/controller/modem.lua b/applications/luci-app-modem/luasrc/controller/modem.lua index e486cfd..270df17 100644 --- a/applications/luci-app-modem/luasrc/controller/modem.lua +++ b/applications/luci-app-modem/luasrc/controller/modem.lua @@ -96,7 +96,6 @@ function getManufacturer(at_port) local manufacturer uci:foreach("modem", "modem-device", function (modem_device) - --设置模组AT串口 if at_port == modem_device["at_port"] then manufacturer=modem_device["manufacturer"] return true --跳出循环 @@ -134,7 +133,6 @@ function getModes(at_port) local modes uci:foreach("modem", "modem-device", function (modem_device) - --设置模组AT串口 if at_port == modem_device["at_port"] then modes=modem_device["modes"] return true --跳出循环 @@ -196,10 +194,10 @@ end at_port AT串口 manufacturer 制造商 ]] -function getModemMoreInfo(at_port,manufacturer,define_connect) +function getModemMoreInfo(at_port,manufacturer,platform,define_connect) --获取模组信息 - local command="sh "..script_path.."modem_info.sh".." "..at_port.." "..manufacturer.." "..define_connect + local command="sh "..script_path.."modem_info.sh".." "..at_port.." "..manufacturer.." "..platform.." "..define_connect local result=shell(command) --设置值 @@ -220,7 +218,7 @@ function getModemInfo() local modem_more_info if at_port then modem_device_info=getModemDeviceInfo(at_port) - modem_more_info=getModemMoreInfo(at_port,modem_device_info["manufacturer"],modem_device_info["define_connect"]) + modem_more_info=getModemMoreInfo(at_port,modem_device_info["manufacturer"],modem_device_info["platform"],modem_device_info["define_connect"]) end --设置信息 @@ -525,7 +523,6 @@ function getModeInfo() --获取值 local mode_info={} uci:foreach("modem", "modem-device", function (modem_device) - --设置模组AT串口 if at_port == modem_device["at_port"] then --获取制造商 @@ -680,25 +677,46 @@ function getQuickCommands() --获取AT串口 local at_port = http.formvalue("port") - --获取制造商 - local manufacturer=getManufacturer(at_port) + local manufacturer + local platform + uci:foreach("modem", "modem-device", function (modem_device) + if at_port == modem_device["at_port"] then + --获取制造商 + manufacturer=modem_device["manufacturer"] + --获取平台 + platform=modem_device["platform"] + return true --跳出循环 + end + end) --未适配模组时,快捷命令选项为自定义 - if manufacturer=="unknown" then + if manufacturer=="unknown" or manufacturer=="unknown" then quick_option="custom" end local quick_commands={} local commands={} if quick_option=="auto" then - --获取模组AT命令 - -- local command="source "..script_path.."modem_debug.sh && get_quick_commands "..quick_option.." "..manufacturer - local command="cat "..script_path..manufacturer.."_at_commands.json" - local result=shell(command) - quick_commands=json.parse(result) + --获取通用模组AT命令 + local command="jq '.quick_commands.general' \""..script_path.."at_commands.json\"" + local result=shell(command) + local general_commands=json.parse(result) + + --获取特殊模组AT命令 + command="jq '.quick_commands."..manufacturer.."."..platform.."' \""..script_path.."at_commands.json\"" + result=shell(command) + local special_commands=json.parse(result) + + --把通用命令和特殊命令整合到一起 + for i = 1, #special_commands do + local special_command = special_commands[i] + table.insert(general_commands,special_command) + end + + quick_commands["quick_commands"]=general_commands else - uci:foreach("modem", "custom-commands", function (custom_commands) + uci:foreach("custom_at_commands", "custom-commands", function (custom_commands) local command={} command[custom_commands["description"]]=custom_commands["command"] table.insert(commands,command) @@ -840,6 +858,7 @@ function getPluginInfo() -- 设置翻译 translation={} translation["Unknown"]=luci.i18n.translate("Unknown") + translation["Not installed"]=luci.i18n.translate("Not installed") translation["Loaded"]=luci.i18n.translate("Loaded") translation["Not loaded"]=luci.i18n.translate("Not loaded") @@ -850,19 +869,21 @@ function getPluginInfo() -- 获取拨号工具信息 local dial_tool_info={} - dial_tool_info["quectel-CM-5G"]="Unknown" - dial_tool_info["modemmanager"]="Unknown" + dial_tool_info["quectel-CM-5G"]="Not installed" + dial_tool_info["modemmanager"]="Not installed" setPluginVersionInfo(dial_tool_info) -- 获取通用驱动信息 local general_driver_info={} general_driver_info["usbnet.ko"]="Not loaded" - general_driver_info["qcserial.ko"]="Not loaded" + general_driver_info["option.ko"]="Not loaded" + -- general_driver_info["qcserial.ko"]="Not loaded" setModelStatus(general_driver_info) -- 获取模组USB驱动信息 local usb_driver_info={} usb_driver_info["qmi_wwan.ko"]="Not loaded" + usb_driver_info["GobiNet.ko"]="Not loaded" usb_driver_info["cdc_ether.ko"]="Not loaded" usb_driver_info["cdc_mbim.ko"]="Not loaded" usb_driver_info["rndis_host.ko"]="Not loaded" diff --git a/applications/luci-app-modem/luasrc/model/cbi/modem/modem_config.lua b/applications/luci-app-modem/luasrc/model/cbi/modem/modem_config.lua index e43e318..a132ac9 100644 --- a/applications/luci-app-modem/luasrc/model/cbi/modem/modem_config.lua +++ b/applications/luci-app-modem/luasrc/model/cbi/modem/modem_config.lua @@ -78,6 +78,15 @@ s = m:section(NamedSection, arg[1], "modem-device", "") s.addremove = false s.dynamic = false +-- 手动配置 +manual = s:option(Flag, "manual", translate("Manual")) +manual.default = "1" +manual.rmempty = false +-- uci:set('modem','modem-device','manual',1) + +-- 隐藏手动配置 +m:append(Template("modem/hide_manual_config_modem")) + -- 移动网络 mobile_network = s:option(ListValue, "network", translate("Mobile Network")) mobile_network.rmempty = true @@ -95,9 +104,11 @@ function getMobileNetwork() -- 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) + + -- 判断路径是否带有usb(排除其他eth网络设备) local flag="0" if network_path:find("eth") and not network_path:find("usb") then flag="1" @@ -120,7 +131,7 @@ getMobileNetwork() -- 模组名称 name = s:option(ListValue, "name", translate("Modem Name")) -name.placeholder = translate("Not Null") +name.placeholder = translate("Not null") name.rmempty = false -- 按照制造商给模组分类 @@ -142,7 +153,7 @@ end -- AT串口 at_port = s:option(Value, "at_port", translate("AT Port")) -at_port.placeholder = translate("Not Null") +at_port.placeholder = translate("Not null") at_port.rmempty = false return m diff --git a/applications/luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua b/applications/luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua index 1bfb9a1..dc80fa0 100644 --- a/applications/luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua +++ b/applications/luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua @@ -36,11 +36,17 @@ 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")) -- 将字符串转换为数字类型 + -- local modem_no=tonumber(uci.map:get("@global[0]","modem_number")) -- 将字符串转换为数字类型 + local modem_no=0 + local uci_tmp=luci.model.uci.cursor() + uci_tmp:foreach("modem", "modem-device", function (modem_device) + modem_no=modem_no+1 + end) + t="modem"..modem_no TypedSection.create(uci, t) -- 设置手动配置 - uci.map:set(t,"manual","1") + -- uci.map:set(t,"manual","1") luci.http.redirect(uci.extedit:format(t)) end @@ -61,10 +67,10 @@ o.cfgvalue = function(t, n) 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 +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 diff --git a/applications/luci-app-modem/luasrc/model/cbi/modem/quick_commands_config.lua b/applications/luci-app-modem/luasrc/model/cbi/modem/quick_commands_config.lua index 68cb9de..fabc3c9 100644 --- a/applications/luci-app-modem/luasrc/model/cbi/modem/quick_commands_config.lua +++ b/applications/luci-app-modem/luasrc/model/cbi/modem/quick_commands_config.lua @@ -5,7 +5,7 @@ local fs = require "nixio.fs" local http = require "luci.http" local uci = require "luci.model.uci".cursor() -m = Map("modem") +m = Map("custom_at_commands") m.title = translate("Custom quick commands") m.description = translate("Customize your quick commands") m.redirect = dispatcher.build_url("admin", "network", "modem","modem_debug") @@ -18,12 +18,12 @@ s.sortable = true s.template = "modem/tblsection_command" description = s:option(Value, "description", translate("Description")) -description.placeholder = translate("Not Null") +description.placeholder = translate("Not null") description.rmempty = true description.optional = false command = s:option(Value, "command", translate("Command")) -command.placeholder = translate("Not Null") +command.placeholder = translate("Not null") command.rmempty = true command.optional = false diff --git a/applications/luci-app-modem/luasrc/view/modem/at_command_old.htm b/applications/luci-app-modem/luasrc/view/modem/at_command_old.htm index 45ac551..000d10c 100644 --- a/applications/luci-app-modem/luasrc/view/modem/at_command_old.htm +++ b/applications/luci-app-modem/luasrc/view/modem/at_command_old.htm @@ -1,6 +1,21 @@ <%+header%> @@ -940,8 +957,8 @@ diff --git a/applications/luci-app-modem/luasrc/view/modem/modem_info.htm b/applications/luci-app-modem/luasrc/view/modem/modem_info.htm index c95041f..1c0f677 100644 --- a/applications/luci-app-modem/luasrc/view/modem/modem_info.htm +++ b/applications/luci-app-modem/luasrc/view/modem/modem_info.htm @@ -22,6 +22,22 @@ end } } */ + /* 消息样式 */ + #info_message { + text-align: left; + font-size: 1.8em; + } + + #info_message img { + vertical-align: middle; + } + + #info_message a { + color: rgb(61, 143, 173); + font-size: 50%; + } + + /* 信号样式 */ .signal-view { position: relative; min-width: 11rem; @@ -33,6 +49,7 @@ end overflow: hidden; } + /* 信号百分比样式 */ .signal-percent { width: 0; height: 100%; @@ -43,6 +60,7 @@ end border-bottom-right-radius: 4px; */ } + /* 信号文字内容样式 */ .signal-context{ font-family: monospace; /* font-size: 1em; */ @@ -597,7 +615,7 @@ end else //未适配模组 { // 更新提示信息 - document.getElementById("info_message").innerHTML="<%:Not adapted to this modem%>"; + document.getElementById("info_message").innerHTML='<%:Not adapted to this modem%><%:(Check adapted modem)%>'; // 显示提示信息 document.getElementById("cbi-info").style.display="block"; // 显示基本信息 @@ -803,11 +821,11 @@ end } ); - //无模块界面 + //无模组界面 function no_modems_view() { // 更新提示信息 - document.getElementById("info_message").innerHTML="<%:No modems found%>"; + document.getElementById("info_message").innerHTML='<%:No modems found%><%:(Check the reason)%>'; // 显示提示信息 document.getElementById("cbi-info").style.display="block"; // 隐藏基本信息 @@ -833,8 +851,8 @@ end diff --git a/applications/luci-app-modem/luasrc/view/modem/modem_scan.htm b/applications/luci-app-modem/luasrc/view/modem/modem_scan.htm index e2f9edd..5f3cf62 100644 --- a/applications/luci-app-modem/luasrc/view/modem/modem_scan.htm +++ b/applications/luci-app-modem/luasrc/view/modem/modem_scan.htm @@ -19,7 +19,7 @@ function modem_scan() disabled_function("modem_scan",true); //修改描述信息 - var description='<%:Loading%><%:Scaning modem...%>' + var description='<%:Loading%><%:Scaning modem...%>' document.getElementById('modem_scan_description').innerHTML=description; XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "modem_scan")%>', null, @@ -37,7 +37,12 @@ function modem_scan() //]]> - +
diff --git a/applications/luci-app-modem/luasrc/view/modem/modem_status.htm b/applications/luci-app-modem/luasrc/view/modem/modem_status.htm index 5fc1b22..364cd10 100644 --- a/applications/luci-app-modem/luasrc/view/modem/modem_status.htm +++ b/applications/luci-app-modem/luasrc/view/modem/modem_status.htm @@ -134,6 +134,11 @@
-
- <%:Loading%> +
+ <%:Loading%> <%:Loading modem%>...
-
- <%:Loading%> +
+ <%:Loading%> <%:Loading modem information%>...