diff --git a/luci-app-modem/Makefile b/luci-app-modem/Makefile index 75840fa..4211048 100644 --- a/luci-app-modem/Makefile +++ b/luci-app-modem/Makefile @@ -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.3 +PKG_VERSION:=1.4.4 PKG_LICENSE:=GPLv3 PKG_LINCESE_FILES:=LICENSE PKF_MAINTAINER:=Siriling @@ -15,7 +15,14 @@ LUCI_DEPENDS:=+luci-compat +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm \ +kmod-usb-net-sierrawireless +kmod-usb-ohci\ +kmod-usb-serial-option +kmod-usb-wdm \ +kmod-usb2 +kmod-usb3 \ + +kmod-usb-net-sierrawireless +kmod-usb-ohci \ + +kmod-usb-serial-option +kmod-usb-serial +kmod-usb-serial-qualcomm \ + +kmod-usb-net +kmod-usb-acm \ + +kmod-usb-wdm +kmod-usb-net-qmi-wwan \ + +kmod-usb-net-cdc-ether \ +kmod-usb-net-cdc-mbim \ + +kmod-usb-net-rndis \ + +kmod-usb-net-cdc-ncm +kmod-usb-net-huawei-cdc-ncm \ +usbutils \ +kmod-pcie_mhi \ +pciutils \ diff --git a/luci-app-modem/README.md b/luci-app-modem/README.md index b288eff..016297f 100644 --- a/luci-app-modem/README.md +++ b/luci-app-modem/README.md @@ -33,14 +33,19 @@ | 移远通信 | 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 | | 移远通信 | RG500Q-EA | 高通 | PCIE | RMNET,MBIM | | 移远通信 | RM502Q-GL | 高通 | PCIE | RMNET,MBIM | +| 移远通信 | RM520N-GL | 高通 | PCIE | RMNET,MBIM | | 移远通信 | RG520N-EU | 高通 | PCIE | RMNET,MBIM | | 广和通 | FM650-CN | 紫光展锐 | USB | ECM,MBIM,RNDIS,NCM | | 广和通 | FM350-GL | 联发科 | USB | RNDIS | | 广和通 | 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/luci-app-modem/luasrc/controller/modem.lua b/luci-app-modem/luasrc/controller/modem.lua index 99d0e87..c09a097 100644 --- a/luci-app-modem/luasrc/controller/modem.lua +++ b/luci-app-modem/luasrc/controller/modem.lua @@ -102,7 +102,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 --跳出循环 @@ -140,7 +139,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 --跳出循环 @@ -202,10 +200,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) --设置值 @@ -226,7 +224,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 --设置信息 @@ -531,7 +529,6 @@ function getModeInfo() --获取值 local mode_info={} uci:foreach("modem", "modem-device", function (modem_device) - --设置模组AT串口 if at_port == modem_device["at_port"] then --获取制造商 @@ -780,25 +777,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) @@ -940,6 +958,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") @@ -950,19 +969,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/luci-app-modem/luasrc/model/cbi/modem/modem_config.lua b/luci-app-modem/luasrc/model/cbi/modem/modem_config.lua index e43e318..a132ac9 100644 --- a/luci-app-modem/luasrc/model/cbi/modem/modem_config.lua +++ b/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/luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua b/luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua index 1bfb9a1..dc80fa0 100644 --- a/luci-app-modem/luasrc/model/cbi/modem/plugin_config.lua +++ b/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/luci-app-modem/luasrc/model/cbi/modem/quick_commands_config.lua b/luci-app-modem/luasrc/model/cbi/modem/quick_commands_config.lua index 68cb9de..fabc3c9 100644 --- a/luci-app-modem/luasrc/model/cbi/modem/quick_commands_config.lua +++ b/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/luci-app-modem/luasrc/view/modem/at_command_old.htm b/luci-app-modem/luasrc/view/modem/at_command_old.htm index 45ac551..000d10c 100644 --- a/luci-app-modem/luasrc/view/modem/at_command_old.htm +++ b/luci-app-modem/luasrc/view/modem/at_command_old.htm @@ -1,6 +1,21 @@ <%+header%> - + + -
-
-

- <%:Message%> -

- - - - -
-
- <%:Loading%> - <%:Loading modem%>... -
-
-
-
+
+
+

<%:Message%>

+ + + + +
+
+ <%:Loading%> + <%:Loading modem%>... +
+
+
+
- + + - - -
- -
- - - - - - - - - - - - -
- <%:Current%> - - <%:Config%> -
- +
+ + + + + + + + + + + + - - - -
<%:Current%><%:Config%>
+ - -
- -
-
-
- - + + + + + + -
-
-