├── .gitattributes ├── htdocs └── luci-static │ └── resources │ └── icons │ ├── sms.png │ └── sms2.png ├── luasrc ├── view │ └── modem │ │ ├── status.htm │ │ ├── hide_manual_config_modem.htm │ │ ├── hide_dial_config_id.htm │ │ ├── list_status.htm │ │ ├── modem_scan.htm │ │ ├── mode_info.htm │ │ ├── modem_status.htm │ │ ├── tblsection.htm │ │ ├── tblsection_command.htm │ │ ├── at_command_old.htm │ │ ├── modem_dial_log.htm │ │ └── plugin_info.htm └── model │ └── cbi │ └── modem │ ├── quick_commands_config.lua │ ├── plugin_config.lua │ ├── dial_overview.lua │ ├── modem_config.lua │ └── dial_config.lua ├── root ├── etc │ ├── config │ │ ├── modem │ │ └── custom_at_commands │ ├── hotplug.d │ │ ├── usb │ │ │ └── 20-modem-usb │ │ └── net │ │ │ └── 20-modem-net │ ├── init.d │ │ ├── modeminit │ │ └── modem │ └── uci-defaults │ │ └── luci-app-modem └── usr │ └── share │ ├── modem │ ├── modem_at.sh │ ├── modem_task.sh │ ├── modem_init.sh │ ├── modem_debug.sh │ ├── modem_scan.sh │ ├── at_commands.json │ ├── simcom.sh │ ├── modem_support.json │ ├── modem_network_task.sh │ └── modem_info.sh │ └── rpcd │ └── acl.d │ └── luci-app-modem.json ├── .gitignore ├── Makefile ├── README.md ├── .github └── workflows │ └── release.yml └── po ├── zh-cn └── modem.po └── zh_Hans └── modem.po /.gitattributes: -------------------------------------------------------------------------------- 1 | #指定换行符 2 | /luasrc/** text eol=lf 3 | # /old/* text eol=lf 4 | /root/** text eol=lf -------------------------------------------------------------------------------- /htdocs/luci-static/resources/icons/sms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qianlyun123/luci-app-modem/HEAD/htdocs/luci-static/resources/icons/sms.png -------------------------------------------------------------------------------- /htdocs/luci-static/resources/icons/sms2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qianlyun123/luci-app-modem/HEAD/htdocs/luci-static/resources/icons/sms2.png -------------------------------------------------------------------------------- /luasrc/view/modem/status.htm: -------------------------------------------------------------------------------- 1 | <%+cbi/valueheader%> 2 | -- 3 | <%+cbi/valuefooter%> 4 | -------------------------------------------------------------------------------- /root/etc/config/modem: -------------------------------------------------------------------------------- 1 | 2 | config global 'global' 3 | option enable_dial '1' 4 | option modem_number '0' 5 | option manual_configuration '0' 6 | option network_interface_alias '1' -------------------------------------------------------------------------------- /root/usr/share/modem/modem_at.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #脚本目录 5 | SCRIPT_DIR="/usr/share/modem" 6 | source "${SCRIPT_DIR}/modem_debug.sh" 7 | 8 | #发送at命令 9 | # $1 AT串口 10 | # $2 AT命令 11 | at "$1" "$2" -------------------------------------------------------------------------------- /root/usr/share/rpcd/acl.d/luci-app-modem.json: -------------------------------------------------------------------------------- 1 | { 2 | "luci-app-modem": { 3 | "description": "Grant UCI access for luci-app-modem", 4 | "read": { 5 | "uci": [ "modem" ] 6 | }, 7 | "write": { 8 | "uci": [ "modem" ] 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /luasrc/view/modem/hide_manual_config_modem.htm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /root/etc/hotplug.d/usb/20-modem-usb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #导入组件工具 5 | source "/usr/share/modem/modem_util.sh" 6 | 7 | #只在添加和移除的时候执行 8 | # [ "$ACTION" != "add" ] && [ "$ACTION" != "remove" ] && exit 9 | #设备号不存在,退出(去掉多余的tty设备) 10 | [ -z "${DEVNUM}" ] && exit 11 | 12 | #测试 13 | # test_usb_hotplug 14 | 15 | #始终确保存在运行目录 16 | mkdir -m 0755 -p "${MODEM_RUNDIR}" 17 | 18 | #设置USB设备 19 | m_check_usb_device "${ACTION}" "${DEVNUM}" "${PRODUCT}" "/sys${DEVPATH}" 20 | -------------------------------------------------------------------------------- /root/etc/init.d/modeminit: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2023 Siriling 3 | 4 | START=70 5 | STOP=13 6 | USE_PROCD=1 7 | 8 | #脚本目录 9 | SCRIPT_DIR="/usr/share/modem" 10 | 11 | start_service() 12 | { 13 | # 暂时弃用 14 | # /bin/sh ${SCRIPT_DIR}/modem_init.sh 15 | echo "init" 16 | # procd_open_instance #启动实例 17 | # procd_set_param command /bin/sh /usr/share/modem/modem_init.sh 18 | # procd_set_param respawn # 定义respawn参数,告知procd当task程序退出后尝试进行重启 19 | # procd_close_instance #关闭实例 20 | } -------------------------------------------------------------------------------- /luasrc/view/modem/hide_dial_config_id.htm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /root/usr/share/modem/modem_task.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #脚本目录 5 | SCRIPT_DIR="/usr/share/modem" 6 | source "${SCRIPT_DIR}/modem_debug.sh" 7 | source "${SCRIPT_DIR}/modem_scan.sh" 8 | 9 | #模组扫描任务 10 | modem_scan_task() 11 | { 12 | sleep 8s #刚开机需要等待移动网络出来 13 | while true; do 14 | enable_dial=$(uci -q get modem.@global[0].enable_dial) 15 | if [ "$enable_dial" = "1" ]; then 16 | #扫描模块 17 | debug "开启模块扫描任务" 18 | modem_scan 19 | debug "结束模块扫描任务" 20 | fi 21 | sleep 10s 22 | done 23 | } 24 | 25 | modem_scan_task -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | *.o 3 | *.ko 4 | *.obj 5 | *.elf 6 | 7 | # Linker output 8 | *.ilk 9 | *.map 10 | *.exp 11 | 12 | # Precompiled Headers 13 | *.gch 14 | *.pch 15 | 16 | # Libraries 17 | *.lib 18 | *.a 19 | *.la 20 | *.lo 21 | 22 | # Shared objects (inc. Windows DLLs) 23 | *.dll 24 | *.so 25 | *.so.* 26 | *.dylib 27 | 28 | # Executables 29 | *.exe 30 | *.out 31 | *.app 32 | *.i*86 33 | *.x86_64 34 | *.hex 35 | 36 | # Debug files 37 | *.dSYM/ 38 | *.su 39 | *.idb 40 | *.pdb 41 | 42 | # Kernel Module Compile Results 43 | *.mod* 44 | *.cmd 45 | .tmp_versions/ 46 | modules.order 47 | Module.symvers 48 | Mkfile.old 49 | dkms.conf 50 | -------------------------------------------------------------------------------- /root/usr/share/modem/modem_init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #脚本目录 5 | SCRIPT_DIR="/usr/share/modem" 6 | source "${SCRIPT_DIR}/modem_util.sh" 7 | 8 | #模组配置初始化 9 | modem_init() 10 | { 11 | m_log "info" "Clearing all modem configurations" 12 | #清空模组配置 13 | local modem_count=$(uci -q get modem.@global[0].modem_number) 14 | for i in $(seq 0 $((modem_count-1))); do 15 | #删除该模组的配置 16 | uci -q del modem.modem${i} 17 | done 18 | uci set modem.@global[0].modem_number=0 19 | uci commit modem 20 | m_log "info" "All module configurations cleared" 21 | } 22 | 23 | modem_init -------------------------------------------------------------------------------- /root/etc/uci-defaults/luci-app-modem: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | uci -q get modem.global >/dev/null || uci -q batch <<-EOF >/dev/null 5 | set modem.global=global 6 | set modem.@global[0].enable_dial=1 7 | set modem.@global[0].modem_number=0 8 | set modem.@global[0].manual_configuration=0 9 | set modem.@global[0].network_interface_alias=1 10 | commit modem 11 | EOF 12 | 13 | /etc/init.d/modeminit enable 14 | /etc/init.d/modem enable 15 | 16 | uci -q batch <<-EOF >/dev/null 17 | delete ucitrack.@modem[-1] 18 | add ucitrack modem 19 | set ucitrack.@modem[-1].init=modem 20 | commit ucitrack 21 | EOF 22 | 23 | rm -rf /tmp/luci-*cache 24 | exit 0 25 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2023 Siriling 2 | # This is free software, licensed under the GNU General Public License v3. 3 | 4 | include $(TOPDIR)/rules.mk 5 | 6 | PKG_NAME:=luci-app-modem 7 | LUCI_TITLE:=LuCI support for Modem 8 | LUCI_PKGARCH:=all 9 | PKG_VERSION:=1.4.4 10 | PKG_LICENSE:=GPLv3 11 | PKG_LINCESE_FILES:=LICENSE 12 | PKF_MAINTAINER:=Siriling 13 | LUCI_DEPENDS:=+luci-compat \ 14 | +usbutils \ 15 | +pciutils \ 16 | +quectel-CM-5G \ 17 | +sms-tool \ 18 | +jq 19 | 20 | define Package/luci-app-modem/conffiles 21 | /etc/config/modem 22 | endef 23 | 24 | include $(TOPDIR)/feeds/luci/luci.mk 25 | 26 | # call BuildPackage - OpenWrt buildroot signature 27 | -------------------------------------------------------------------------------- /luasrc/view/modem/list_status.htm: -------------------------------------------------------------------------------- 1 | 20 | -------------------------------------------------------------------------------- /root/etc/hotplug.d/net/20-modem-net: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #导入组件工具 5 | source "/usr/share/modem/modem_util.sh" 6 | 7 | #网络设备名称不存在,退出 8 | [ -z "${INTERFACE}" ] && exit 9 | #网络设备路径不存在,退出 10 | [ -z "${DEVPATH}" ] && exit 11 | 12 | #始终确保存在运行目录 13 | mkdir -m 0755 -p "${MODEM_RUNDIR}" 14 | 15 | #初始化模组配置 16 | # [[ "${INTERFACE}" = *"ip6tnl0"* ]] && { 17 | # sh "${SCRIPT_DIR}/modem_init.sh" 18 | # } 19 | 20 | if [[ "${INTERFACE}" = *"usb"* ]] || [[ "${INTERFACE}" = *"wwan"* ]] || [[ "${INTERFACE}" = *"eth"* ]]; then 21 | #配置网络设备 22 | m_set_network_device "${ACTION}" "${INTERFACE}" "/sys${DEVPATH}" "usb" 23 | 24 | elif [[ "${INTERFACE}" = *"mhi_hwip"* ]] || [[ "${INTERFACE}" = *"rmnet_mhi"* ]]; then 25 | #配置网络设备 26 | m_set_network_device "${ACTION}" "${INTERFACE}" "/sys${DEVPATH}" "pcie" 27 | else 28 | exit 29 | fi 30 | -------------------------------------------------------------------------------- /luasrc/model/cbi/modem/quick_commands_config.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2024 Siriling 2 | 3 | local dispatcher = require "luci.dispatcher" 4 | local fs = require "nixio.fs" 5 | local http = require "luci.http" 6 | local uci = require "luci.model.uci".cursor() 7 | 8 | m = Map("custom_at_commands") 9 | m.title = translate("Custom quick commands") 10 | m.description = translate("Customize your quick commands") 11 | m.redirect = dispatcher.build_url("admin", "network", "modem","modem_debug") 12 | 13 | -- 自定义命令 -- 14 | s = m:section(TypedSection, "custom-commands", translate("Custom Commands")) 15 | s.anonymous = true 16 | s.addremove = true 17 | s.sortable = true 18 | s.template = "modem/tblsection_command" 19 | 20 | description = s:option(Value, "description", translate("Description")) 21 | description.placeholder = translate("Not null") 22 | description.rmempty = true 23 | description.optional = false 24 | 25 | command = s:option(Value, "command", translate("Command")) 26 | command.placeholder = translate("Not null") 27 | command.rmempty = true 28 | command.optional = false 29 | 30 | return m 31 | -------------------------------------------------------------------------------- /luasrc/view/modem/modem_scan.htm: -------------------------------------------------------------------------------- 1 | <%+cbi/valueheader%> 2 | 39 | 40 | 46 | 47 | 48 |
49 | <%:The automatic configuration modem is triggered only at modem startup, otherwise, manual scanning is necessary%> 50 |
51 | <%+cbi/valuefooter%> 52 | -------------------------------------------------------------------------------- /root/usr/share/modem/modem_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #脚本目录 5 | SCRIPT_DIR="/usr/share/modem" 6 | 7 | source "${SCRIPT_DIR}/quectel.sh" 8 | source "${SCRIPT_DIR}/fibocom.sh" 9 | source "${SCRIPT_DIR}/meig.sh" 10 | # source "${SCRIPT_DIR}/simcom.sh" 11 | 12 | #调试开关 13 | # 0关闭 14 | # 1打开 15 | # 2输出到文件 16 | switch=0 17 | out_file="/tmp/modem.log" #输出文件 18 | #日志信息 19 | debug() 20 | { 21 | time=$(date "+%Y-%m-%d %H:%M:%S") #获取系统时间 22 | if [ $switch = 1 ]; then 23 | echo $time $1 #打印输出 24 | elif [ $switch = 2 ]; then 25 | echo $time $1 >> $outfile #输出到文件 26 | fi 27 | } 28 | 29 | #发送at命令 30 | # $1 AT串口 31 | # $2 AT命令 32 | at() 33 | { 34 | local at_port="$1" 35 | local new_str="${2/[$]/$}" 36 | local at_command="${new_str/\"/\"}" 37 | 38 | #echo 39 | # echo -e "${at_command}"" > "${at_port}" 2>&1 40 | 41 | #sms_tool 42 | sms_tool -d "${at_port}" at "${at_command}" 2>&1 43 | } 44 | 45 | #测试时打开 46 | # debug $1 47 | # at $1 $2 48 | 49 | #获取快捷命令 50 | # $1:快捷选项 51 | # $2:制造商 52 | get_quick_commands() 53 | { 54 | local quick_option="$1" 55 | local manufacturer="$2" 56 | 57 | local quick_commands 58 | case "$quick_option" in 59 | "auto") quick_commands=$(cat ${SCRIPT_DIR}/${manufacturer}_at_commands.json) ;; 60 | "custom") quick_commands=$(cat /etc/modem/custom_at_commands.json) ;; 61 | *) quick_commands=$(cat ${SCRIPT_DIR}/${manufacturer}_at_commands.json) ;; 62 | esac 63 | echo "$quick_commands" 64 | } 65 | 66 | #拨号日志 67 | # $1:AT命令 68 | # $2:日志路径 69 | dial_log() 70 | { 71 | local at_command="$1" 72 | local path="$2" 73 | 74 | #打印日志 75 | local update_time=$(date +"%Y-%m-%d %H:%M:%S") 76 | echo "[${update_time}] Send AT command ${at_command} to modem" >> "${path}" 77 | } -------------------------------------------------------------------------------- /luasrc/view/modem/mode_info.htm: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /root/usr/share/modem/modem_scan.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #脚本目录 5 | SCRIPT_DIR="/usr/share/modem" 6 | source "${SCRIPT_DIR}/modem_util.sh" 7 | 8 | #获取设备物理地址 9 | # $1:网络设备或串口 10 | get_device_physical_path() 11 | { 12 | local device_name="$(basename "$1")" 13 | local device_path="$(find /sys/class/ -name $device_name)" 14 | local device_physical_path="$(readlink -f $device_path/device/)" 15 | echo "$device_physical_path" 16 | } 17 | 18 | #设置模组配置 19 | # $1:网络设备 20 | # $2:网络设备系统路径 21 | set_modem_config() 22 | { 23 | local network="$(basename $sys_network)" 24 | local network_path="$(readlink -f $sys_network)" 25 | 26 | #只处理最上级的网络设备 27 | local count=$(echo "${network_path}" | grep -o "/net" | wc -l) 28 | [ "$count" -ge "2" ] && return 29 | 30 | #判断路径是否带有usb(排除其他eth网络设备) 31 | if [[ "$network" = *"eth"* ]] && [[ "$network_path" != *"usb"* ]]; then 32 | return 33 | fi 34 | 35 | #获取物理路径 36 | local device_physical_path=$(m_get_device_physical_path ${network_path}) 37 | #设置物理设备 38 | m_set_physical_device "scan" "${network}" "${device_physical_path}" 39 | 40 | #启用拨号 41 | enable_dial "${network}" 42 | } 43 | 44 | #设置系统网络设备 45 | # $1:系统网络设备列表 46 | set_sys_network_config() 47 | { 48 | local sys_networks="$1" 49 | 50 | for sys_network in $sys_networks; do 51 | local network="$(basename $sys_network)" 52 | set_modem_config "${network}" "${sys_network}" 53 | done 54 | } 55 | 56 | #设置模组信息 57 | modem_scan() 58 | { 59 | #模组配置初始化 60 | sh "${SCRIPT_DIR}/modem_init.sh" 61 | 62 | #发起模组添加事件 63 | #USB 64 | local sys_network 65 | sys_network="$(find /sys/class/net -name usb*)" #ECM RNDIS NCM 66 | set_sys_network_config "$sys_network" 67 | sys_network="$(find /sys/class/net -name wwan*)" #QMI MBIM 68 | set_sys_network_config "$sys_network" 69 | sys_network="$(find /sys/class/net -name eth*)" #RNDIS 70 | set_sys_network_config "$sys_network" 71 | 72 | #PCIE 73 | sys_network="$(find /sys/class/net -name mhi_hwip*)" #(通用mhi驱动) 74 | set_sys_network_config "$sys_network" 75 | sys_network="$(find /sys/class/net -name rmnet_mhi*)" #(制造商mhi驱动) 76 | set_sys_network_config "$sys_network" 77 | 78 | echo "modem scan complete" 79 | } 80 | 81 | #测试时打开 82 | # modem_scan -------------------------------------------------------------------------------- /luasrc/model/cbi/modem/plugin_config.lua: -------------------------------------------------------------------------------- 1 | local d = require "luci.dispatcher" 2 | local uci = luci.model.uci.cursor() 3 | local sys = require "luci.sys" 4 | local script_path="/usr/share/modem/" 5 | 6 | m = Map("modem") 7 | m.title = translate("Plugin Config") 8 | m.description = translate("Check and modify the plugin configuration") 9 | 10 | font_red = [[]] 11 | font_off = [[]] 12 | bold_on = [[]] 13 | bold_off = [[]] 14 | 15 | --全局配置 16 | s = m:section(TypedSection, "global", translate("Global Config")) 17 | s.anonymous = true 18 | s.addremove = false 19 | 20 | -- 模组扫描 21 | o = s:option(Button, "modem_scan", translate("Modem Scan")) 22 | o.template = "modem/modem_scan" 23 | 24 | -- 启用手动配置 25 | o = s:option(Flag, "manual_configuration", font_red..bold_on..translate("Manual Configuration")..bold_off..font_off) 26 | o.rmempty = false 27 | 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 28 | 29 | -- 启用网络接口别名 30 | o = s:option(Flag, "network_interface_alias", translate("Network Interface Alias")) 31 | o.rmempty = false 32 | o.description = translate("Enable automatic creation of network interface alias (Effective upon reinstatement of dialing configuration)") 33 | 34 | -- 配置模组信息 35 | s = m:section(TypedSection, "modem-device", translate("Modem Config")) 36 | s.anonymous = true 37 | s.addremove = true 38 | -- s.sortable = true 39 | s.template = "modem/tblsection" 40 | s.extedit = d.build_url("admin", "network", "modem", "modem_config", "%s") 41 | 42 | function s.create(uci, t) 43 | -- 获取模组序号 44 | -- local modem_no=tonumber(uci.map:get("@global[0]","modem_number")) -- 将字符串转换为数字类型 45 | local modem_no=0 46 | local uci_tmp=luci.model.uci.cursor() 47 | uci_tmp:foreach("modem", "modem-device", function (modem_device) 48 | modem_no=modem_no+1 49 | end) 50 | 51 | t="modem"..modem_no 52 | TypedSection.create(uci, t) 53 | -- 设置手动配置 54 | -- uci.map:set(t,"manual","1") 55 | luci.http.redirect(uci.extedit:format(t)) 56 | end 57 | 58 | function s.remove(uci, t) 59 | uci.map.proceed = true 60 | uci.map:del(t) 61 | luci.http.redirect(d.build_url("admin", "network", "modem","plugin_config")) 62 | end 63 | 64 | -- 移动网络 65 | o = s:option(DummyValue, "network", translate("Network")) 66 | 67 | -- 模组名称 68 | o = s:option(DummyValue, "name", translate("Modem Name")) 69 | o.cfgvalue = function(t, n) 70 | local name = (Value.cfgvalue(t, n) or "") 71 | return translate(name:upper()) 72 | end 73 | 74 | -- AT串口 75 | o = s:option(DummyValue, "at_port", translate("AT Port")) 76 | -- o = s:option(Value, "at_port", translate("AT Port")) 77 | -- o.placeholder = translate("Not null") 78 | -- o.rmempty = false 79 | -- o.optional = false 80 | 81 | return m 82 | -------------------------------------------------------------------------------- /luasrc/model/cbi/modem/dial_overview.lua: -------------------------------------------------------------------------------- 1 | local d = require "luci.dispatcher" 2 | local uci = luci.model.uci.cursor() 3 | local sys = require "luci.sys" 4 | 5 | m = Map("modem") 6 | m.title = translate("Dial Overview") 7 | m.description = translate("Check and add modem dialing configurations") 8 | 9 | --全局配置 10 | s = m:section(NamedSection, "global", "global", translate("Global Config")) 11 | s.anonymous = true 12 | s.addremove = false 13 | 14 | o = s:option(Flag, "enable_dial", translate("Enable")) 15 | o.rmempty = false 16 | o.description = translate("Enable dial configurations") 17 | 18 | -- 添加模块状态 19 | m:append(Template("modem/modem_status")) 20 | 21 | s = m:section(TypedSection, "dial-config", translate("Config List")) 22 | s.anonymous = true 23 | s.addremove = true 24 | s.template = "modem/tblsection" 25 | s.extedit = d.build_url("admin", "network", "modem", "dial_config", "%s") 26 | 27 | function s.create(uci, t) 28 | local uuid = string.gsub(luci.sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)"), "-", "") 29 | t = uuid 30 | TypedSection.create(uci, t) 31 | luci.http.redirect(uci.extedit:format(t)) 32 | end 33 | function s.remove(uci, t) 34 | uci.map.proceed = true 35 | uci.map:del(t) 36 | luci.http.redirect(d.build_url("admin", "network", "modem","dial_overview")) 37 | end 38 | 39 | o = s:option(Flag, "enable", translate("Enable")) 40 | o.width = "5%" 41 | o.rmempty = false 42 | 43 | -- o = s:option(DummyValue, "status", translate("Status")) 44 | -- o.template = "modem/status" 45 | -- o.value = translate("Collecting data...") 46 | 47 | o = s:option(DummyValue, "remarks", translate("Remarks")) 48 | 49 | o = s:option(DummyValue, "network", translate("Mobile Network")) 50 | o.cfgvalue = function(t, n) 51 | -- 检测移动网络是否存在 52 | local network = (Value.cfgvalue(t, n) or "") 53 | local odpall = io.popen("ls /sys/class/net/ | grep -w "..network.." | wc -l") 54 | local odp = odpall:read("*a"):gsub("\n","") 55 | odpall:close() 56 | if odp ~= "0" then 57 | return network 58 | else 59 | return translate("The network device was not found") 60 | end 61 | end 62 | 63 | o = s:option(DummyValue, "dial_tool", translate("Dial Tool")) 64 | o.cfgvalue = function(t, n) 65 | local dial_tool = (Value.cfgvalue(t, n) or "") 66 | if dial_tool == "" then 67 | dial_tool = translate("Auto Choose") 68 | end 69 | return translate(dial_tool) 70 | end 71 | 72 | 73 | o = s:option(DummyValue, "pdp_type", translate("PDP Type")) 74 | o.cfgvalue = function(t, n) 75 | local pdp_type = (Value.cfgvalue(t, n) or "") 76 | if pdp_type == "ipv4v6" then 77 | pdp_type = translate("IPv4/IPv6") 78 | else 79 | pdp_type = pdp_type:gsub("_","/"):upper():gsub("V","v") 80 | end 81 | return pdp_type 82 | end 83 | 84 | o = s:option(Flag, "network_bridge", translate("Network Bridge")) 85 | o.width = "5%" 86 | o.rmempty = false 87 | 88 | o = s:option(DummyValue, "apn", translate("APN")) 89 | o.cfgvalue = function(t, n) 90 | local apn = (Value.cfgvalue(t, n) or "") 91 | if apn == "" then 92 | apn = translate("Auto Choose") 93 | end 94 | return apn 95 | end 96 | 97 | -- 添加模块拨号日志 98 | m:append(Template("modem/modem_dial_log")) 99 | 100 | -- m:append(Template("modem/list_status")) 101 | 102 | return m 103 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 中文 | [English](https://github.com/Siriling/5G-Modem-Support/blob/main/EngLish.md) 2 | 3 | # luci-app-modem 4 | 5 | # 目录 6 | 7 | [一、说明](#一说明) 8 | 9 | [二、模组支持](#二模组支持) 10 | 11 | # 一、说明 12 | 13 | - 支持USB和PCIe两种通信方式的通信模组 14 | 15 | - 支持配置多个通信模组进行拨号 16 | 17 | - 支持IPv6 18 | 19 | - 支持高通,紫光展锐,联发科等平台的通信模组 20 | 21 | - 支持常见厂商的通信模组(例如:移远,广和通等) 22 | 23 | # 二、模组支持 24 | 25 | 下面列出插件支持的模组 26 | 27 | | 厂家名称 | 模组名称 | 平台 | 数据传输模式 | 端口模式 | 28 | | -------- | -------------------------------------------------- | -------- | ------------ | ---------------------------- | 29 | | 移远通信 | RG200U-CN(DONGLE版) | 紫光展锐 | USB | ECM,MBIM,RNDIS,NCM | 30 | | 移远通信 | RM500U-CN | 紫光展锐 | USB | ECM,MBIM,RNDIS,NCM | 31 | | 移远通信 | RM500U-EA | 紫光展锐 | USB | ECM,MBIM,RNDIS,NCM | 32 | | 移远通信 | RM500U-CNV | 紫光展锐 | USB | ECM,MBIM,RNDIS,NCM | 33 | | 移远通信 | RM500Q-CN | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 34 | | 移远通信 | RM500Q-AE | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 35 | | 移远通信 | RM500Q-GL | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 36 | | 移远通信 | RM502Q-AE | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 37 | | 移远通信 | RM502Q-GL | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 38 | | 移远通信 | RM505Q-AE | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 39 | | 移远通信 | RM520N-CN | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 40 | | 移远通信 | RM520N-GL | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 41 | | 移远通信 | RM500Q-GL | 高通 | PCIE | RMNET,MBIM | 42 | | 移远通信 | RG500Q-EA | 高通 | PCIE | RMNET,MBIM | 43 | | 移远通信 | RM502Q-GL | 高通 | PCIE | RMNET,MBIM | 44 | | 移远通信 | RM520N-GL | 高通 | PCIE | RMNET,MBIM | 45 | | 移远通信 | RG520N-EU | 高通 | PCIE | RMNET,MBIM | 46 | | 广和通 | FM650-CN | 紫光展锐 | USB | ECM,MBIM,RNDIS,NCM | 47 | | 广和通 | FM350-GL | 联发科 | USB | RNDIS | 48 | | 广和通 | FM150-AE-01,FM150-AE-11,FM150-AE-21,FM150-NA-01 | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 49 | | 广和通 | FM350-GL | 联发科 | PCIE | MBIM | 50 | | 广和通 | FM150-AE-00,FM150-AE-10,FM150-AE-20,FM150-NA-00 | 高通 | PCIE | QMI | 51 | | 美格智能 | SRM815 | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 52 | | 美格智能 | SRM825 | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 53 | | 美格智能 | SRM825N | 高通 | USB | RMNET,ECM,MBIM,RNDIS,NCM | 54 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v*' 7 | repository_dispatch: 8 | workflow_dispatch: 9 | 10 | jobs: 11 | 12 | build: 13 | runs-on: ubuntu-20.04 14 | steps: 15 | 16 | - name: Initialization Environment 17 | env: 18 | DEBIAN_FRONTEND: noninteractive 19 | run: | 20 | echo -e "Total CPU cores\t: $(nproc)" 21 | cat /proc/cpuinfo | grep 'model name' 22 | free -h 23 | uname -a 24 | [ -f /proc/version ] && cat /proc/version 25 | [ -f /etc/issue.net ] && cat /etc/issue.net 26 | [ -f /etc/issue ] && cat /etc/issue 27 | ulimit -a 28 | 29 | - name: Download SDK 30 | run: | 31 | wget https://downloads.openwrt.org/releases/18.06.2/targets/x86/64/openwrt-sdk-18.06.2-x86-64_gcc-7.3.0_musl.Linux-x86_64.tar.xz 32 | xz -d openwrt-sdk-18.06.2-x86-64_gcc-7.3.0_musl.Linux-x86_64.tar.xz 33 | tar -xf openwrt-sdk-18.06.2-x86-64_gcc-7.3.0_musl.Linux-x86_64.tar 34 | mv openwrt-sdk-18.06.2-x86-64_gcc-7.3.0_musl.Linux-x86_64 openwrt-sdk 35 | 36 | - name: Build 37 | id: build 38 | run: | 39 | cd openwrt-sdk 40 | #echo -n > feeds.conf.default 41 | #echo "src-git packages https://github.com/coolsnowwolf/packages" >> feeds.conf.default 42 | #echo "src-git luci https://github.com/coolsnowwolf/luci" >> feeds.conf.default 43 | #echo "src-git routing https://github.com/coolsnowwolf/routing" >> feeds.conf.default 44 | #echo "src-git telephony https://git.openwrt.org/feed/telephony.git" >> feeds.conf.default 45 | 46 | # git clone https://github.com/Siriling/5G-Modem-Support.git package/5G-Modem-Support 47 | git clone https://github.com/Siriling/luci-app-modem.git package/luci-app-modem 48 | sudo apt update && sudo apt install minify 49 | 50 | ./scripts/feeds update -a && ./scripts/feeds install -a 51 | # echo "CONFIG_PACKAGE_sms-tool=y" >> .config 52 | echo "CONFIG_PACKAGE_luci-app-modem=y" >> .config 53 | 54 | make defconfig 55 | # make package/sms-tool/compile -j$(nproc) 56 | make package/luci-app-modem/compile -j$(nproc) 57 | 58 | 59 | cd .. 60 | # TARGET="$(find openwrt-sdk/bin/ | greps sms-tool)" 61 | CONFIG_TARGET="$(find openwrt-sdk/bin/ | grep luci-app-modem)" 62 | CONFIG_I18N_TARGET="$(find openwrt-sdk/bin/ | grep luci-i18n-modem)" 63 | 64 | echo 'JSON_RESPONSE<> $GITHUB_OUTPUT 65 | # echo "$TARGET" >> $GITHUB_OUTPUT 66 | echo "$CONFIG_TARGET" >> $GITHUB_OUTPUT 67 | echo "$CONFIG_I18N_TARGET" >> $GITHUB_OUTPUT 68 | echo 'EOF' >> $GITHUB_OUTPUT 69 | 70 | echo "status=success" >> $GITHUB_OUTPUT 71 | 72 | - name: Get tag 73 | id: tag 74 | uses: dawidd6/action-get-tag@v1 75 | with: 76 | # Optionally strip `v` prefix 77 | strip_v: false 78 | 79 | - name: Upload to release 80 | uses: softprops/action-gh-release@v1 81 | if: steps.build.outputs.status == 'success' && !cancelled() 82 | env: 83 | GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} 84 | with: 85 | name: ${{ steps.tag.outputs.tag }} 86 | tag_name: ${{ steps.tag.outputs.tag }} 87 | generate_release_notes: true 88 | files: | 89 | ${{ steps.build.outputs.JSON_RESPONSE }} 90 | -------------------------------------------------------------------------------- /luasrc/model/cbi/modem/modem_config.lua: -------------------------------------------------------------------------------- 1 | local dispatcher = require "luci.dispatcher" 2 | local uci = require "luci.model.uci".cursor() 3 | local sys = require "luci.sys" 4 | local json = require("luci.jsonc") 5 | local script_path="/usr/share/modem/" 6 | 7 | --[[ 8 | @Description 执行Shell脚本 9 | @Params 10 | command sh命令 11 | ]] 12 | function shell(command) 13 | local odpall = io.popen(command) 14 | local odp = odpall:read("*a") 15 | odpall:close() 16 | return odp 17 | end 18 | 19 | --[[ 20 | @Description 获取支持的模组信息 21 | @Params 22 | data_interface 数据接口 23 | ]] 24 | function getSupportModems(data_interface) 25 | local command="cat "..script_path.."modem_support.json" 26 | local result=json.parse(shell(command)) 27 | return result["modem_support"][data_interface] 28 | end 29 | 30 | --[[ 31 | @Description 按照制造商给模组分类 32 | ]] 33 | function getManufacturers() 34 | 35 | local manufacturers={} 36 | 37 | -- 获取支持的模组 38 | local support_modem=getSupportModems("usb") 39 | -- USB 40 | for modem in pairs(support_modem) do 41 | 42 | local manufacturer=support_modem[modem]["manufacturer"] 43 | if manufacturers[manufacturer] then 44 | -- 直接插入 45 | table.insert(manufacturers[manufacturer],modem) 46 | else 47 | -- 不存在先创建一个空表 48 | local tmp={} 49 | table.insert(tmp,modem) 50 | manufacturers[manufacturer]=tmp 51 | end 52 | end 53 | 54 | -- 获取支持的模组 55 | local support_modem=getSupportModems("pcie") 56 | -- PCIE 57 | for modem in pairs(support_modem) do 58 | 59 | local manufacturer=support_modem[modem]["manufacturer"] 60 | if manufacturers[manufacturer] then 61 | -- 直接插入 62 | table.insert(manufacturers[manufacturer],modem) 63 | else 64 | -- 不存在先创建一个空表 65 | local tmp={} 66 | table.insert(tmp,modem) 67 | manufacturers[manufacturer]=tmp 68 | end 69 | end 70 | 71 | return manufacturers 72 | end 73 | 74 | m = Map("modem", translate("Modem Config")) 75 | m.redirect = dispatcher.build_url("admin", "network", "modem","plugin_config") 76 | 77 | s = m:section(NamedSection, arg[1], "modem-device", "") 78 | s.addremove = false 79 | s.dynamic = false 80 | 81 | -- 手动配置 82 | manual = s:option(Flag, "manual", translate("Manual")) 83 | manual.default = "1" 84 | manual.rmempty = false 85 | -- uci:set('modem','modem-device','manual',1) 86 | 87 | -- 隐藏手动配置 88 | m:append(Template("modem/hide_manual_config_modem")) 89 | 90 | -- 移动网络 91 | mobile_network = s:option(ListValue, "network", translate("Mobile Network")) 92 | mobile_network.rmempty = true 93 | 94 | -- 获取移动网络 95 | function getMobileNetwork() 96 | 97 | --获取所有的网络接口 98 | local networks = sys.exec("ls -l /sys/class/net/ 2>/dev/null |awk '{print $9}' 2>/dev/null") 99 | 100 | --遍历所有网络接口 101 | for network in string.gmatch(networks, "%S+") do 102 | 103 | -- 只处理最上级的网络设备 104 | -- local count=$(echo "${network_path}" | grep -o "/net" | wc -l) 105 | -- [ "$count" -ge "2" ] && return 106 | 107 | -- 获取网络设备路径 108 | local command="readlink -f /sys/class/net/"..network 109 | local network_path=shell(command) 110 | 111 | -- 判断路径是否带有usb(排除其他eth网络设备) 112 | local flag="0" 113 | if network_path:find("eth") and not network_path:find("usb") then 114 | flag="1" 115 | end 116 | 117 | if flag=="0" then 118 | if network:find("usb") or network:find("wwan") or network:find("eth") then 119 | --设置USB移动网络 120 | mobile_network:value(network) 121 | elseif network:find("mhi_hwip") or network:find("rmnet_mhi") then 122 | --设置PCIE移动网络 123 | mobile_network:value(network) 124 | end 125 | end 126 | 127 | end 128 | end 129 | 130 | getMobileNetwork() 131 | 132 | -- 模组名称 133 | name = s:option(ListValue, "name", translate("Modem Name")) 134 | name.placeholder = translate("Not null") 135 | name.rmempty = false 136 | 137 | -- 按照制造商给模组分类 138 | local manufacturers=getManufacturers() 139 | 140 | for key in pairs(manufacturers) do 141 | local modems=manufacturers[key] 142 | -- 排序 143 | table.sort(modems) 144 | 145 | for i in pairs(modems) do 146 | -- 首字母大写 147 | local first_str=string.sub(key, 1, 1) 148 | local manufacturer = string.upper(first_str)..string.sub(key, 2) 149 | -- 设置值 150 | name:value(modems[i],manufacturer.." "..modems[i]:upper()) 151 | end 152 | end 153 | 154 | -- AT串口 155 | at_port = s:option(Value, "at_port", translate("AT Port")) 156 | at_port.placeholder = translate("Not null") 157 | at_port.rmempty = false 158 | 159 | return m 160 | -------------------------------------------------------------------------------- /luasrc/view/modem/modem_status.htm: -------------------------------------------------------------------------------- 1 | 135 | 136 | 151 | 152 | 153 | 161 | -------------------------------------------------------------------------------- /luasrc/model/cbi/modem/dial_config.lua: -------------------------------------------------------------------------------- 1 | local dispatcher = require "luci.dispatcher" 2 | local uci = require "luci.model.uci".cursor() 3 | local http = require "luci.http" 4 | 5 | m = Map("modem", translate("Dial Config")) 6 | m.redirect = dispatcher.build_url("admin", "network", "modem","dial_overview") 7 | 8 | s = m:section(NamedSection, arg[1], "dial-config", "") 9 | s.addremove = false 10 | s.dynamic = false 11 | s:tab("general", translate("General Settings")) 12 | s:tab("advanced", translate("Advanced Settings")) 13 | 14 | --------general-------- 15 | 16 | -- 是否启用 17 | enable = s:taboption("general", Flag, "enable", translate("Enable")) 18 | enable.default = "0" 19 | enable.rmempty = false 20 | 21 | -- 备注 22 | remarks = s:taboption("general", Value, "remarks", translate("Remarks")) 23 | remarks.rmempty = true 24 | 25 | -- 移动网络 26 | -- network = s:taboption("general", Value, "network", translate("Mobile Network")) 27 | network = s:taboption("general", ListValue, "network", translate("Mobile Network")) 28 | -- network.default = "" 29 | network.rmempty = false 30 | 31 | -- 获取移动网络,并显示设备名 32 | function getMobileNetwork() 33 | local modem_number=uci:get('modem','global','modem_number') 34 | if modem_number == "0" then 35 | network:value("",translate("Mobile network not found")) 36 | end 37 | 38 | return 39 | -- for i=0,modem_number-1 do 40 | -- --获取模块名 41 | -- local modem_name = uci:get('modem','modem'..i,'name') 42 | -- if modem_name == nil then 43 | -- modem_name = "unknown" 44 | -- end 45 | -- --设置网络 46 | -- modem_network = uci:get('modem','modem'..i,'network') 47 | -- if modem_network ~= nil then 48 | -- network:value(modem_network,modem_network.." ("..translate(modem_name:upper())..")") 49 | -- end 50 | -- end 51 | 52 | uci:foreach("modem", "modem-device", function (modem_device) 53 | 54 | --获取模块名 55 | local modem_name=modem_device["name"] 56 | --获取网络 57 | local modem_network=modem_device["network"] 58 | 59 | --设置网络值 60 | network:value(modem_network,modem_network.." ("..translate(modem_name:upper())..")") 61 | end) 62 | end 63 | 64 | getMobileNetwork() 65 | 66 | -- 拨号模式 67 | -- mode = s:taboption("general", ListValue, "mode", translate("Mode")) 68 | -- mode.rmempty = false 69 | -- mode.description = translate("Only display the modes available for the adaptation modem") 70 | -- local modes = {"qmi","gobinet","ecm","mbim","rndis","ncm"} 71 | -- for i in ipairs(modes) do 72 | -- mode:value(modes[i],string.upper(modes[i])) 73 | -- end 74 | 75 | -- 添加获取拨号模式信息 76 | -- m:append(Template("modem/mode_info")) 77 | 78 | --------advanced-------- 79 | 80 | -- 拨号工具 81 | dial_tool = s:taboption("advanced", ListValue, "dial_tool", translate("Dial Tool")) 82 | dial_tool.description = translate("After switching the dialing tool, it may be necessary to restart the module or restart the router to recognize the module.") 83 | dial_tool.rmempty = true 84 | dial_tool:value("", translate("Auto Choose")) 85 | dial_tool:value("quectel-CM", translate("quectel-CM")) 86 | dial_tool:value("mmcli", translate("mmcli")) 87 | 88 | -- 网络类型 89 | pdp_type= s:taboption("advanced", ListValue, "pdp_type", translate("PDP Type")) 90 | pdp_type.default = "ipv4v6" 91 | pdp_type.rmempty = false 92 | pdp_type:value("ipv4", translate("IPv4")) 93 | pdp_type:value("ipv6", translate("IPv6")) 94 | pdp_type:value("ipv4v6", translate("IPv4/IPv6")) 95 | 96 | -- 网络桥接 97 | network_bridge = s:taboption("advanced", Flag, "network_bridge", translate("Network Bridge")) 98 | network_bridge.description = translate("After checking, enable network interface bridge.") 99 | network_bridge.default = "0" 100 | network_bridge.rmempty = false 101 | 102 | -- 接入点 103 | apn = s:taboption("advanced", Value, "apn", translate("APN")) 104 | apn.default = "" 105 | apn.rmempty = true 106 | apn:value("", translate("Auto Choose")) 107 | apn:value("cmnet", translate("China Mobile")) 108 | apn:value("3gnet", translate("China Unicom")) 109 | apn:value("ctnet", translate("China Telecom")) 110 | apn:value("cbnet", translate("China Broadcast")) 111 | apn:value("5gscuiot", translate("Skytone")) 112 | 113 | auth = s:taboption("advanced", ListValue, "auth", translate("Authentication Type")) 114 | auth.default = "none" 115 | auth.rmempty = false 116 | auth:value("none", translate("NONE")) 117 | auth:value("both", translate("PAP/CHAP (both)")) 118 | auth:value("pap", "PAP") 119 | auth:value("chap", "CHAP") 120 | 121 | username = s:taboption("advanced", Value, "username", translate("PAP/CHAP Username")) 122 | username.rmempty = true 123 | username:depends("auth", "both") 124 | username:depends("auth", "pap") 125 | username:depends("auth", "chap") 126 | 127 | password = s:taboption("advanced", Value, "password", translate("PAP/CHAP Password")) 128 | password.rmempty = true 129 | password.password = true 130 | password:depends("auth", "both") 131 | password:depends("auth", "pap") 132 | password:depends("auth", "chap") 133 | 134 | -- 配置ID 135 | id = s:taboption("advanced", ListValue, "id", translate("Config ID")) 136 | id.rmempty = false 137 | id:value(arg[1]) 138 | -- uci:set('modem',arg[1],'id',arg[1]) 139 | 140 | -- 隐藏配置ID 141 | m:append(Template("modem/hide_dial_config_id")) 142 | 143 | return m 144 | -------------------------------------------------------------------------------- /luasrc/view/modem/tblsection.htm: -------------------------------------------------------------------------------- 1 | <%- 2 | local rowcnt = 0 3 | 4 | function rowstyle() 5 | rowcnt = rowcnt + 1 6 | if rowcnt % 2 == 0 then 7 | return " cbi-rowstyle-1" 8 | else 9 | return " cbi-rowstyle-2" 10 | end 11 | end 12 | 13 | function width(o) 14 | if o.width then 15 | if type(o.width) == 'number' then 16 | return ' style="width:%dpx"' % o.width 17 | end 18 | return ' style="width:%s"' % o.width 19 | end 20 | return '' 21 | end 22 | 23 | local has_titles = false 24 | local has_descriptions = false 25 | 26 | local anonclass = (not self.anonymous or self.sectiontitle) and "named" or "anonymous" 27 | local titlename = ifattr(not self.anonymous or self.sectiontitle, "data-title", translate("Name")) 28 | 29 | local i, k 30 | for i, k in pairs(self.children) do 31 | if not k.typename then 32 | k.typename = k.template and k.template:gsub("^.+/", "") or "" 33 | end 34 | 35 | if not has_titles and k.title and #k.title > 0 then 36 | has_titles = true 37 | end 38 | 39 | if not has_descriptions and k.description and #k.description > 0 then 40 | has_descriptions = true 41 | end 42 | end 43 | 44 | function render_titles() 45 | if not has_titles then 46 | return 47 | end 48 | 49 | %>><% 50 | 51 | local i, k 52 | for i, k in ipairs(self.children) do 53 | if not k.optional then 54 | %>><% 56 | 57 | if k.titleref then 58 | %><% 59 | end 60 | 61 | write(k.title) 62 | 63 | if k.titleref then 64 | %><% 65 | end 66 | 67 | %><% 68 | end 69 | end 70 | 71 | if self.sortable or self.extedit or self.addremove then 72 | %><% 73 | end 74 | 75 | %><% 76 | 77 | rowcnt = rowcnt + 1 78 | end 79 | 80 | function render_descriptions() 81 | if not has_descriptions then 82 | return 83 | end 84 | 85 | %><% 86 | 87 | local i, k 88 | for i, k in ipairs(self.children) do 89 | if not k.optional then 90 | %>><% 92 | 93 | write(k.description) 94 | 95 | %><% 96 | end 97 | end 98 | 99 | if self.sortable or self.extedit or self.addremove then 100 | %><% 101 | end 102 | 103 | %><% 104 | 105 | rowcnt = rowcnt + 1 106 | end 107 | 108 | -%> 109 | 110 | 111 |
112 | <% if self.title and #self.title > 0 then -%> 113 |

<%=self.title%>

114 | <%- end %> 115 | <%- if self.sortable then -%> 116 | 117 | <%- end -%> 118 |
<%=self.description%>
119 | 120 | <%- 121 | render_titles() 122 | render_descriptions() 123 | 124 | local isempty, section, i, k = true, nil, nil 125 | for i, k in ipairs(self:cfgsections()) do 126 | isempty = false 127 | section = k 128 | 129 | local sectionname = striptags((type(self.sectiontitle) == "function") and self:sectiontitle(section) or k) 130 | local sectiontitle = ifattr(sectionname and (not self.anonymous or self.sectiontitle), "data-title", sectionname, true) 131 | local colorclass = (self.extedit or self.rowcolors) and rowstyle() or "" 132 | local scope = { 133 | valueheader = "cbi/cell_valueheader", 134 | valuefooter = "cbi/cell_valuefooter" 135 | } 136 | -%> 137 | > 138 | <%- 139 | local node 140 | for k, node in ipairs(self.children) do 141 | if not node.optional then 142 | node:render(section, scope or {}) 143 | end 144 | end 145 | -%> 146 | 147 | <%- if self.sortable or self.extedit or self.addremove then -%> 148 | 166 | <%- end -%> 167 | 168 | <%- end -%> 169 | 170 | <%- if isempty then -%> 171 | 172 | 173 | 174 | <%- end -%> 175 |
149 |
150 | <%- if self.sortable then -%> 151 | 152 | 153 | <% end; if self.extedit then -%> 154 | onclick="location.href='<%=self.extedit:format(section)%>'" 157 | <%- elseif type(self.extedit) == "function" then 158 | %> onclick="location.href='<%=self:extedit(section)%>'" 159 | <%- end 160 | %> alt="<%:Edit%>" title="<%:Edit%>" /> 161 | <% end; if self.addremove then %> 162 | 163 | <%- end -%> 164 |
165 |
<%:This section contains no values yet%>
176 | 177 | <% if self.error then %> 178 |
179 |
    <% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%> 180 |
  • <%=pcdata(e):gsub("\n","
    ")%>
  • 181 | <%- end end %>
182 |
183 | <% end %> 184 | 185 | <%- if self.addremove then -%> 186 | <% if self.template_addremove then include(self.template_addremove) else -%> 187 |
188 | <% if self.anonymous then %> 189 | 190 | <% else %> 191 | <% if self.invalid_cts then -%> 192 |
<%:Invalid%>
193 | <%- end %> 194 |
195 | 196 |
197 | 198 | <% end %> 199 |
200 | <%- end %> 201 | <%- end -%> 202 |
203 | 204 | -------------------------------------------------------------------------------- /luasrc/view/modem/tblsection_command.htm: -------------------------------------------------------------------------------- 1 | <%- 2 | local rowcnt = 0 3 | 4 | function rowstyle() 5 | rowcnt = rowcnt + 1 6 | if rowcnt % 2 == 0 then 7 | return " cbi-rowstyle-1" 8 | else 9 | return " cbi-rowstyle-2" 10 | end 11 | end 12 | 13 | function width(o) 14 | if o.width then 15 | if type(o.width) == 'number' then 16 | return ' style="width:%dpx"' % o.width 17 | end 18 | return ' style="width:%s"' % o.width 19 | end 20 | return '' 21 | end 22 | 23 | local has_titles = false 24 | local has_descriptions = false 25 | 26 | local anonclass = (not self.anonymous or self.sectiontitle) and "named" or "anonymous" 27 | local titlename = ifattr(not self.anonymous or self.sectiontitle, "data-title", translate("Name")) 28 | 29 | local i, k 30 | for i, k in pairs(self.children) do 31 | if not k.typename then 32 | k.typename = k.template and k.template:gsub("^.+/", "") or "" 33 | end 34 | 35 | if not has_titles and k.title and #k.title > 0 then 36 | has_titles = true 37 | end 38 | 39 | if not has_descriptions and k.description and #k.description > 0 then 40 | has_descriptions = true 41 | end 42 | end 43 | 44 | function render_titles() 45 | if not has_titles then 46 | return 47 | end 48 | 49 | %>> 50 | <%:Serial Number%> 51 | <% 52 | local i, k 53 | for i, k in ipairs(self.children) do 54 | if not k.optional then 55 | %>><% 57 | 58 | if k.titleref then 59 | %><% 60 | end 61 | 62 | write(k.title) 63 | 64 | if k.titleref then 65 | %><% 66 | end 67 | 68 | %><% 69 | end 70 | end 71 | 72 | if self.sortable or self.extedit or self.addremove then 73 | %><% 74 | end 75 | 76 | %><% 77 | 78 | rowcnt = rowcnt + 1 79 | end 80 | 81 | function render_descriptions() 82 | if not has_descriptions then 83 | return 84 | end 85 | 86 | %><% 87 | 88 | local i, k 89 | for i, k in ipairs(self.children) do 90 | if not k.optional then 91 | %>><% 93 | 94 | write(k.description) 95 | 96 | %><% 97 | end 98 | end 99 | 100 | if self.sortable or self.extedit or self.addremove then 101 | %><% 102 | end 103 | 104 | %><% 105 | 106 | rowcnt = rowcnt + 1 107 | end 108 | 109 | -%> 110 | 111 | 112 |
113 | <% if self.title and #self.title > 0 then -%> 114 |

<%=self.title%>

115 | <%- end %> 116 | <%- if self.sortable then -%> 117 | 118 | <%- end -%> 119 |
<%=self.description%>
120 | 121 | <%- 122 | render_titles() 123 | render_descriptions() 124 | 125 | local num = 1 126 | local isempty, section, i, k = true, nil, nil 127 | for i, k in ipairs(self:cfgsections()) do 128 | isempty = false 129 | section = k 130 | 131 | local sectionname = striptags((type(self.sectiontitle) == "function") and self:sectiontitle(section) or k) 132 | local sectiontitle = ifattr(sectionname and (not self.anonymous or self.sectiontitle), "data-title", sectionname, true) 133 | local colorclass = (self.extedit or self.rowcolors) and rowstyle() or "" 134 | local scope = { 135 | valueheader = "cbi/cell_valueheader", 136 | valuefooter = "cbi/cell_valuefooter" 137 | } 138 | -%> 139 | > 140 | 144 | <%- 145 | local node 146 | for k, node in ipairs(self.children) do 147 | if not node.optional then 148 | node:render(section, scope or {}) 149 | end 150 | end 151 | -%> 152 | <%- if self.sortable or self.extedit or self.addremove then -%> 153 | 171 | <%- end -%> 172 | 173 | <%- end -%> 174 | 175 | <%- if isempty then -%> 176 | 177 | 178 | 179 | <%- end -%> 180 |
141 |

<%=num%>

142 | <% num = num + 1 -%> 143 |
154 |
155 | <%- if self.sortable then -%> 156 | 157 | 158 | <% end; if self.extedit then -%> 159 | onclick="location.href='<%=self.extedit:format(section)%>'" 162 | <%- elseif type(self.extedit) == "function" then 163 | %> onclick="location.href='<%=self:extedit(section)%>'" 164 | <%- end 165 | %> alt="<%:Edit%>" title="<%:Edit%>" /> 166 | <% end; if self.addremove then %> 167 | 168 | <%- end -%> 169 |
170 |
<%:This section contains no values yet%>
181 | 182 | <% if self.error then %> 183 |
184 |
    <% for _, c in pairs(self.error) do for _, e in ipairs(c) do -%> 185 |
  • <%=pcdata(e):gsub("\n","
    ")%>
  • 186 | <%- end end %>
187 |
188 | <% end %> 189 | 190 | <%- if self.addremove then -%> 191 | <% if self.template_addremove then include(self.template_addremove) else -%> 192 |
193 | <% if self.anonymous then %> 194 | 195 | <% else %> 196 | <% if self.invalid_cts then -%> 197 |
<%:Invalid%>
198 | <%- end %> 199 |
200 | 201 |
202 | 203 | <% end %> 204 |
205 | <%- end %> 206 | <%- end -%> 207 |
208 | 209 | -------------------------------------------------------------------------------- /luasrc/view/modem/at_command_old.htm: -------------------------------------------------------------------------------- 1 | <%+header%> 2 | 3 | 28 | 29 | 224 | 225 |

<%:AT Commands%>

226 |
<%:Debug Your Module%>
227 | 228 |
229 |
230 |

<%:Message%>

231 | 232 | 233 | 239 | 240 |
234 |
235 | <%:Loading%> 236 | <%:Loading modem%>... 237 |
238 |
241 |
242 |
243 | 244 | 288 | 289 | <%+footer%> 290 | 291 | -------------------------------------------------------------------------------- /root/usr/share/modem/at_commands.json: -------------------------------------------------------------------------------- 1 | { 2 | "quick_commands":{ 3 | "general":[ 4 | {"模组信息 > ATI":"ATI"}, 5 | {"查询SIM卡状态 > AT+CPIN?":"AT+CPIN?"}, 6 | {"查询网络信号质量(4G) > AT+CSQ":"AT+CSQ"}, 7 | {"查询网络信号质量(5G) > AT+CESQ":"AT+CESQ"}, 8 | {"查询网络信息 > AT+COPS?":"AT+COPS?"}, 9 | {"查询PDP信息 > AT+CGDCONT?":"AT+CGDCONT?"}, 10 | {"查询PDP地址 > AT+CGPADDR":"AT+CGPADDR"}, 11 | {"查询模组IMEI > AT+CGSN":"AT+CGSN"}, 12 | {"查询模组IMEI > AT+GSN":"AT+GSN"}, 13 | {"查看当前电压 > AT+CBC":"AT+CBC"}, 14 | {"最小功能模式 > AT+CFUN=0":"AT+CFUN=0"}, 15 | {"全功能模式 > AT+CFUN=1":"AT+CFUN=1"}, 16 | {"重启模组 > AT+CFUN=1,1":"AT+CFUN=1,1"} 17 | ], 18 | "quectel":{ 19 | "qualcomm":[ 20 | {"SIM卡状态上报 > AT+QSIMSTAT?":"AT+QSIMSTAT?"}, 21 | {"设置当前使用的为卡1 > AT+QUIMSLOT=1":"AT+QUIMSLOT=1"}, 22 | {"设置当前使用的为卡2 > AT+QUIMSLOT=2":"AT+QUIMSLOT=2"}, 23 | {"查询网络信息 > AT+QNWINFO":"AT+QNWINFO"}, 24 | {"查询载波聚合参数 > AT+QCAINFO":"AT+QCAINFO"}, 25 | {"查询当前拨号模式 > AT+QCFG=\"usbnet\"":"AT+QCFG=\"usbnet\""}, 26 | {"QMI/GobiNet拨号模式 > AT+QCFG=\"usbnet\",0":"AT+QCFG=\"usbnet\",0"}, 27 | {"ECM拨号模式 > AT+QCFG=\"usbnet\",1":"AT+QCFG=\"usbnet\",1"}, 28 | {"MBIM拨号模式 > AT+QCFG=\"usbnet\",2":"AT+QCFG=\"usbnet\",2"}, 29 | {"RNDIS拨号模式 > AT+QCFG=\"usbnet\",3":"AT+QCFG=\"usbnet\",3"}, 30 | {"NCM拨号模式 > AT+QCFG=\"usbnet\",5":"AT+QCFG=\"usbnet\",5"}, 31 | {"锁4G > AT+QNWPREFCFG=\"mode_pref\",LTE":"AT+QNWPREFCFG=\"mode_pref\",LTE"}, 32 | {"锁5G > AT+QNWPREFCFG=\"mode_pref\",NR5G":"AT+QNWPREFCFG=\"mode_pref\",NR5G"}, 33 | {"锁5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"}, 34 | {"锁5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"}, 35 | {"恢复自动搜索网络 > AT+QNWPREFCFG=\"mode_pref\",AUTO":"AT+QNWPREFCFG=\"mode_pref\",AUTO"}, 36 | {"查询模组IMEI > AT+EGMR=0,7":"AT+EGMR=0,7"}, 37 | {"更改模组IMEI > AT+EGMR=1,7,\"IMEI\"":"AT+EGMR=1,7,\"在此设置IMEI\""}, 38 | {"获取模组温度 > AT+QTEMP":"AT+QTEMP"}, 39 | {"切换为USB通信端口 > AT+QCFG=\"data_interface\",0,0":"AT+QCFG=\"data_interface\",0,0"}, 40 | {"切换为PCIE通信端口 > AT+QCFG=\"data_interface\",1,0":"AT+QCFG=\"data_interface\",1,0"}, 41 | {"查看当前USB速率 > AT+QCFG=\"usbspeed\"":"AT+QCFG=\"usbspeed\""}, 42 | {"切换为USB2.0 > AT+QCFG=\"usbspeed\",\"20\"":"AT+QCFG=\"usbspeed\",\"20\""}, 43 | {"切换为USB3.1 Gen1(5Gbps) > AT+QCFG=\"usbspeed\",\"311\"":"AT+QCFG=\"usbspeed\",\"311\""}, 44 | {"切换为USB3.1 Gen1(10Gbps) > AT+QCFG=\"usbspeed\",\"312\"":"AT+QCFG=\"usbspeed\",\"312\""}, 45 | {"重置模组 > AT+QCFG=\"ResetFactory\"":"AT+QCFG=\"ResetFactory\""} 46 | ], 47 | "unisoc":[ 48 | {"SIM卡状态上报 > AT+QSIMSTAT?":"AT+QSIMSTAT?"}, 49 | {"设置当前使用的为卡1 > AT+QUIMSLOT=1":"AT+QUIMSLOT=1"}, 50 | {"设置当前使用的为卡2 > AT+QUIMSLOT=2":"AT+QUIMSLOT=2"}, 51 | {"查询网络信息 > AT+QNWINFO":"AT+QNWINFO"}, 52 | {"查询载波聚合参数 > AT+QCAINFO":"AT+QCAINFO"}, 53 | {"查询当前拨号模式 > AT+QCFG=\"usbnet\"":"AT+QCFG=\"usbnet\""}, 54 | {"ECM拨号模式 > AT+QCFG=\"usbnet\",1":"AT+QCFG=\"usbnet\",1"}, 55 | {"MBIM拨号模式 > AT+QCFG=\"usbnet\",2":"AT+QCFG=\"usbnet\",2"}, 56 | {"RNDIS拨号模式 > AT+QCFG=\"usbnet\",3":"AT+QCFG=\"usbnet\",3"}, 57 | {"NCM拨号模式 > AT+QCFG=\"usbnet\",5":"AT+QCFG=\"usbnet\",5"}, 58 | {"锁4G > AT+QNWPREFCFG=\"mode_pref\",LTE":"AT+QNWPREFCFG=\"mode_pref\",LTE"}, 59 | {"锁5G > AT+QNWPREFCFG=\"mode_pref\",NR5G":"AT+QNWPREFCFG=\"mode_pref\",NR5G"}, 60 | {"锁5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"}, 61 | {"锁5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"}, 62 | {"恢复自动搜索网络 > AT+QNWPREFCFG=\"mode_pref\",AUTO":"AT+QNWPREFCFG=\"mode_pref\",AUTO"}, 63 | {"查询模组IMEI > AT+EGMR=0,7":"AT+EGMR=0,7"}, 64 | {"更改模组IMEI > AT+EGMR=1,7,\"IMEI\"":"AT+EGMR=1,7,\"在此设置IMEI\""}, 65 | {"获取模组温度 > AT+QTEMP":"AT+QTEMP"}, 66 | {"切换为USB通信端口 > AT+QCFG=\"data_interface\",0,0":"AT+QCFG=\"data_interface\",0,0"}, 67 | {"切换为PCIE通信端口 > AT+QCFG=\"data_interface\",1,0":"AT+QCFG=\"data_interface\",1,0"}, 68 | {"查看当前USB速率 > AT+QCFG=\"usbspeed\"":"AT+QCFG=\"usbspeed\""}, 69 | {"切换为USB2.0 > AT+QCFG=\"usbspeed\",\"20\"":"AT+QCFG=\"usbspeed\",\"20\""}, 70 | {"切换为USB3.1 Gen1(5Gbps) > AT+QCFG=\"usbspeed\",\"311\"":"AT+QCFG=\"usbspeed\",\"311\""}, 71 | {"切换为USB3.1 Gen1(10Gbps) > AT+QCFG=\"usbspeed\",\"312\"":"AT+QCFG=\"usbspeed\",\"312\""}, 72 | {"重置模组 > AT+QCFG=\"ResetFactory\"":"AT+QCFG=\"ResetFactory\""} 73 | ] 74 | }, 75 | "fibocom":{ 76 | "qualcomm":[ 77 | {"设置当前使用的为卡1 > AT+GTDUALSIM=0":"AT+GTDUALSIM=0"}, 78 | {"设置当前使用的为卡2 > AT+GTDUALSIM=1":"AT+GTDUALSIM=1"}, 79 | {"ECM手动拨号 > AT+GTRNDIS=1,1":"AT+GTRNDIS=1,1"}, 80 | {"ECM拨号断开 > AT+GTRNDIS=0,1":"AT+GTRNDIS=0,1"}, 81 | {"查询当前端口模式 > AT+GTUSBMODE?":"AT+GTUSBMODE?"}, 82 | {"QMI/GobiNet拨号模式 > AT+GTUSBMODE=32":"AT+GTUSBMODE=32"}, 83 | {"ECM拨号模式 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"}, 84 | {"MBIM拨号模式 > AT+GTUSBMODE=30":"AT+GTUSBMODE=30"}, 85 | {"RNDIS拨号模式 > AT+GTUSBMODE=24":"AT+GTUSBMODE=24"}, 86 | {"NCM拨号模式 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"}, 87 | {"锁4G > AT+GTACT=2":"AT+GTACT=2"}, 88 | {"锁5G > AT+GTACT=14":"AT+GTACT=14"}, 89 | {"恢复自动搜索网络 > AT+GTACT=20":"AT+GTACT=20"}, 90 | {"查询当前连接的网络类型 > AT+PSRAT?":"AT+PSRAT?"}, 91 | {"查询模组IMEI > AT+GTSN=0,7":"AT+GTSN=0,7"}, 92 | {"更改模组IMEI > AT+GTSN=1,7,\"IMEI\"":"AT+GTSN=1,7,\"在此设置IMEI\""}, 93 | {"报告一次当前BBIC的温度 > AT+MTSM=1,6":"AT+MTSM=1,6"}, 94 | {"报告一次当前射频的温度 > AT+MTSM=1,7":"AT+MTSM=1,7"}, 95 | {"重启模组 > AT+CFUN=15":"AT+CFUN=15"} 96 | ], 97 | "unisoc":[ 98 | {"设置当前使用的为卡1 > AT+GTDUALSIM=0":"AT+GTDUALSIM=0"}, 99 | {"设置当前使用的为卡2 > AT+GTDUALSIM=1":"AT+GTDUALSIM=1"}, 100 | {"ECM手动拨号 > AT+GTRNDIS=1,1":"AT+GTRNDIS=1,1"}, 101 | {"ECM拨号断开 > AT+GTRNDIS=0,1":"AT+GTRNDIS=0,1"}, 102 | {"查询当前端口模式 > AT+GTUSBMODE?":"AT+GTUSBMODE?"}, 103 | {"ECM拨号模式 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"}, 104 | {"MBIM拨号模式 > AT+GTUSBMODE=30":"AT+GTUSBMODE=30"}, 105 | {"RNDIS拨号模式 > AT+GTUSBMODE=24":"AT+GTUSBMODE=24"}, 106 | {"NCM拨号模式 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"}, 107 | {"锁4G > AT+GTACT=2":"AT+GTACT=2"}, 108 | {"锁5G > AT+GTACT=14":"AT+GTACT=14"}, 109 | {"恢复自动搜索网络 > AT+GTACT=20":"AT+GTACT=20"}, 110 | {"查询当前连接的网络类型 > AT+PSRAT?":"AT+PSRAT?"}, 111 | {"查询模组IMEI > AT+GTSN=0,7":"AT+GTSN=0,7"}, 112 | {"更改模组IMEI > AT+GTSN=1,7,\"IMEI\"":"AT+GTSN=1,7,\"在此设置IMEI\""}, 113 | {"报告一次当前BBIC的温度 > AT+MTSM=1,6":"AT+MTSM=1,6"}, 114 | {"报告一次当前射频的温度 > AT+MTSM=1,7":"AT+MTSM=1,7"}, 115 | {"重启模组 > AT+CFUN=15":"AT+CFUN=15"} 116 | ], 117 | "mediatek":[ 118 | {"设置当前使用的为卡1 > AT+GTDUALSIM=0":"AT+GTDUALSIM=0"}, 119 | {"设置当前使用的为卡2 > AT+GTDUALSIM=1":"AT+GTDUALSIM=1"}, 120 | {"手动设置接入点 > AT+CGDCONT=3,\"IPV4V6\",\"APN\"":"AT+CGDCONT=3,\"IPV4V6\",\"在此设置APN\""}, 121 | {"手动拨号 > AT+CGACT=1,3":"AT+CGACT=1,3"}, 122 | {"停止拨号 > AT+CGACT=0,3":"AT+CGACT=0,3"}, 123 | {"查询当前端口模式 > AT+GTUSBMODE?":"AT+GTUSBMODE?"}, 124 | {"RNDIS拨号模式(40) > AT+GTUSBMODE=40":"AT+GTUSBMODE=40"}, 125 | {"RNDIS拨号模式(41) > AT+GTUSBMODE=41":"AT+GTUSBMODE=41"}, 126 | {"锁4G > AT+GTACT=2":"AT+GTACT=2"}, 127 | {"锁5G > AT+GTACT=14":"AT+GTACT=14"}, 128 | {"恢复自动搜索网络 > AT+GTACT=20":"AT+GTACT=20"}, 129 | {"查询当前连接的网络类型 > AT+PSRAT?":"AT+PSRAT?"}, 130 | {"查询载波聚合小区信息 > AT+GTCAINFO?":"AT+GTCAINFO?"}, 131 | {"查询模组IMEI > AT+GTSN=0,7":"AT+GTSN=0,7"}, 132 | {"更改模组IMEI > AT+GTSN=1,7,\"IMEI\"":"AT+GTSN=1,7,\"在此设置IMEI\""}, 133 | {"解锁FCC > AT+GTFCCLOCKMODE=0":"AT+GTFCCLOCKMODE=0"}, 134 | {"解除ESIM锁定 > AT+GTESIMCFG=0,0,0":"AT+GTESIMCFG=0,0,0"}, 135 | {"解除温控 > AT+GTTHERMAL=0":"AT+GTTHERMAL=0"}, 136 | {"获取当前温度 > AT+GTSENRDTEMP=0":"AT+GTSENRDTEMP=0"}, 137 | {"重启模组 > AT+CFUN=15":"AT+CFUN=15"} 138 | ] 139 | }, 140 | "meig":{ 141 | "qualcomm":[ 142 | {"SIM卡状态上报 > AT^SIMSLOTURC=1":"AT^SIMSLOTURC=1"}, 143 | {"获取SIM卡卡槽状态 > AT^SIMSLOT?":"AT^SIMSLOT?"}, 144 | {"设置当前使用的为卡1 > AT^SIMSLOT=1":"AT^SIMSLOT=1"}, 145 | {"设置当前使用的为卡2 > AT^SIMSLOT=2":"AT^SIMSLOT=2"}, 146 | {"查询网络信息 > AT^SYSINFOEX":"AT^SYSINFOEX"}, 147 | {"查询载波聚合小区信息 > AT^CELLINFO=3":"AT^CELLINFO=3"}, 148 | {"查询当前拨号模式 > AT+SER?":"AT+SER?"}, 149 | {"QMI/GobiNet拨号模式 > AT+SER=1,1":"AT+SER=1,1"}, 150 | {"ECM拨号模式 > AT+SER=2,1":"AT+SER=2,1"}, 151 | {"MBIM拨号模式 > AT+SER=3,1":"AT+SER=3,1"}, 152 | {"RNDIS拨号模式 > AT+SER=3,1":"AT+SER=3,1"}, 153 | {"NCM拨号模式 > AT+SER=2,1":"AT+SER=2,1"}, 154 | {"锁4G > AT^SYSCFGEX=\"03\",all,0,2,all,all,all,all,1":"AT^SYSCFGEX=\"03\",all,0,2,all,all,all,all,1"}, 155 | {"锁5G > AT^SYSCFGEX=\"04\",all,0,2,all,all,all,all,1":"AT^SYSCFGEX=\"04\",all,0,2,all,all,all,all,1"}, 156 | {"恢复自动搜索网络 > AT^SYSCFGEX=\"00\",all,0,2,all,all,all,all,1":"AT^SYSCFGEX=\"00\",all,0,2,all,all,all,all,1"}, 157 | {"查询模组IMEI > AT+LCTSN=0,7":"AT+LCTSN=0,7"}, 158 | {"更改模组IMEI > AT+LCTSN=1,7,\"IMEI\"":"AT+LCTSN=1,7,\"在此设置IMEI\""}, 159 | {"获取模组温度 > AT+TEMP":"AT+TEMP"}, 160 | {"重启模组 > AT+RESET":"AT+RESET"} 161 | ] 162 | } 163 | } 164 | } -------------------------------------------------------------------------------- /luasrc/view/modem/modem_dial_log.htm: -------------------------------------------------------------------------------- 1 | 246 | 247 | 258 | 259 | 284 | -------------------------------------------------------------------------------- /root/usr/share/modem/simcom.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #脚本目录 5 | SCRIPT_DIR="/usr/share/modem" 6 | 7 | #查询信息强度 8 | All_CSQ() 9 | { 10 | debug "All_CSQ" 11 | #信号 12 | OX=$( sh modem_at.sh $at_port "AT+CSQ" |grep "+CSQ:") 13 | OX=$(echo $OX | tr 'a-z' 'A-Z') 14 | CSQ=$(echo "$OX" | grep -o "+CSQ: [0-9]\{1,2\}" | grep -o "[0-9]\{1,2\}") 15 | if [ $CSQ = "99" ]; then 16 | CSQ="" 17 | fi 18 | if [ -n "$CSQ" ]; then 19 | CSQ_PER=$(($CSQ * 100/31))"%" 20 | CSQ_RSSI=$((2 * CSQ - 113))" dBm" 21 | else 22 | CSQ="-" 23 | CSQ_PER="-" 24 | CSQ_RSSI="-" 25 | fi 26 | } 27 | 28 | # SIMCOM获取基站信息 29 | SIMCOM_Cellinfo() 30 | { 31 | #baseinfo.gcom 32 | OX=$( sh modem_at.sh 2 "ATI") 33 | OX=$( sh modem_at.sh 2 "AT+CGEQNEG=1") 34 | 35 | #cellinfo0.gcom 36 | OX1=$( sh modem_at.sh 2 "AT+COPS=3,0;+COPS?") 37 | OX2=$( sh modem_at.sh 2 "AT+COPS=3,2;+COPS?") 38 | OX=$OX1" "$OX2 39 | 40 | #cellinfo.gcom 41 | OY1=$( sh modem_at.sh 2 "AT+CREG=2;+CREG?;+CREG=0") 42 | OY2=$( sh modem_at.sh 2 "AT+CEREG=2;+CEREG?;+CEREG=0") 43 | OY3=$( sh modem_at.sh 2 "AT+C5GREG=2;+C5GREG?;+C5GREG=0") 44 | OY=$OY1" "$OY2" "$OY3 45 | 46 | 47 | OXx=$OX 48 | OX=$(echo $OX | tr 'a-z' 'A-Z') 49 | OY=$(echo $OY | tr 'a-z' 'A-Z') 50 | OX=$OX" "$OY 51 | 52 | #debug "$OX" 53 | #debug "$OY" 54 | 55 | COPS="-" 56 | COPS_MCC="-" 57 | COPS_MNC="-" 58 | COPSX=$(echo $OXx | grep -o "+COPS: [01],0,.\+," | cut -d, -f3 | grep -o "[^\"]\+") 59 | 60 | if [ "x$COPSX" != "x" ]; then 61 | COPS=$COPSX 62 | fi 63 | 64 | COPSX=$(echo $OX | grep -o "+COPS: [01],2,.\+," | cut -d, -f3 | grep -o "[^\"]\+") 65 | 66 | if [ "x$COPSX" != "x" ]; then 67 | COPS_MCC=${COPSX:0:3} 68 | COPS_MNC=${COPSX:3:3} 69 | if [ "$COPS" = "-" ]; then 70 | COPS=$(awk -F[\;] '/'$COPS'/ {print $2}' $ROOTER/signal/mccmnc.data) 71 | [ "x$COPS" = "x" ] && COPS="-" 72 | fi 73 | fi 74 | 75 | if [ "$COPS" = "-" ]; then 76 | COPS=$(echo "$O" | awk -F[\"] '/^\+COPS: 0,0/ {print $2}') 77 | if [ "x$COPS" = "x" ]; then 78 | COPS="-" 79 | COPS_MCC="-" 80 | COPS_MNC="-" 81 | fi 82 | fi 83 | COPS_MNC=" "$COPS_MNC 84 | 85 | OX=$(echo "${OX//[ \"]/}") 86 | CID="" 87 | CID5="" 88 | RAT="" 89 | REGV=$(echo "$OX" | grep -o "+C5GREG:2,[0-9],[A-F0-9]\{2,6\},[A-F0-9]\{5,10\},[0-9]\{1,2\}") 90 | if [ -n "$REGV" ]; then 91 | LAC5=$(echo "$REGV" | cut -d, -f3) 92 | LAC5=$LAC5" ($(printf "%d" 0x$LAC5))" 93 | CID5=$(echo "$REGV" | cut -d, -f4) 94 | CID5L=$(printf "%010X" 0x$CID5) 95 | RNC5=${CID5L:1:6} 96 | RNC5=$RNC5" ($(printf "%d" 0x$RNC5))" 97 | CID5=${CID5L:7:3} 98 | CID5="Short $(printf "%X" 0x$CID5) ($(printf "%d" 0x$CID5)), Long $(printf "%X" 0x$CID5L) ($(printf "%d" 0x$CID5L))" 99 | RAT=$(echo "$REGV" | cut -d, -f5) 100 | fi 101 | REGV=$(echo "$OX" | grep -o "+CEREG:2,[0-9],[A-F0-9]\{2,4\},[A-F0-9]\{5,8\}") 102 | REGFMT="3GPP" 103 | if [ -z "$REGV" ]; then 104 | REGV=$(echo "$OX" | grep -o "+CEREG:2,[0-9],[A-F0-9]\{2,4\},[A-F0-9]\{1,3\},[A-F0-9]\{5,8\}") 105 | REGFMT="SW" 106 | fi 107 | if [ -n "$REGV" ]; then 108 | LAC=$(echo "$REGV" | cut -d, -f3) 109 | LAC=$(printf "%04X" 0x$LAC)" ($(printf "%d" 0x$LAC))" 110 | if [ $REGFMT = "3GPP" ]; then 111 | CID=$(echo "$REGV" | cut -d, -f4) 112 | else 113 | CID=$(echo "$REGV" | cut -d, -f5) 114 | fi 115 | CIDL=$(printf "%08X" 0x$CID) 116 | RNC=${CIDL:1:5} 117 | RNC=$RNC" ($(printf "%d" 0x$RNC))" 118 | CID=${CIDL:6:2} 119 | CID="Short $(printf "%X" 0x$CID) ($(printf "%d" 0x$CID)), Long $(printf "%X" 0x$CIDL) ($(printf "%d" 0x$CIDL))" 120 | 121 | else 122 | REGV=$(echo "$OX" | grep -o "+CREG:2,[0-9],[A-F0-9]\{2,4\},[A-F0-9]\{2,8\}") 123 | if [ -n "$REGV" ]; then 124 | LAC=$(echo "$REGV" | cut -d, -f3) 125 | CID=$(echo "$REGV" | cut -d, -f4) 126 | if [ ${#CID} -gt 4 ]; then 127 | LAC=$(printf "%04X" 0x$LAC)" ($(printf "%d" 0x$LAC))" 128 | CIDL=$(printf "%08X" 0x$CID) 129 | RNC=${CIDL:1:3} 130 | CID=${CIDL:4:4} 131 | CID="Short $(printf "%X" 0x$CID) ($(printf "%d" 0x$CID)), Long $(printf "%X" 0x$CIDL) ($(printf "%d" 0x$CIDL))" 132 | else 133 | LAC="" 134 | fi 135 | else 136 | LAC="" 137 | fi 138 | fi 139 | REGSTAT=$(echo "$REGV" | cut -d, -f2) 140 | if [ "$REGSTAT" == "5" -a "$COPS" != "-" ]; then 141 | COPS_MNC=$COPS_MNC" (Roaming)" 142 | fi 143 | if [ -n "$CID" -a -n "$CID5" ] && [ "$RAT" == "13" -o "$RAT" == "10" ]; then 144 | LAC="4G $LAC, 5G $LAC5" 145 | CID="4G $CID
5G $CID5" 146 | RNC="4G $RNC, 5G $RNC5" 147 | elif [ -n "$CID5" ]; then 148 | LAC=$LAC5 149 | CID=$CID5 150 | RNC=$RNC5 151 | fi 152 | if [ -z "$LAC" ]; then 153 | LAC="-" 154 | CID="-" 155 | RNC="-" 156 | fi 157 | } 158 | SIMCOM_SIMINFO() 159 | { 160 | debug "Quectel_SIMINFO" 161 | # 获取IMEI 162 | IMEI=$( sh modem_at.sh $at_port "AT+CGSN" | sed -n '2p' ) 163 | # 获取IMSI 164 | IMSI=$( sh modem_at.sh $at_port "AT+CIMI" | sed -n '2p' ) 165 | # 获取ICCID 166 | ICCID=$( sh modem_at.sh $at_port "AT+ICCID" | grep -o "+ICCID:[ ]*[-0-9]\+" | grep -o "[-0-9]\{1,4\}" ) 167 | # 获取电话号码 168 | phone=$( sh modem_at.sh $at_port "AT+CNUM" | grep "+CNUM:" ) 169 | } 170 | #simcom查找基站AT 171 | get_simcom_data() 172 | { 173 | debug "get simcom data" 174 | #设置AT串口 175 | at_port=$1 176 | 177 | All_CSQ 178 | SIMCOM_SIMINFO 179 | SIMCOM_Cellinfo 180 | 181 | #温度 182 | OX=$( sh modem_at.sh $at_port "AT+CPMUTEMP") 183 | TEMP=$(echo "$OX" | grep -o "+CPMUTEMP:[ ]*[-0-9]\+" | grep -o "[-0-9]\{1,4\}") 184 | if [ -n "$TEMP" ]; then 185 | TEMP=$(echo $TEMP)$(printf "\xc2\xb0")"C" 186 | fi 187 | 188 | 189 | #基站信息 190 | OX=$( sh modem_at.sh $at_port "AT+CPSI?") 191 | rec=$(echo "$OX" | grep "+CPSI:") 192 | w=$(echo $rec |grep "NO SERVICE"| wc -l) 193 | if [ $w -ge 1 ];then 194 | debug "NO SERVICE" 195 | return 196 | fi 197 | w=$(echo $rec |grep "NR5G_"| wc -l) 198 | if [ $w -ge 1 ];then 199 | 200 | w=$(echo $rec |grep "32768"| wc -l) 201 | if [ $w -ge 1 ];then 202 | debug "-32768" 203 | return 204 | fi 205 | 206 | debug "$rec" 207 | rec1=${rec##*+CPSI:} 208 | #echo "$rec1" 209 | MODE="${rec1%%,*}" # MODE="NR5G" 210 | rect1=${rec1#*,} 211 | rect1s="${rect1%%,*}" #Online 212 | rect2=${rect1#*,} 213 | rect2s="${rect2%%,*}" #460-11 214 | rect3=${rect2#*,} 215 | rect3s="${rect3%%,*}" #0xCFA102 216 | rect4=${rect3#*,} 217 | rect4s="${rect4%%,*}" #55744245764 218 | rect5=${rect4#*,} 219 | rect5s="${rect5%%,*}" #196 220 | rect6=${rect5#*,} 221 | rect6s="${rect6%%,*}" #NR5G_BAND78 222 | rect7=${rect6#*,} 223 | rect7s="${rect7%%,*}" #627264 224 | rect8=${rect7#*,} 225 | rect8s="${rect8%%,*}" #-940 226 | rect9=${rect8#*,} 227 | rect9s="${rect9%%,*}" #-110 228 | # "${rec1##*,}" #最后一位 229 | rect10=${rect9#*,} 230 | rect10s="${rect10%%,*}" #最后一位 231 | PCI=$rect5s 232 | LBAND="n"$(echo $rect6s | cut -d, -f0 | grep -o "BAND[0-9]\{1,3\}" | grep -o "[0-9]\+") 233 | CHANNEL=$rect7s 234 | RSCP=$(($(echo $rect8s | cut -d, -f0) / 10)) 235 | ECIO=$(($(echo $rect9s | cut -d, -f0) / 10)) 236 | if [ "$CSQ_PER" = "-" ]; then 237 | CSQ_PER=$((100 - (($RSCP + 31) * 100/-125)))"%" 238 | fi 239 | SINR=$(($(echo $rect10s | cut -d, -f0) / 10))" dB" 240 | fi 241 | w=$(echo $rec |grep "LTE"|grep "EUTRAN"| wc -l) 242 | if [ $w -ge 1 ];then 243 | rec1=${rec#*EUTRAN-} 244 | lte_band=${rec1%%,*} #EUTRAN-BAND 245 | rec1=${rec1#*,} 246 | rec1=${rec1#*,} 247 | rec1=${rec1#*,} 248 | rec1=${rec1#*,} 249 | #rec1=${rec1#*,} 250 | rec1=${rec1#*,} 251 | lte_rssi=${rec1%%,*} #LTE_RSSI 252 | lte_rssi=`expr $lte_rssi / 10` #LTE_RSSI 253 | debug "LTE_BAND=$lte_band LTE_RSSI=$lte_rssi" 254 | if [ $rssi == 0 ];then 255 | rssi=$lte_rssi 256 | fi 257 | fi 258 | w=$(echo $rec |grep "WCDMA"| wc -l) 259 | if [ $w -ge 1 ];then 260 | w=$(echo $rec |grep "UNKNOWN"|wc -l) 261 | if [ $w -ge 1 ];then 262 | debug "UNKNOWN BAND" 263 | return 264 | fi 265 | fi 266 | 267 | #CNMP 268 | OX=$( sh modem_at.sh $at_port "AT+CNMP?") 269 | CNMP=$(echo "$OX" | grep -o "+CNMP:[ ]*[0-9]\{1,3\}" | grep -o "[0-9]\{1,3\}") 270 | if [ -n "$CNMP" ]; then 271 | case $CNMP in 272 | "2"|"55" ) 273 | NETMODE="1" ;; 274 | "13" ) 275 | NETMODE="3" ;; 276 | "14" ) 277 | NETMODE="5" ;; 278 | "38" ) 279 | NETMODE="7" ;; 280 | "71" ) 281 | NETMODE="9" ;; 282 | "109" ) 283 | NETMODE="8" ;; 284 | * ) 285 | NETMODE="0" ;; 286 | esac 287 | fi 288 | 289 | # CMGRMI 信息 290 | OX=$( sh modem_at.sh $at_port "AT+CMGRMI=4") 291 | CAINFO=$(echo "$OX" | grep -o "$REGXz" | tr ' ' ':') 292 | if [ -n "$CAINFO" ]; then 293 | for CASV in $(echo "$CAINFO"); do 294 | LBAND=$LBAND"
B"$(echo "$CASV" | cut -d, -f4) 295 | BW=$(echo "$CASV" | cut -d, -f5) 296 | decode_bw 297 | LBAND=$LBAND" (CA, Bandwidth $BW MHz)" 298 | CHANNEL="$CHANNEL, "$(echo "$CASV" | cut -d, -f2) 299 | PCI="$PCI, "$(echo "$CASV" | cut -d, -f7) 300 | done 301 | fi 302 | 303 | } 304 | -------------------------------------------------------------------------------- /root/etc/config/custom_at_commands: -------------------------------------------------------------------------------- 1 | 2 | config custom-commands 3 | option description '****************通用****************' 4 | option command 'ATI' 5 | 6 | config custom-commands 7 | option description '模组信息 > ATI' 8 | option command 'ATI' 9 | 10 | config custom-commands 11 | option description '查询SIM卡状态 > AT+CPIN?' 12 | option command 'AT+CPIN?' 13 | 14 | config custom-commands 15 | option description '查询网络信号质量(4G) > AT+CSQ' 16 | option command 'AT+CSQ' 17 | 18 | config custom-commands 19 | option description '查询网络信号质量(5G) > AT+CESQ' 20 | option command 'AT+CESQ' 21 | 22 | config custom-commands 23 | option description '查询网络信息 > AT+COPS?' 24 | option command 'AT+COPS?' 25 | 26 | config custom-commands 27 | option description '查询PDP信息 > AT+CGDCONT?' 28 | option command 'AT+CGDCONT?' 29 | 30 | config custom-commands 31 | option description '查询PDP地址 > AT+CGPADDR' 32 | option command 'AT+CGPADDR' 33 | 34 | config custom-commands 35 | option description '查询模组IMEI > AT+CGSN' 36 | option command 'AT+CGSN' 37 | 38 | config custom-commands 39 | option description '查询模组IMEI > AT+GSN' 40 | option command 'AT+GSN' 41 | 42 | config custom-commands 43 | option description '查看当前电压' 44 | option command 'AT+CBC' 45 | 46 | config custom-commands 47 | option description '最小功能模式 > AT+CFUN=0' 48 | option command 'AT+CFUN=0' 49 | 50 | config custom-commands 51 | option description '全功能模式 > AT+CFUN=1' 52 | option command 'AT+CFUN=1' 53 | 54 | config custom-commands 55 | option description '重启模组 > AT+CFUN=1,1' 56 | option command 'AT+CFUN=1,1' 57 | 58 | config custom-commands 59 | option description '****************移远****************' 60 | option command 'ATI' 61 | 62 | config custom-commands 63 | option description 'SIM卡状态上报 > AT+QSIMSTAT?' 64 | option command 'AT+QSIMSTAT?' 65 | 66 | config custom-commands 67 | option description '设置当前使用的为卡1 > AT+QUIMSLOT=1' 68 | option command 'AT+QUIMSLOT=1' 69 | 70 | config custom-commands 71 | option description '设置当前使用的为卡2 > AT+QUIMSLOT=2' 72 | option command 'AT+QUIMSLOT=2' 73 | 74 | config custom-commands 75 | option description '查询网络信息 > AT+QNWINFO' 76 | option command 'AT+QNWINFO' 77 | 78 | config custom-commands 79 | option description '查询SIM卡签约速率 > AT+QNWCFG="nr5g_ambr"' 80 | option command 'AT+QNWCFG="nr5g_ambr"' 81 | 82 | config custom-commands 83 | option description '查询载波聚合参数 > AT+QCAINFO' 84 | option command 'AT+QCAINFO' 85 | 86 | config custom-commands 87 | option description '查询当前拨号模式 > AT+QCFG="usbnet"' 88 | option command 'AT+QCFG="usbnet"' 89 | 90 | config custom-commands 91 | option description 'QMI/GobiNet拨号 > AT+QCFG="usbnet",0' 92 | option command 'AT+QCFG="usbnet",0' 93 | 94 | config custom-commands 95 | option description 'ECM拨号 > AT+QCFG="usbnet",1' 96 | option command 'AT+QCFG="usbnet",1' 97 | 98 | config custom-commands 99 | option description 'MBIM拨号 > AT+QCFG="usbnet",2' 100 | option command 'AT+QCFG="usbnet",2' 101 | 102 | config custom-commands 103 | option description 'RNDIS拨号 > AT+QCFG="usbnet",3' 104 | option command 'AT+QCFG="usbnet",3' 105 | 106 | config custom-commands 107 | option description 'NCM拨号 > AT+QCFG="usbnet",5' 108 | option command 'AT+QCFG="usbnet",5' 109 | 110 | config custom-commands 111 | option description '锁4G > AT+QNWPREFCFG="mode_pref",LTE' 112 | option command 'AT+QNWPREFCFG="mode_pref",LTE' 113 | 114 | config custom-commands 115 | option description '锁5G > AT+QNWPREFCFG="mode_pref",NR5G' 116 | option command 'AT+QNWPREFCFG="mode_pref",NR5G' 117 | 118 | config custom-commands 119 | option description '锁5G NSA > AT+QNWPREFCFG="mode_pref",NR5G-NSA' 120 | option command 'AT+QNWPREFCFG="mode_pref",NR5G-NSA' 121 | 122 | config custom-commands 123 | option description '锁5G SA > AT+QNWPREFCFG="mode_pref",NR5G-SA' 124 | option command 'AT+QNWPREFCFG="mode_pref",NR5G-SA' 125 | 126 | config custom-commands 127 | option description '恢复自动搜索网络 > AT+QNWPREFCFG="mode_pref",AUTO' 128 | option command 'AT+QNWPREFCFG="mode_pref",AUTO' 129 | 130 | config custom-commands 131 | option description '查询模组IMEI > AT+EGMR=0,7' 132 | option command 'AT+EGMR=0,7' 133 | 134 | config custom-commands 135 | option description '更改模组IMEI > AT+EGMR=1,7,"IMEI"' 136 | option command 'AT+EGMR=1,7,"在此设置IMEI"' 137 | 138 | config custom-commands 139 | option description '获取模组温度 > AT+QTEMP' 140 | option command 'AT+QTEMP' 141 | 142 | config custom-commands 143 | option description '切换为USB通信端口 > AT+QCFG="data_interface",0,0' 144 | option command 'AT+QCFG="data_interface",0,0' 145 | 146 | config custom-commands 147 | option description '切换为PCIE通信端口 > AT+QCFG="data_interface",1,0' 148 | option command 'AT+QCFG="data_interface",1,0' 149 | 150 | config custom-commands 151 | option description '查看当前USB速率 > AT+QCFG="usbspeed"' 152 | option command 'AT+QCFG="usbspeed"' 153 | 154 | config custom-commands 155 | option description '切换为USB2.0 > AT+QCFG="usbspeed","20"' 156 | option command 'AT+QCFG="usbspeed","20"' 157 | 158 | config custom-commands 159 | option description '切换为USB3.1 Gen1(5Gbps) > AT+QCFG="usbspeed","311"' 160 | option command 'AT+QCFG="usbspeed","311"' 161 | 162 | config custom-commands 163 | option description '切换为USB3.1 Gen1(10Gbps) > AT+QCFG="usbspeed","312"' 164 | option command 'AT+QCFG="usbspeed","312"' 165 | 166 | config custom-commands 167 | option description '重置模组 > AT+QCFG="ResetFactory"' 168 | option command 'AT+QCFG="ResetFactory"' 169 | 170 | config custom-commands 171 | option description '****************广和通****************' 172 | option command 'ATI' 173 | 174 | config custom-commands 175 | option description '设置当前使用的为卡1 > AT+GTDUALSIM=0' 176 | option command 'AT+GTDUALSIM=0' 177 | 178 | config custom-commands 179 | option description '设置当前使用的为卡2 > AT+GTDUALSIM=1' 180 | option command 'AT+GTDUALSIM=1' 181 | 182 | config custom-commands 183 | option description 'ECM手动拨号 > AT+GTRNDIS=1,1' 184 | option command 'AT+GTRNDIS=1,1' 185 | 186 | config custom-commands 187 | option description 'ECM拨号断开 > AT+GTRNDIS=0,1' 188 | option command 'AT+GTRNDIS=0,1' 189 | 190 | config custom-commands 191 | option description '查询当前端口模式 > AT+GTUSBMODE?' 192 | option command 'AT+GTUSBMODE?' 193 | 194 | config custom-commands 195 | option description 'QMI/GobiNet拨号 > AT+GTUSBMODE=32' 196 | option command 'AT+GTUSBMODE=32' 197 | 198 | config custom-commands 199 | option description 'ECM拨号 > AT+GTUSBMODE=18' 200 | option command 'AT+GTUSBMODE=18' 201 | 202 | config custom-commands 203 | option description 'MBIM拨号 > AT+GTUSBMODE=30' 204 | option command 'AT+GTUSBMODE=30' 205 | 206 | config custom-commands 207 | option description 'RNDIS拨号 > AT+GTUSBMODE=24' 208 | option command 'AT+GTUSBMODE=24' 209 | 210 | config custom-commands 211 | option description 'NCM拨号 > AT+GTUSBMODE=18' 212 | option command 'AT+GTUSBMODE=18' 213 | 214 | config custom-commands 215 | option description '锁4G > AT+GTACT=2' 216 | option command 'AT+GTACT=2' 217 | 218 | config custom-commands 219 | option description '锁5G > AT+GTACT=14' 220 | option command 'AT+GTACT=14' 221 | 222 | config custom-commands 223 | option description '恢复自动搜索网络 > AT+GTACT=20' 224 | option command 'AT+GTACT=20' 225 | 226 | config custom-commands 227 | option description '查询当前连接的网络类型 > AT+PSRAT?' 228 | option command 'AT+PSRAT?' 229 | 230 | config custom-commands 231 | option description '查询模组IMEI > AT+GTSN=0,7' 232 | option command 'AT+GTSN=0,7' 233 | 234 | config custom-commands 235 | option description '更改模组IMEI > AT+GTSN=1,7,"IMEI"' 236 | option command 'AT+GTSN=1,7,"在此设置IMEI"' 237 | 238 | config custom-commands 239 | option description '报告一次当前BBIC的温度 > AT+MTSM=1,6' 240 | option command 'AT+MTSM=1,6' 241 | 242 | config custom-commands 243 | option description '报告一次当前射频的温度 > AT+MTSM=1,7' 244 | option command 'AT+MTSM=1,7' 245 | 246 | config custom-commands 247 | option description '获取当前温度 > AT+GTLADC' 248 | option command 'AT+GTLADC' 249 | 250 | config custom-commands 251 | option description '重启模组 > AT+CFUN=15' 252 | option command 'AT+CFUN=15' 253 | 254 | config custom-commands 255 | option description '****************美格****************' 256 | option command 'ATI' 257 | 258 | config custom-commands 259 | option description 'SIM卡状态上报 > AT^SIMSLOTURC=1' 260 | option command 'AT^SIMSLOTURC=1' 261 | 262 | config custom-commands 263 | option description '获取SIM卡卡槽状态 > AT^SIMSLOT?' 264 | option command 'AT^SIMSLOT?' 265 | 266 | config custom-commands 267 | option description '设置当前使用的为卡1 > AT^SIMSLOT=1' 268 | option command 'AT^SIMSLOT=1' 269 | 270 | config custom-commands 271 | option description '设置当前使用的为卡2 > AT^SIMSLOT=2' 272 | option command 'AT^SIMSLOT=2' 273 | 274 | config custom-commands 275 | option description '查询网络信息 > AT^SYSINFOEX' 276 | option command 'AT^SYSINFOEX' 277 | 278 | config custom-commands 279 | option description '查询载波聚合小区信息 > AT^CELLINFO=3' 280 | option command 'AT^CELLINFO=3' 281 | 282 | config custom-commands 283 | option description '查询当前拨号模式 > AT+SER?' 284 | option command 'AT+SER?' 285 | 286 | config custom-commands 287 | option description 'QMI/GobiNet拨号 > AT+SER=1,1' 288 | option command 'AT+SER=1,1' 289 | 290 | config custom-commands 291 | option description 'ECM拨号 > AT+SER=2,1' 292 | option command 'AT+SER=2,1' 293 | 294 | config custom-commands 295 | option description 'MBIM拨号 > AT+SER=3,1' 296 | option command 'AT+SER=3,1' 297 | 298 | config custom-commands 299 | option description 'RNDIS拨号 > AT+SER=3,1' 300 | option command 'AT+SER=3,1' 301 | 302 | config custom-commands 303 | option description 'NCM拨号 > AT+SER=2,1' 304 | option command 'AT+SER=2,1' 305 | 306 | config custom-commands 307 | option description '锁4G > AT^SYSCFGEX="03",all,0,2,all,all,all,all,1' 308 | option command 'AT^SYSCFGEX="03",all,0,2,all,all,all,all,1' 309 | 310 | config custom-commands 311 | option description '锁5G > AT^SYSCFGEX="04",all,0,2,all,all,all,all,1' 312 | option command 'AT^SYSCFGEX="04",all,0,2,all,all,all,all,1' 313 | 314 | config custom-commands 315 | option description '恢复自动搜索网络 > AT^SYSCFGEX="00",all,0,2,all,all,all,all,1' 316 | option command 'AT^SYSCFGEX="00",all,0,2,all,all,all,all,1' 317 | 318 | config custom-commands 319 | option description '查询模组IMEI > AT+LCTSN=0,7' 320 | option command 'AT+LCTSN=0,7' 321 | 322 | config custom-commands 323 | option description '更改模组IMEI > AT+LCTSN=1,7,"IMEI"' 324 | option command 'AT+LCTSN=1,7,"在此设置IMEI"' 325 | 326 | config custom-commands 327 | option description '获取模组温度 > AT+TEMP' 328 | option command 'AT+TEMP' 329 | 330 | config custom-commands 331 | option description '重启模组 > AT+RESET' 332 | option command 'AT+RESET' -------------------------------------------------------------------------------- /root/usr/share/modem/modem_support.json: -------------------------------------------------------------------------------- 1 | { 2 | "modem_support":{ 3 | "usb":{ 4 | "rg200u-cn":{ 5 | "manufacturer_id":"2c7c", 6 | "manufacturer":"quectel", 7 | "platform":"unisoc", 8 | "data_interface":"usb", 9 | "define_connect":"1", 10 | "modes":["ecm","mbim","rndis","ncm"] 11 | }, 12 | "rm500u-cn":{ 13 | "manufacturer_id":"2c7c", 14 | "manufacturer":"quectel", 15 | "platform":"unisoc", 16 | "data_interface":"usb", 17 | "define_connect":"1", 18 | "modes":["ecm","mbim","rndis","ncm"] 19 | }, 20 | "rm500u-ea":{ 21 | "manufacturer_id":"2c7c", 22 | "manufacturer":"quectel", 23 | "platform":"unisoc", 24 | "data_interface":"usb", 25 | "define_connect":"1", 26 | "modes":["ecm","mbim","rndis","ncm"] 27 | }, 28 | "rm500u-cnv":{ 29 | "manufacturer_id":"2c7c", 30 | "manufacturer":"quectel", 31 | "platform":"unisoc", 32 | "data_interface":"usb", 33 | "define_connect":"1", 34 | "modes":["ecm","mbim","rndis","ncm"] 35 | }, 36 | "rm500q-cn":{ 37 | "manufacturer_id":"2c7c", 38 | "manufacturer":"quectel", 39 | "platform":"qualcomm", 40 | "data_interface":"usb", 41 | "define_connect":"1", 42 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 43 | }, 44 | "rm500q-ae":{ 45 | "manufacturer_id":"2c7c", 46 | "manufacturer":"quectel", 47 | "platform":"qualcomm", 48 | "data_interface":"usb", 49 | "define_connect":"1", 50 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 51 | }, 52 | "rm500q-gl":{ 53 | "manufacturer_id":"2c7c", 54 | "manufacturer":"quectel", 55 | "platform":"qualcomm", 56 | "data_interface":"usb", 57 | "define_connect":"1", 58 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 59 | }, 60 | "rm502q-ae":{ 61 | "manufacturer_id":"2c7c", 62 | "manufacturer":"quectel", 63 | "platform":"qualcomm", 64 | "data_interface":"usb", 65 | "define_connect":"1", 66 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 67 | }, 68 | "rm502q-gl":{ 69 | "manufacturer_id":"2c7c", 70 | "manufacturer":"quectel", 71 | "platform":"qualcomm", 72 | "data_interface":"usb", 73 | "define_connect":"1", 74 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 75 | }, 76 | "rm505q-ae":{ 77 | "manufacturer_id":"2c7c", 78 | "manufacturer":"quectel", 79 | "platform":"qualcomm", 80 | "data_interface":"usb", 81 | "define_connect":"1", 82 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 83 | }, 84 | "rm520n-cn":{ 85 | "manufacturer_id":"2c7c", 86 | "manufacturer":"quectel", 87 | "platform":"qualcomm", 88 | "data_interface":"usb", 89 | "define_connect":"1", 90 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 91 | }, 92 | "rm520n-gl":{ 93 | "manufacturer_id":"2c7c", 94 | "manufacturer":"quectel", 95 | "platform":"qualcomm", 96 | "data_interface":"usb", 97 | "define_connect":"1", 98 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 99 | }, 100 | "fm650-cn":{ 101 | "manufacturer_id":"2cb7", 102 | "manufacturer":"fibocom", 103 | "platform":"unisoc", 104 | "data_interface":"usb", 105 | "define_connect":"1", 106 | "modes":["ecm","mbim","rndis","ncm"] 107 | }, 108 | "fm350-gl":{ 109 | "manufacturer_id":"0e8d", 110 | "manufacturer":"fibocom", 111 | "platform":"mediatek", 112 | "data_interface":"usb", 113 | "define_connect":"3", 114 | "modes":["rndis"] 115 | }, 116 | "fm150-ae":{ 117 | "manufacturer_id":"2cb7", 118 | "manufacturer":"fibocom", 119 | "platform":"qualcomm", 120 | "data_interface":"usb", 121 | "define_connect":"1", 122 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 123 | }, 124 | "fm160-cn":{ 125 | "manufacturer_id":"2cb7", 126 | "manufacturer":"fibocom", 127 | "platform":"qualcomm", 128 | "data_interface":"usb", 129 | "define_connect":"1", 130 | "modes":["qmi","gobinet","ecm","mbim","rndis","ncm"] 131 | }, 132 | "srm815":{ 133 | "manufacturer_id":"2dee", 134 | "manufacturer":"meig", 135 | "platform":"qualcomm", 136 | "data_interface":"usb", 137 | "define_connect":"1", 138 | "modes":["qmi","gobinet","ecm","rndis","ncm"] 139 | }, 140 | "srm825":{ 141 | "manufacturer_id":"2dee", 142 | "manufacturer":"meig", 143 | "platform":"qualcomm", 144 | "data_interface":"usb", 145 | "define_connect":"1", 146 | "modes":["qmi","gobinet","ecm","rndis","ncm"] 147 | }, 148 | "srm825n":{ 149 | "manufacturer_id":"2dee", 150 | "manufacturer":"meig", 151 | "platform":"qualcomm", 152 | "data_interface":"usb", 153 | "define_connect":"1", 154 | "modes":["qmi","gobinet","ecm","rndis","ncm"] 155 | } 156 | }, 157 | "pcie":{ 158 | "rm500q-cn":{ 159 | "manufacturer":"quectel", 160 | "platform":"qualcomm", 161 | "data_interface":"pcie", 162 | "define_connect":"1", 163 | "modes":["qmi","gobinet","mbim"] 164 | }, 165 | "rm500q-gl":{ 166 | "manufacturer":"quectel", 167 | "platform":"qualcomm", 168 | "data_interface":"pcie", 169 | "define_connect":"1", 170 | "modes":["qmi","gobinet","mbim"] 171 | }, 172 | "rg500q-ea":{ 173 | "manufacturer":"quectel", 174 | "platform":"qualcomm", 175 | "data_interface":"pcie", 176 | "define_connect":"1", 177 | "modes":["qmi","gobinet","mbim"] 178 | }, 179 | "rm502q-gl":{ 180 | "manufacturer":"quectel", 181 | "platform":"qualcomm", 182 | "data_interface":"pcie", 183 | "define_connect":"1", 184 | "modes":["qmi","gobinet","mbim"] 185 | }, 186 | "rm520n-gl":{ 187 | "manufacturer":"quectel", 188 | "platform":"qualcomm", 189 | "data_interface":"pcie", 190 | "define_connect":"1", 191 | "modes":["qmi","gobinet","mbim"] 192 | }, 193 | "rg520n-eu":{ 194 | "manufacturer":"quectel", 195 | "platform":"qualcomm", 196 | "data_interface":"pcie", 197 | "define_connect":"1", 198 | "modes":["qmi","gobinet","mbim"] 199 | }, 200 | "fm350-gl":{ 201 | "manufacturer":"fibocom", 202 | "platform":"mediatek", 203 | "data_interface":"pcie", 204 | "define_connect":"1", 205 | "modes":["mbim"] 206 | }, 207 | "fm150-ae":{ 208 | "manufacturer":"fibocom", 209 | "platform":"qualcomm", 210 | "data_interface":"pcie", 211 | "define_connect":"1", 212 | "modes":["qmi","mbim"] 213 | } 214 | }, 215 | "device":{ 216 | "quectel":{ 217 | "unisoc":{ 218 | "vendor_id":["2c7c"], 219 | "product_id":["6001","6002","6004","6005","6006","6007","0900","0901","0902","0903","0904"] 220 | }, 221 | "qualcomm":{ 222 | "vendor_id":["2c7c"], 223 | "product_id":["0121","0125","0191","0195","0296","0306","030b","0435","0452","0455","0512","0620","0800","0801"] 224 | }, 225 | "mediatek":{ 226 | "vendor_id":["2c7c"], 227 | "product_id":["0700","7001","7003"] 228 | } 229 | }, 230 | "fibocom":{ 231 | "unisoc":{ 232 | "vendor_id":["2cb7","3c93","3763"], 233 | "product_id":["0a04","0a05","0a06","0a07","3c93","ffff"] 234 | }, 235 | "qualcomm":{ 236 | "vendor_id":["2cb7"], 237 | "product_id":["0104","0105","0106","0107","0108","0109","010A","010B","010F","0110","0111"] 238 | }, 239 | "mediatek":{ 240 | "vendor_id":["0e8d"], 241 | "product_id":["7126","7127"] 242 | } 243 | }, 244 | "meig":{ 245 | "unisoc":{ 246 | "vendor_id":["2dee"], 247 | "product_id":["4d50","4d51","4d52","4d53"] 248 | }, 249 | "qualcomm":{ 250 | "vendor_id":["2dee","05c6"], 251 | "product_id":["4d22","4d23","4d38","4d45","f601"] 252 | }, 253 | "hisilicon":{ 254 | "vendor_id":["2dee","4d20"], 255 | "product_id":["7126","7127"] 256 | }, 257 | "asrmicro":{ 258 | "vendor_id":["2dee"], 259 | "product_id":["4d57","4d58","4d59"] 260 | } 261 | } 262 | } 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /root/usr/share/modem/modem_network_task.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #脚本目录 5 | SCRIPT_DIR="/usr/share/modem" 6 | 7 | #运行目录 8 | MODEM_RUNDIR="/var/run/modem" 9 | 10 | #导入组件工具 11 | source "${SCRIPT_DIR}/modem_debug.sh" 12 | 13 | #重设网络接口 14 | # $1:AT串口 15 | # $4:连接定义 16 | # $5:模组序号 17 | reset_network_interface() 18 | { 19 | local at_port="$1" 20 | local define_connect="$2" 21 | local modem_no="$3" 22 | 23 | local interface_name="wwan_5g_${modem_no}" 24 | local interface_name_ipv6="wwan6_5g_${modem_no}" 25 | 26 | #获取IPv4地址 27 | at_command="AT+CGPADDR=${define_connect}" 28 | local ipv4=$(at ${at_port} ${at_command} | grep "+CGPADDR: " | awk -F',' '{print $2}' | sed 's/"//g') 29 | #输出日志 30 | # echo "[$(date +"%Y-%m-%d %H:%M:%S")] Get Modem new IPv4 address : ${ipv4}" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 31 | 32 | #获取DNS地址 33 | dns=$(fibocom_get_dns ${at_port} ${define_connect}) 34 | local ipv4_dns1=$(echo "${dns}" | jq -r '.dns.ipv4_dns1') 35 | local ipv4_dns2=$(echo "${dns}" | jq -r '.dns.ipv4_dns2') 36 | #输出日志 37 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Get Modem IPv4 DNS1: ${ipv4_dns1}" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 38 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Get Modem IPv4 DNS2: ${ipv4_dns2}" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 39 | 40 | #比较的网络接口中的IPv4地址 41 | local ipv4_config=$(uci -q get network.${interface_name}.ipaddr) 42 | if [ "$ipv4_config" == "$ipv4" ]; then 43 | #输出日志 44 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] IPv4 address is the same as in the network interface, skip" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 45 | else 46 | #输出日志 47 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Reset network interface ${interface_name}" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 48 | 49 | #设置静态地址 50 | uci set network.${interface_name}.proto='static' 51 | uci set network.${interface_name}.ipaddr="${ipv4}" 52 | uci set network.${interface_name}.netmask='255.255.255.0' 53 | uci set network.${interface_name}.gateway="${ipv4%.*}.1" 54 | uci set network.${interface_name}.peerdns='0' 55 | uci -q del network.${interface_name}.dns 56 | uci add_list network.${interface_name}.dns="${ipv4_dns1}" 57 | uci add_list network.${interface_name}.dns="${ipv4_dns2}" 58 | uci commit network 59 | service network reload 60 | 61 | #输出日志 62 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Reset network interface successful" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 63 | fi 64 | } 65 | 66 | #GobiNet拨号 67 | # $1:AT串口 68 | # $2:制造商 69 | # $3:连接定义 70 | gobinet_dial() 71 | { 72 | local at_port="$1" 73 | local manufacturer="$2" 74 | local define_connect="$3" 75 | 76 | #激活 77 | local at_command="AT+CGACT=1,${define_connect}" 78 | #打印日志 79 | dial_log "${at_command}" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 80 | 81 | at "${at_port}" "${at_command}" 82 | 83 | #拨号 84 | local at_command 85 | if [ "$manufacturer" = "quectel" ]; then 86 | #移远不走该分支 87 | at_command='ATI' 88 | elif [ "$manufacturer" = "fibocom" ]; then 89 | at_command='AT$QCRMCALL=1,3' 90 | elif [ "$manufacturer" = "meig" ]; then 91 | at_command="AT$QCRMCALL=1,1,${define_connect},2,1" 92 | else 93 | at_command='ATI' 94 | fi 95 | 96 | #打印日志 97 | dial_log "${at_command}" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 98 | 99 | at "${at_port}" "${at_command}" 100 | } 101 | 102 | #ECM拨号 103 | # $1:AT串口 104 | # $2:制造商 105 | # $3:连接定义 106 | ecm_dial() 107 | { 108 | local at_port="$1" 109 | local manufacturer="$2" 110 | local define_connect="$3" 111 | 112 | #激活 113 | # local at_command="AT+CGACT=1,${define_connect}" 114 | # #打印日志 115 | # dial_log "${at_command}" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 116 | 117 | # at "${at_port}" "${at_command}" 118 | 119 | #拨号 120 | at_command 121 | if [ "$manufacturer" = "quectel" ]; then 122 | at_command="AT+QNETDEVCTL=${define_connect},3,1" 123 | elif [ "$manufacturer" = "fibocom" ]; then 124 | at_command="AT+GTRNDIS=1,${define_connect}" 125 | elif [ "$manufacturer" = "meig" ]; then 126 | at_command="AT^NDISDUP=${define_connect},1" 127 | else 128 | at_command='ATI' 129 | fi 130 | 131 | #打印日志 132 | dial_log "${at_command}" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 133 | 134 | at "${at_port}" "${at_command}" 135 | 136 | sleep 2s 137 | } 138 | 139 | #RNDIS拨号 140 | # $1:AT串口 141 | # $2:制造商 142 | # $3:平台 143 | # $4:连接定义 144 | # $5:模组序号 145 | rndis_dial() 146 | { 147 | local at_port="$1" 148 | local manufacturer="$2" 149 | local platform="$3" 150 | local define_connect="$4" 151 | local modem_no="$5" 152 | 153 | #手动设置IP(广和通FM350-GL) 154 | if [ "$manufacturer" = "fibocom" ] && [ "$platform" = "mediatek" ]; then 155 | 156 | at_command="AT+CGACT=1,${define_connect}" 157 | #打印日志 158 | dial_log "${at_command}" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 159 | #激活并拨号 160 | at "${at_port}" "${at_command}" 161 | 162 | sleep 3s 163 | else 164 | #拨号 165 | ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" 166 | fi 167 | } 168 | 169 | #Modem Manager拨号 170 | # $1:接口名称 171 | # $2:连接定义 172 | modemmanager_dial() 173 | { 174 | local interface_name="$1" 175 | local define_connect="$2" 176 | 177 | # #激活 178 | # local at_command="AT+CGACT=1,${define_connect}" 179 | # #打印日志 180 | # dial_log "${at_command}" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 181 | # at "${at_port}" "${at_command}" 182 | 183 | #启动网络接口 184 | ifup "${interface_name}"; 185 | } 186 | 187 | #检查模组网络连接 188 | # $1:配置ID 189 | # $2:模组序号 190 | # $3:拨号模式 191 | modem_network_task() 192 | { 193 | local config_id="$1" 194 | local modem_no="$2" 195 | local mode="$3" 196 | 197 | #获取AT串口,制造商,平台,连接定义,接口名称 198 | local at_port=$(uci -q get modem.modem${modem_no}.at_port) 199 | local manufacturer=$(uci -q get modem.modem${modem_no}.manufacturer) 200 | local platform=$(uci -q get modem.modem${modem_no}.platform) 201 | local define_connect=$(uci -q get modem.modem${modem_no}.define_connect) 202 | local interface_name="wwan_5g_${modem_no}" 203 | local interface_name_ipv6="wwan6_5g_${modem_no}" 204 | 205 | #重载配置(解决AT命令发不出去的问题) 206 | # service modem reload 207 | 208 | #IPv4地址缓存 209 | local ipv4_cache 210 | 211 | #输出日志 212 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Start network task" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 213 | while true; do 214 | #全局 215 | local enable_dial=$(uci -q get modem.@global[0].enable_dial) 216 | if [ "$enable_dial" != "1" ]; then 217 | #输出日志 218 | 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" 219 | break 220 | fi 221 | #单个模组 222 | enable=$(uci -q get modem.${config_id}.enable) 223 | if [ "$enable" != "1" ]; then 224 | #输出日志 225 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] The modem has disabled dialing, this network task quit" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 226 | break 227 | fi 228 | 229 | #网络连接检查 230 | local at_command="AT+CGPADDR=${define_connect}" 231 | local ipv4=$(at ${at_port} ${at_command} | grep "+CGPADDR: " | awk -F',' '{print $2}' | sed 's/"//g') 232 | 233 | if [ -z "$ipv4" ]; then 234 | 235 | [ "$mode" = "modemmanager" ] && { 236 | #拨号工具为modemmanager时,不需要重新设置连接定义 237 | continue 238 | } 239 | 240 | #输出日志 241 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Unable to get IPv4 address" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 242 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Redefine connect to ${define_connect}" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 243 | service modem reload 244 | 245 | #输出日志 246 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Modem dial" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 247 | #拨号(针对获取IPv4返回为空的模组) 248 | case "$mode" in 249 | "gobinet") gobinet_dial "${at_port}" "${manufacturer}" "${define_connect}" ;; 250 | "ecm") ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" ;; 251 | "rndis") rndis_dial "${at_port}" "${manufacturer}" "${platform}" "${define_connect}" "${modem_no}" ;; 252 | "modemmanager") modemmanager_dial "${interface_name}" "${define_connect}" ;; 253 | *) ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" ;; 254 | esac 255 | 256 | elif [[ "$ipv4" = *"0.0.0.0"* ]]; then 257 | 258 | #输出日志 259 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Modem${modem_no} current IPv4 address : ${ipv4}" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 260 | 261 | #输出日志 262 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Modem dial" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 263 | #拨号 264 | case "$mode" in 265 | "gobinet") gobinet_dial "${at_port}" "${manufacturer}" "${define_connect}" ;; 266 | "ecm") ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" ;; 267 | "rndis") rndis_dial "${at_port}" "${manufacturer}" "${platform}" "${define_connect}" "${modem_no}" ;; 268 | "modemmanager") modemmanager_dial "${interface_name}" "${define_connect}" ;; 269 | *) ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" ;; 270 | esac 271 | 272 | elif [ "$ipv4" != "$ipv4_cache" ]; then 273 | 274 | #第一次缓存IP为空时不输出日志 275 | [ -n "$ipv4_cache" ] && { 276 | #输出日志 277 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Modem${modem_no} IPv4 address has changed" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 278 | } 279 | 280 | #输出日志 281 | echo "[$(date +"%Y-%m-%d %H:%M:%S")] Modem${modem_no} current IPv4 address : ${ipv4}" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 282 | 283 | #缓存当前IP 284 | ipv4_cache="${ipv4}" 285 | 286 | #重新设置网络接口(广和通FM350-GL) 287 | if [ "$manufacturer" = "fibocom" ] && [ "$platform" = "mediatek" ]; then 288 | reset_network_interface "${at_port}" "${define_connect}" "${modem_no}" 289 | sleep 3s 290 | fi 291 | 292 | [ "$mode" != "modemmanager" ] && { 293 | #重新启动网络接口 294 | ifup "${interface_name}" 295 | ifup "${interface_name_ipv6}" 296 | } 297 | fi 298 | sleep 5s 299 | done 300 | } 301 | 302 | modem_network_task "$1" "$2" "$3" -------------------------------------------------------------------------------- /po/zh-cn/modem.po: -------------------------------------------------------------------------------- 1 | # 2 | # Siriling , 2023. 3 | # 4 | msgid "" 5 | msgstr "" 6 | "Project-Id-Version: luci-app-modem 1.4.1-1\n" 7 | "POT-Creation-Date: 2024-04-20 12:07+0100\n" 8 | "PO-Revision-Date: 2024-04-24 18:08+0000\n" 9 | "Last-Translator: Siriling \n" 10 | "Language-Team: Chinese (Simplified) \n" 12 | "Language: zh_Hans\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Plural-Forms: nplurals=1; plural=0;\n" 17 | "X-Generator: Weblate 5.5-dev\n" 18 | 19 | msgid "Base Setting" 20 | msgstr "基本设置" 21 | 22 | msgid "Modem" 23 | msgstr "移动通信模组" 24 | 25 | msgid "Modem Config" 26 | msgstr "模组配置" 27 | 28 | msgid "Modem Status" 29 | msgstr "模组状态" 30 | 31 | msgid "Modem Name" 32 | msgstr "模组名称" 33 | 34 | msgid "Modem Debug" 35 | msgstr "模组调试" 36 | 37 | msgid "Modem Select" 38 | msgstr "模组选择" 39 | 40 | msgid "Check the information of the adapted modem" 41 | msgstr "查看已适配模组的信息" 42 | 43 | msgid "Not adapted to this modem" 44 | msgstr "未适配该模组" 45 | 46 | msgid "(Check adapted modem)" 47 | msgstr "(查看已适配模组)" 48 | 49 | msgid "Loading modem information" 50 | msgstr "正在加载模组信息" 51 | 52 | msgid "Loading modem status" 53 | msgstr "正在加载模组状态" 54 | 55 | msgid "Loading modem" 56 | msgstr "正在加载模组" 57 | 58 | msgid "Dial Overview" 59 | msgstr "拨号总览" 60 | 61 | msgid "Check and add modem dialing configurations" 62 | msgstr "查看和添加模组拨号配置" 63 | 64 | msgid "Global Config" 65 | msgstr "全局配置" 66 | 67 | msgid "Dial Log" 68 | msgstr "拨号日志" 69 | 70 | msgid "Download Log" 71 | msgstr "下载日志" 72 | 73 | msgid "connect" 74 | msgstr "已连接" 75 | 76 | msgid "disconnect" 77 | msgstr "未连接" 78 | 79 | msgid "disabled" 80 | msgstr "未启用" 81 | 82 | msgid "Data Interface" 83 | msgstr "数据接口" 84 | 85 | msgid "Mode" 86 | msgstr "模式" 87 | 88 | msgid "Connect Status" 89 | msgstr "连接状态" 90 | 91 | msgid "Dial Config" 92 | msgstr "拨号配置" 93 | 94 | msgid "Config List" 95 | msgstr "配置列表" 96 | 97 | msgid "Debug Your Module" 98 | msgstr "调试你的模组" 99 | 100 | msgid "Select a modem for debugging" 101 | msgstr "选择一个模组进行调试" 102 | 103 | msgid "Network Preferences" 104 | msgstr "网络偏好" 105 | 106 | msgid "Self Test" 107 | msgstr "自检" 108 | 109 | msgid "Current" 110 | msgstr "当前" 111 | 112 | msgid "Option" 113 | msgstr "选项" 114 | 115 | msgid "Config" 116 | msgstr "配置" 117 | 118 | msgid "Item" 119 | msgstr "项目" 120 | 121 | msgid "Voltage" 122 | msgstr "电压" 123 | 124 | msgid "Status" 125 | msgstr "状态" 126 | 127 | msgid "Abnormal" 128 | msgstr "异常" 129 | 130 | msgid "Normal" 131 | msgstr "正常" 132 | 133 | msgid "Low" 134 | msgstr "偏低" 135 | 136 | msgid "Somewhat High" 137 | msgstr "偏高" 138 | 139 | msgid "Excessively High" 140 | msgstr "过高" 141 | 142 | msgid "AT Command" 143 | msgstr "AT命令" 144 | 145 | msgid "Quick Option" 146 | msgstr "快捷选项" 147 | 148 | msgid "Auto" 149 | msgstr "自动" 150 | 151 | msgid "Custom" 152 | msgstr "自定义" 153 | 154 | msgid "Quick Commands" 155 | msgstr "快捷命令" 156 | 157 | msgid "Enter Command" 158 | msgstr "输入命令" 159 | 160 | msgid "Apply" 161 | msgstr "应用" 162 | 163 | msgid "Send" 164 | msgstr "发送" 165 | 166 | msgid "Clean" 167 | msgstr "清空" 168 | 169 | msgid "Response" 170 | msgstr "响应" 171 | 172 | msgid "Return to old page" 173 | msgstr "返回旧界面" 174 | 175 | msgid "Return to modem debug" 176 | msgstr "返回模组调试界面" 177 | 178 | msgid "Custom quick commands" 179 | msgstr "自定义快捷命令" 180 | 181 | msgid "Customize your quick commands" 182 | msgstr "自定义你的快捷命令" 183 | 184 | msgid "Custom Commands" 185 | msgstr "自定义命令" 186 | 187 | msgid "Serial Number" 188 | msgstr "序号" 189 | 190 | msgid "Description" 191 | msgstr "描述" 192 | 193 | msgid "Command" 194 | msgstr "命令" 195 | 196 | msgid "Modem Information" 197 | msgstr "模组信息" 198 | 199 | msgid "No modems found" 200 | msgstr "没有找到模组" 201 | 202 | msgid "(Check the reason)" 203 | msgstr "(查看原因)" 204 | 205 | msgid "Enable dial configurations" 206 | msgstr "启用拨号配置" 207 | 208 | msgid "General Settings" 209 | msgstr "通用配置" 210 | 211 | msgid "Advanced Settings" 212 | msgstr "高级配置" 213 | 214 | msgid "Remarks" 215 | msgstr "备注" 216 | 217 | msgid "Mobile Network" 218 | msgstr "移动网络" 219 | 220 | msgid "UNKNOWN" 221 | msgstr "未知" 222 | 223 | msgid "Unknown" 224 | msgstr "未知" 225 | 226 | msgid "unknown" 227 | msgstr "未知" 228 | 229 | msgid "Mobile network not found" 230 | msgstr "未发现移动网络" 231 | 232 | msgid "The network device was not found" 233 | msgstr "找不到网络设备" 234 | 235 | msgid "Only display the modes available for the adaptation modem" 236 | msgstr "仅显示适配模组可用的拨号模式" 237 | 238 | msgid "Config ID" 239 | msgstr "配置 ID" 240 | 241 | msgid "Dial Tool" 242 | msgstr "拨号工具" 243 | 244 | msgid "After switching the dialing tool, it may be necessary to restart the module or restart the router to recognize the module." 245 | msgstr "切换拨号工具后,可能需要重启模组或重启路由器才能识别模组。" 246 | 247 | msgid "Auto Choose" 248 | msgstr "自动选择" 249 | 250 | msgid "quectel-CM" 251 | msgstr "移远模组拨号工具" 252 | 253 | msgid "mmcli" 254 | msgstr "调制解调器管理工具" 255 | 256 | msgid "PDP Type" 257 | msgstr "网络类型" 258 | 259 | msgid "Network Bridge" 260 | msgstr "网络桥接" 261 | 262 | msgid "After checking, enable network interface bridge." 263 | msgstr "勾选后,启用网络接口桥接。" 264 | 265 | msgid "APN" 266 | msgstr "接入点" 267 | 268 | msgid "China Mobile" 269 | msgstr "中国移动" 270 | 271 | msgid "China Unicom" 272 | msgstr "中国联通" 273 | 274 | msgid "China Telecom" 275 | msgstr "中国电信" 276 | 277 | msgid "China Broadcast" 278 | msgstr "中国广电" 279 | 280 | msgid "Skytone" 281 | msgstr "天际通" 282 | 283 | msgid "Authentication Type" 284 | msgstr "认证类型" 285 | 286 | msgid "PAP/CHAP (both)" 287 | msgstr "PAP/CHAP (均使用)" 288 | 289 | msgid "NONE" 290 | msgstr "无" 291 | 292 | msgid "PAP/CHAP Username" 293 | msgstr "PAP/CHAP 用户名" 294 | 295 | msgid "PAP/CHAP Password" 296 | msgstr "PAP/CHAP 密码" 297 | 298 | msgid "Message" 299 | msgstr "信息" 300 | 301 | msgid "Base Information" 302 | msgstr "基本信息" 303 | 304 | msgid "Manufacturer" 305 | msgstr "制造商" 306 | 307 | msgid "Revision" 308 | msgstr "固件版本" 309 | 310 | msgid "AT Port" 311 | msgstr "AT串口" 312 | 313 | msgid "Temperature" 314 | msgstr "温度" 315 | 316 | msgid "Update Time" 317 | msgstr "更新时间" 318 | 319 | msgid "SIM Information" 320 | msgstr "SIM卡信息" 321 | 322 | msgid "Unknown SIM card status" 323 | msgstr "未知SIM卡状态" 324 | 325 | msgid "SIM card not inserted" 326 | msgstr "SIM卡未插入" 327 | 328 | msgid "ISP" 329 | msgstr "运营商" 330 | 331 | msgid "SIM Status" 332 | msgstr "SIM卡状态" 333 | 334 | msgid "miss" 335 | msgstr "未插入" 336 | 337 | msgid "locked" 338 | msgstr "锁定" 339 | 340 | msgid "SIM Slot" 341 | msgstr "SIM卡卡槽" 342 | 343 | msgid "SIM Number" 344 | msgstr "SIM卡号码" 345 | 346 | msgid "IMEI" 347 | msgstr "国际移动设备识别码" 348 | 349 | msgid "IMSI" 350 | msgstr "国际移动用户识别码" 351 | 352 | msgid "ICCID" 353 | msgstr "集成电路卡识别码" 354 | 355 | msgid "Network Information" 356 | msgstr "网络信息" 357 | 358 | msgid "Network Type" 359 | msgstr "网络类型" 360 | 361 | msgid "CQI UL" 362 | msgstr "上行信道质量指示" 363 | 364 | msgid "CQI DL" 365 | msgstr "下行信道质量指示" 366 | 367 | msgid "AMBR UL" 368 | msgstr "上行访问最大比特率" 369 | 370 | msgid "AMBR DL" 371 | msgstr "下行访问最大比特率" 372 | 373 | msgid "Tx Rate" 374 | msgstr "上传速率" 375 | 376 | msgid "Rx Rate" 377 | msgstr "下载速率" 378 | 379 | msgid "RSSI" 380 | msgstr "接收信号强度指示" 381 | 382 | msgid "BER" 383 | msgstr "信道误码率" 384 | 385 | msgid "Cell Information" 386 | msgstr "小区信息" 387 | 388 | msgid "Network Mode" 389 | msgstr "网络模式" 390 | 391 | msgid "NR5G-SA Mode" 392 | msgstr "NR5G-SA 模式" 393 | 394 | msgid "EN-DC Mode" 395 | msgstr "EN-DC 模式" 396 | 397 | msgid "LTE Mode" 398 | msgstr "LTE 模式" 399 | 400 | msgid "WCDMA Mode" 401 | msgstr "WCDMA 模式" 402 | 403 | msgid "GSM Mode" 404 | msgstr "GSM 模式" 405 | 406 | msgid "MCC" 407 | msgstr "移动国家代码 (MCC)" 408 | 409 | msgid "MNC" 410 | msgstr "移动网络代码 (MNC)" 411 | 412 | msgid "Duplex Mode" 413 | msgstr "双工模式 (Duplex Mode)" 414 | 415 | msgid "LAC" 416 | msgstr "位置区码 (LAC)" 417 | 418 | msgid "Cell ID" 419 | msgstr "小区ID (Cell ID)" 420 | 421 | msgid "Physical Cell ID" 422 | msgstr "物理小区ID (Physical Cell ID)" 423 | 424 | msgid "TAC" 425 | msgstr "跟踪区编码 (TAC)" 426 | 427 | msgid "ARFCN" 428 | msgstr "绝对射频信道号 (ARFCN)" 429 | 430 | msgid "EARFCN" 431 | msgstr "E-UTRA绝对射频信道号 (EARFCN)" 432 | 433 | msgid "UARFCN" 434 | msgstr "UTRA绝对射频信道号 (UARFCN)" 435 | 436 | msgid "Band" 437 | msgstr "频段 (Band)" 438 | 439 | msgid "Freq band indicator" 440 | msgstr "频带指示 (Freq band indicator)" 441 | 442 | msgid "UL Bandwidth" 443 | msgstr "上行带宽 (UL Bandwidth)" 444 | 445 | msgid "DL Bandwidth" 446 | msgstr "下行带宽 (DL Bandwidth)" 447 | 448 | msgid "RSRP" 449 | msgstr "参考信号接收功率 (RSRP)" 450 | 451 | msgid "RSRQ" 452 | msgstr "参考信号接收质量 (RSRQ)" 453 | 454 | msgid "RSSI" 455 | msgstr "接收信号强度指示 (RSSI)" 456 | 457 | msgid "SINR" 458 | msgstr "信号与干扰加噪声比 (SINR)" 459 | 460 | msgid "RxLev" 461 | msgstr "接收信号功率 (RxLev)" 462 | 463 | msgid "RSSNR" 464 | msgstr "信号干扰比 (RSSNR)" 465 | 466 | msgid "SCS" 467 | msgstr "NR子载波间隔 (SCS)" 468 | 469 | msgid "CQI" 470 | msgstr "信道质量指示 (CQI)" 471 | 472 | msgid "TX Power" 473 | msgstr "TX 功率 (TX Power)" 474 | 475 | msgid "Srxlev" 476 | msgstr "服务小区接收信号功率 (Srxlev)" 477 | 478 | msgid "PSC" 479 | msgstr "主扰码 (PSC)" 480 | 481 | msgid "RAC" 482 | msgstr "路由区域码 (RAC)" 483 | 484 | msgid "RSCP" 485 | msgstr "接收信号码功率 (RSCP)" 486 | 487 | msgid "Eb/Io" 488 | msgstr "每比特能量与干扰功率密度(干扰比)之比" 489 | 490 | msgid "Eb/No" 491 | msgstr "每比特能量与噪声功率密度(噪声比)之比" 492 | 493 | msgid "Ec/Io" 494 | msgstr "每码片能量与干扰功率密度(干扰比)之比" 495 | 496 | msgid "Ec/No" 497 | msgstr "每码片能量与噪声功率密度(噪声比)之比" 498 | 499 | msgid "Physical Channel" 500 | msgstr "物理信道 (Physical Channel)" 501 | 502 | msgid "Spreading Factor" 503 | msgstr "扩频因子 (Spreading Factor)" 504 | 505 | msgid "Slot" 506 | msgstr "插槽格式 (Slot)" 507 | 508 | msgid "Speech Code" 509 | msgstr "语音编码 (Speech Code)" 510 | 511 | msgid "Compression Mode" 512 | msgstr "压缩模式 (Compression Mode)" 513 | 514 | msgid "CHN-CMCC" 515 | msgstr "中国移动" 516 | 517 | msgid "CMCC" 518 | msgstr "中国移动" 519 | 520 | msgid "46000" 521 | msgstr "中国移动" 522 | 523 | msgid "CHN-UNICOM" 524 | msgstr "中国联通" 525 | 526 | msgid "UNICOM" 527 | msgstr "中国联通" 528 | 529 | msgid "CUCC" 530 | msgstr "中国联通" 531 | 532 | msgid "46001" 533 | msgstr "中国联通" 534 | 535 | msgid "CHN-CT" 536 | msgstr "中国电信" 537 | 538 | msgid "CHN-TELECOM" 539 | msgstr "中国电信" 540 | 541 | msgid "CTCC" 542 | msgstr "中国电信" 543 | 544 | msgid "CT" 545 | msgstr "中国电信" 546 | 547 | msgid "46011" 548 | msgstr "中国电信" 549 | 550 | msgid "Excellent" 551 | msgstr "优秀" 552 | 553 | msgid "Good" 554 | msgstr "良好" 555 | 556 | msgid "Fair" 557 | msgstr "一般" 558 | 559 | msgid "Bad" 560 | msgstr "较差" 561 | 562 | msgid "Plugin Config" 563 | msgstr "插件配置" 564 | 565 | msgid "Check and modify the plugin configuration" 566 | msgstr "查看和修改插件配置" 567 | 568 | msgid "Modem Scan" 569 | msgstr "模组扫描" 570 | 571 | msgid "Scan" 572 | msgstr "扫描" 573 | 574 | msgid "Scaning modem..." 575 | msgstr "正在扫描中..." 576 | 577 | msgid "The automatic configuration modem is triggered only at modem startup, otherwise, manual scanning is necessary" 578 | msgstr "自动配置模组只有在模组启动的时候才会触发,其他情况需要手动点击扫描" 579 | 580 | msgid "Manual Configuration" 581 | msgstr "手动配置" 582 | 583 | msgid "Enable the manual configuration of modem information" 584 | msgstr "启用手动配置模组信息" 585 | 586 | msgid "(After enable, the automatic scanning and configuration function for modem information will be disabled)" 587 | msgstr "(启用后将禁用自动扫描并配置模组信息功能)" 588 | 589 | msgid "Network Interface Alias" 590 | msgstr "网络接口别名" 591 | 592 | msgid "Enable automatic creation of network interface alias (Effective upon reinstatement of dialing configuration)" 593 | msgstr "启用自动创建网络接口别名(重新启用拨号配置后生效)" 594 | 595 | msgid "Not null" 596 | msgstr "不能为空" 597 | 598 | msgid "missing" 599 | msgstr "有必填选项为空值" 600 | 601 | msgid "Plugin Info" 602 | msgstr "插件信息" 603 | 604 | msgid "Check the version information of the plugin" 605 | msgstr "查看插件的版本信息" 606 | 607 | msgid "Plugin Version" 608 | msgstr "插件版本" 609 | 610 | msgid "Dial Tool Info" 611 | msgstr "拨号工具信息" 612 | 613 | msgid "Version" 614 | msgstr "版本" 615 | 616 | msgid "Not installed" 617 | msgstr "未安装" 618 | 619 | msgid "Modem General Driver Info" 620 | msgstr "模组通用驱动信息" 621 | 622 | msgid "Driver Type" 623 | msgstr "驱动类型" 624 | 625 | msgid "Kernel Model" 626 | msgstr "内核模块" 627 | 628 | msgid "USB Network" 629 | msgstr "USB网络" 630 | 631 | msgid "Serial Port" 632 | msgstr "串口" 633 | 634 | msgid "Loaded" 635 | msgstr "已加载" 636 | 637 | msgid "Not loaded" 638 | msgstr "未加载" 639 | 640 | msgid "Modem USB Driver Info" 641 | msgstr "模组USB驱动信息" 642 | 643 | msgid "Modem PCIE Driver Info" 644 | msgstr "模组PCIE驱动信息" 645 | 646 | msgid "General" 647 | msgstr "通用" 648 | 649 | msgid "Private" 650 | msgstr "私有" 651 | 652 | msgid "Private (Quectel)" 653 | msgstr "私有(移远)" 654 | 655 | msgid "Private (Fibocom)" 656 | msgstr "私有(广和通)" 657 | 658 | msgid "Private (Meig)" 659 | msgstr "私有(美格)" -------------------------------------------------------------------------------- /po/zh_Hans/modem.po: -------------------------------------------------------------------------------- 1 | # 2 | # Siriling , 2023. 3 | # 4 | msgid "" 5 | msgstr "" 6 | "Project-Id-Version: luci-app-modem 1.4.1-1\n" 7 | "POT-Creation-Date: 2024-04-20 12:07+0100\n" 8 | "PO-Revision-Date: 2024-04-24 18:08+0000\n" 9 | "Last-Translator: Siriling \n" 10 | "Language-Team: Chinese (Simplified) \n" 12 | "Language: zh_Hans\n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Plural-Forms: nplurals=1; plural=0;\n" 17 | "X-Generator: Weblate 5.5-dev\n" 18 | 19 | msgid "Base Setting" 20 | msgstr "基本设置" 21 | 22 | msgid "Modem" 23 | msgstr "移动通信模组" 24 | 25 | msgid "Modem Config" 26 | msgstr "模组配置" 27 | 28 | msgid "Modem Status" 29 | msgstr "模组状态" 30 | 31 | msgid "Modem Name" 32 | msgstr "模组名称" 33 | 34 | msgid "Modem Debug" 35 | msgstr "模组调试" 36 | 37 | msgid "Modem Select" 38 | msgstr "模组选择" 39 | 40 | msgid "Check the information of the adapted modem" 41 | msgstr "查看已适配模组的信息" 42 | 43 | msgid "Not adapted to this modem" 44 | msgstr "未适配该模组" 45 | 46 | msgid "(Check adapted modem)" 47 | msgstr "(查看已适配模组)" 48 | 49 | msgid "Loading modem information" 50 | msgstr "正在加载模组信息" 51 | 52 | msgid "Loading modem status" 53 | msgstr "正在加载模组状态" 54 | 55 | msgid "Loading modem" 56 | msgstr "正在加载模组" 57 | 58 | msgid "Dial Overview" 59 | msgstr "拨号总览" 60 | 61 | msgid "Check and add modem dialing configurations" 62 | msgstr "查看和添加模组拨号配置" 63 | 64 | msgid "Global Config" 65 | msgstr "全局配置" 66 | 67 | msgid "Dial Log" 68 | msgstr "拨号日志" 69 | 70 | msgid "Download Log" 71 | msgstr "下载日志" 72 | 73 | msgid "connect" 74 | msgstr "已连接" 75 | 76 | msgid "disconnect" 77 | msgstr "未连接" 78 | 79 | msgid "disabled" 80 | msgstr "未启用" 81 | 82 | msgid "Data Interface" 83 | msgstr "数据接口" 84 | 85 | msgid "Mode" 86 | msgstr "模式" 87 | 88 | msgid "Connect Status" 89 | msgstr "连接状态" 90 | 91 | msgid "Dial Config" 92 | msgstr "拨号配置" 93 | 94 | msgid "Config List" 95 | msgstr "配置列表" 96 | 97 | msgid "Debug Your Module" 98 | msgstr "调试你的模组" 99 | 100 | msgid "Select a modem for debugging" 101 | msgstr "选择一个模组进行调试" 102 | 103 | msgid "Network Preferences" 104 | msgstr "网络偏好" 105 | 106 | msgid "Self Test" 107 | msgstr "自检" 108 | 109 | msgid "Current" 110 | msgstr "当前" 111 | 112 | msgid "Option" 113 | msgstr "选项" 114 | 115 | msgid "Config" 116 | msgstr "配置" 117 | 118 | msgid "Item" 119 | msgstr "项目" 120 | 121 | msgid "Voltage" 122 | msgstr "电压" 123 | 124 | msgid "Status" 125 | msgstr "状态" 126 | 127 | msgid "Abnormal" 128 | msgstr "异常" 129 | 130 | msgid "Normal" 131 | msgstr "正常" 132 | 133 | msgid "Low" 134 | msgstr "偏低" 135 | 136 | msgid "Somewhat High" 137 | msgstr "偏高" 138 | 139 | msgid "Excessively High" 140 | msgstr "过高" 141 | 142 | msgid "AT Command" 143 | msgstr "AT命令" 144 | 145 | msgid "Quick Option" 146 | msgstr "快捷选项" 147 | 148 | msgid "Auto" 149 | msgstr "自动" 150 | 151 | msgid "Custom" 152 | msgstr "自定义" 153 | 154 | msgid "Quick Commands" 155 | msgstr "快捷命令" 156 | 157 | msgid "Enter Command" 158 | msgstr "输入命令" 159 | 160 | msgid "Apply" 161 | msgstr "应用" 162 | 163 | msgid "Send" 164 | msgstr "发送" 165 | 166 | msgid "Clean" 167 | msgstr "清空" 168 | 169 | msgid "Response" 170 | msgstr "响应" 171 | 172 | msgid "Return to old page" 173 | msgstr "返回旧界面" 174 | 175 | msgid "Return to modem debug" 176 | msgstr "返回模组调试界面" 177 | 178 | msgid "Custom quick commands" 179 | msgstr "自定义快捷命令" 180 | 181 | msgid "Customize your quick commands" 182 | msgstr "自定义你的快捷命令" 183 | 184 | msgid "Custom Commands" 185 | msgstr "自定义命令" 186 | 187 | msgid "Serial Number" 188 | msgstr "序号" 189 | 190 | msgid "Description" 191 | msgstr "描述" 192 | 193 | msgid "Command" 194 | msgstr "命令" 195 | 196 | msgid "Modem Information" 197 | msgstr "模组信息" 198 | 199 | msgid "No modems found" 200 | msgstr "没有找到模组" 201 | 202 | msgid "(Check the reason)" 203 | msgstr "(查看原因)" 204 | 205 | msgid "Enable dial configurations" 206 | msgstr "启用拨号配置" 207 | 208 | msgid "General Settings" 209 | msgstr "通用配置" 210 | 211 | msgid "Advanced Settings" 212 | msgstr "高级配置" 213 | 214 | msgid "Remarks" 215 | msgstr "备注" 216 | 217 | msgid "Mobile Network" 218 | msgstr "移动网络" 219 | 220 | msgid "UNKNOWN" 221 | msgstr "未知" 222 | 223 | msgid "Unknown" 224 | msgstr "未知" 225 | 226 | msgid "unknown" 227 | msgstr "未知" 228 | 229 | msgid "Mobile network not found" 230 | msgstr "未发现移动网络" 231 | 232 | msgid "The network device was not found" 233 | msgstr "找不到网络设备" 234 | 235 | msgid "Only display the modes available for the adaptation modem" 236 | msgstr "仅显示适配模组可用的拨号模式" 237 | 238 | msgid "Config ID" 239 | msgstr "配置 ID" 240 | 241 | msgid "Dial Tool" 242 | msgstr "拨号工具" 243 | 244 | msgid "After switching the dialing tool, it may be necessary to restart the module or restart the router to recognize the module." 245 | msgstr "切换拨号工具后,可能需要重启模组或重启路由器才能识别模组。" 246 | 247 | msgid "Auto Choose" 248 | msgstr "自动选择" 249 | 250 | msgid "quectel-CM" 251 | msgstr "移远模组拨号工具" 252 | 253 | msgid "mmcli" 254 | msgstr "调制解调器管理工具" 255 | 256 | msgid "PDP Type" 257 | msgstr "网络类型" 258 | 259 | msgid "Network Bridge" 260 | msgstr "网络桥接" 261 | 262 | msgid "After checking, enable network interface bridge." 263 | msgstr "勾选后,启用网络接口桥接。" 264 | 265 | msgid "APN" 266 | msgstr "接入点" 267 | 268 | msgid "China Mobile" 269 | msgstr "中国移动" 270 | 271 | msgid "China Unicom" 272 | msgstr "中国联通" 273 | 274 | msgid "China Telecom" 275 | msgstr "中国电信" 276 | 277 | msgid "China Broadcast" 278 | msgstr "中国广电" 279 | 280 | msgid "Skytone" 281 | msgstr "天际通" 282 | 283 | msgid "Authentication Type" 284 | msgstr "认证类型" 285 | 286 | msgid "PAP/CHAP (both)" 287 | msgstr "PAP/CHAP (均使用)" 288 | 289 | msgid "NONE" 290 | msgstr "无" 291 | 292 | msgid "PAP/CHAP Username" 293 | msgstr "PAP/CHAP 用户名" 294 | 295 | msgid "PAP/CHAP Password" 296 | msgstr "PAP/CHAP 密码" 297 | 298 | msgid "Message" 299 | msgstr "信息" 300 | 301 | msgid "Base Information" 302 | msgstr "基本信息" 303 | 304 | msgid "Manufacturer" 305 | msgstr "制造商" 306 | 307 | msgid "Revision" 308 | msgstr "固件版本" 309 | 310 | msgid "AT Port" 311 | msgstr "AT串口" 312 | 313 | msgid "Temperature" 314 | msgstr "温度" 315 | 316 | msgid "Update Time" 317 | msgstr "更新时间" 318 | 319 | msgid "SIM Information" 320 | msgstr "SIM卡信息" 321 | 322 | msgid "Unknown SIM card status" 323 | msgstr "未知SIM卡状态" 324 | 325 | msgid "SIM card not inserted" 326 | msgstr "SIM卡未插入" 327 | 328 | msgid "ISP" 329 | msgstr "运营商" 330 | 331 | msgid "SIM Status" 332 | msgstr "SIM卡状态" 333 | 334 | msgid "miss" 335 | msgstr "未插入" 336 | 337 | msgid "locked" 338 | msgstr "锁定" 339 | 340 | msgid "SIM Slot" 341 | msgstr "SIM卡卡槽" 342 | 343 | msgid "SIM Number" 344 | msgstr "SIM卡号码" 345 | 346 | msgid "IMEI" 347 | msgstr "国际移动设备识别码" 348 | 349 | msgid "IMSI" 350 | msgstr "国际移动用户识别码" 351 | 352 | msgid "ICCID" 353 | msgstr "集成电路卡识别码" 354 | 355 | msgid "Network Information" 356 | msgstr "网络信息" 357 | 358 | msgid "Network Type" 359 | msgstr "网络类型" 360 | 361 | msgid "CQI UL" 362 | msgstr "上行信道质量指示" 363 | 364 | msgid "CQI DL" 365 | msgstr "下行信道质量指示" 366 | 367 | msgid "AMBR UL" 368 | msgstr "上行访问最大比特率" 369 | 370 | msgid "AMBR DL" 371 | msgstr "下行访问最大比特率" 372 | 373 | msgid "Tx Rate" 374 | msgstr "上传速率" 375 | 376 | msgid "Rx Rate" 377 | msgstr "下载速率" 378 | 379 | msgid "RSSI" 380 | msgstr "接收信号强度指示" 381 | 382 | msgid "BER" 383 | msgstr "信道误码率" 384 | 385 | msgid "Cell Information" 386 | msgstr "小区信息" 387 | 388 | msgid "Network Mode" 389 | msgstr "网络模式" 390 | 391 | msgid "NR5G-SA Mode" 392 | msgstr "NR5G-SA 模式" 393 | 394 | msgid "EN-DC Mode" 395 | msgstr "EN-DC 模式" 396 | 397 | msgid "LTE Mode" 398 | msgstr "LTE 模式" 399 | 400 | msgid "WCDMA Mode" 401 | msgstr "WCDMA 模式" 402 | 403 | msgid "GSM Mode" 404 | msgstr "GSM 模式" 405 | 406 | msgid "MCC" 407 | msgstr "移动国家代码 (MCC)" 408 | 409 | msgid "MNC" 410 | msgstr "移动网络代码 (MNC)" 411 | 412 | msgid "Duplex Mode" 413 | msgstr "双工模式 (Duplex Mode)" 414 | 415 | msgid "LAC" 416 | msgstr "位置区码 (LAC)" 417 | 418 | msgid "Cell ID" 419 | msgstr "小区ID (Cell ID)" 420 | 421 | msgid "Physical Cell ID" 422 | msgstr "物理小区ID (Physical Cell ID)" 423 | 424 | msgid "TAC" 425 | msgstr "跟踪区编码 (TAC)" 426 | 427 | msgid "ARFCN" 428 | msgstr "绝对射频信道号 (ARFCN)" 429 | 430 | msgid "EARFCN" 431 | msgstr "E-UTRA绝对射频信道号 (EARFCN)" 432 | 433 | msgid "UARFCN" 434 | msgstr "UTRA绝对射频信道号 (UARFCN)" 435 | 436 | msgid "Band" 437 | msgstr "频段 (Band)" 438 | 439 | msgid "Freq band indicator" 440 | msgstr "频带指示 (Freq band indicator)" 441 | 442 | msgid "UL Bandwidth" 443 | msgstr "上行带宽 (UL Bandwidth)" 444 | 445 | msgid "DL Bandwidth" 446 | msgstr "下行带宽 (DL Bandwidth)" 447 | 448 | msgid "RSRP" 449 | msgstr "参考信号接收功率 (RSRP)" 450 | 451 | msgid "RSRQ" 452 | msgstr "参考信号接收质量 (RSRQ)" 453 | 454 | msgid "RSSI" 455 | msgstr "接收信号强度指示 (RSSI)" 456 | 457 | msgid "SINR" 458 | msgstr "信号与干扰加噪声比 (SINR)" 459 | 460 | msgid "RxLev" 461 | msgstr "接收信号功率 (RxLev)" 462 | 463 | msgid "RSSNR" 464 | msgstr "信号干扰比 (RSSNR)" 465 | 466 | msgid "SCS" 467 | msgstr "NR子载波间隔 (SCS)" 468 | 469 | msgid "CQI" 470 | msgstr "信道质量指示 (CQI)" 471 | 472 | msgid "TX Power" 473 | msgstr "TX 功率 (TX Power)" 474 | 475 | msgid "Srxlev" 476 | msgstr "服务小区接收信号功率 (Srxlev)" 477 | 478 | msgid "PSC" 479 | msgstr "主扰码 (PSC)" 480 | 481 | msgid "RAC" 482 | msgstr "路由区域码 (RAC)" 483 | 484 | msgid "RSCP" 485 | msgstr "接收信号码功率 (RSCP)" 486 | 487 | msgid "Eb/Io" 488 | msgstr "每比特能量与干扰功率密度(干扰比)之比" 489 | 490 | msgid "Eb/No" 491 | msgstr "每比特能量与噪声功率密度(噪声比)之比" 492 | 493 | msgid "Ec/Io" 494 | msgstr "每码片能量与干扰功率密度(干扰比)之比" 495 | 496 | msgid "Ec/No" 497 | msgstr "每码片能量与噪声功率密度(噪声比)之比" 498 | 499 | msgid "Physical Channel" 500 | msgstr "物理信道 (Physical Channel)" 501 | 502 | msgid "Spreading Factor" 503 | msgstr "扩频因子 (Spreading Factor)" 504 | 505 | msgid "Slot" 506 | msgstr "插槽格式 (Slot)" 507 | 508 | msgid "Speech Code" 509 | msgstr "语音编码 (Speech Code)" 510 | 511 | msgid "Compression Mode" 512 | msgstr "压缩模式 (Compression Mode)" 513 | 514 | msgid "CHN-CMCC" 515 | msgstr "中国移动" 516 | 517 | msgid "CMCC" 518 | msgstr "中国移动" 519 | 520 | msgid "46000" 521 | msgstr "中国移动" 522 | 523 | msgid "CHN-UNICOM" 524 | msgstr "中国联通" 525 | 526 | msgid "UNICOM" 527 | msgstr "中国联通" 528 | 529 | msgid "CUCC" 530 | msgstr "中国联通" 531 | 532 | msgid "46001" 533 | msgstr "中国联通" 534 | 535 | msgid "CHN-CT" 536 | msgstr "中国电信" 537 | 538 | msgid "CHN-TELECOM" 539 | msgstr "中国电信" 540 | 541 | msgid "CTCC" 542 | msgstr "中国电信" 543 | 544 | msgid "CT" 545 | msgstr "中国电信" 546 | 547 | msgid "46011" 548 | msgstr "中国电信" 549 | 550 | msgid "Excellent" 551 | msgstr "优秀" 552 | 553 | msgid "Good" 554 | msgstr "良好" 555 | 556 | msgid "Fair" 557 | msgstr "一般" 558 | 559 | msgid "Bad" 560 | msgstr "较差" 561 | 562 | msgid "Plugin Config" 563 | msgstr "插件配置" 564 | 565 | msgid "Check and modify the plugin configuration" 566 | msgstr "查看和修改插件配置" 567 | 568 | msgid "Modem Scan" 569 | msgstr "模组扫描" 570 | 571 | msgid "Scan" 572 | msgstr "扫描" 573 | 574 | msgid "Scaning modem..." 575 | msgstr "正在扫描中..." 576 | 577 | msgid "The automatic configuration modem is triggered only at modem startup, otherwise, manual scanning is necessary" 578 | msgstr "自动配置模组只有在模组启动的时候才会触发,其他情况需要手动点击扫描" 579 | 580 | msgid "Manual Configuration" 581 | msgstr "手动配置" 582 | 583 | msgid "Enable the manual configuration of modem information" 584 | msgstr "启用手动配置模组信息" 585 | 586 | msgid "(After enable, the automatic scanning and configuration function for modem information will be disabled)" 587 | msgstr "(启用后将禁用自动扫描并配置模组信息功能)" 588 | 589 | msgid "Network Interface Alias" 590 | msgstr "网络接口别名" 591 | 592 | msgid "Enable automatic creation of network interface alias (Effective upon reinstatement of dialing configuration)" 593 | msgstr "启用自动创建网络接口别名(重新启用拨号配置后生效)" 594 | 595 | msgid "Not null" 596 | msgstr "不能为空" 597 | 598 | msgid "missing" 599 | msgstr "有必填选项为空值" 600 | 601 | msgid "Plugin Info" 602 | msgstr "插件信息" 603 | 604 | msgid "Check the version information of the plugin" 605 | msgstr "查看插件的版本信息" 606 | 607 | msgid "Plugin Version" 608 | msgstr "插件版本" 609 | 610 | msgid "Dial Tool Info" 611 | msgstr "拨号工具信息" 612 | 613 | msgid "Version" 614 | msgstr "版本" 615 | 616 | msgid "Not installed" 617 | msgstr "未安装" 618 | 619 | msgid "Modem General Driver Info" 620 | msgstr "模组通用驱动信息" 621 | 622 | msgid "Driver Type" 623 | msgstr "驱动类型" 624 | 625 | msgid "Kernel Model" 626 | msgstr "内核模块" 627 | 628 | msgid "USB Network" 629 | msgstr "USB网络" 630 | 631 | msgid "Serial Port" 632 | msgstr "串口" 633 | 634 | msgid "Loaded" 635 | msgstr "已加载" 636 | 637 | msgid "Not loaded" 638 | msgstr "未加载" 639 | 640 | msgid "Modem USB Driver Info" 641 | msgstr "模组USB驱动信息" 642 | 643 | msgid "Modem PCIE Driver Info" 644 | msgstr "模组PCIE驱动信息" 645 | 646 | msgid "General" 647 | msgstr "通用" 648 | 649 | msgid "Private" 650 | msgstr "私有" 651 | 652 | msgid "Private (Quectel)" 653 | msgstr "私有(移远)" 654 | 655 | msgid "Private (Fibocom)" 656 | msgstr "私有(广和通)" 657 | 658 | msgid "Private (Meig)" 659 | msgstr "私有(美格)" -------------------------------------------------------------------------------- /root/usr/share/modem/modem_info.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright (C) 2023 Siriling 3 | 4 | #脚本目录 5 | SCRIPT_DIR="/usr/share/modem" 6 | source "${SCRIPT_DIR}/modem_debug.sh" 7 | 8 | #初值化数据结构 9 | init_modem_info() 10 | { 11 | #基本信息 12 | name='unknown' #名称 13 | manufacturer='unknown' #制造商 14 | revision='-' #固件版本 15 | at_port='-' #AT串口 16 | mode='unknown' #拨号模式 17 | temperature="NaN $(printf "\xc2\xb0")C" #温度 18 | update_time='-' #更新时间 19 | 20 | #SIM卡信息 21 | sim_status="unknown" #SIM卡状态 22 | sim_slot="-" #SIM卡卡槽 23 | isp="-" #运营商(互联网服务提供商) 24 | sim_number='-' #SIM卡号码(手机号) 25 | imei='-' #IMEI 26 | imsi='-' #IMSI 27 | iccid='-' #ICCID 28 | 29 | #网络信息 30 | connect_status="disconnect" #SIM卡状态 31 | network_type="-" #蜂窝网络类型 32 | cqi_ul="-" #上行信道质量指示 33 | cqi_dl="-" #下行信道质量指示 34 | ambr_ul="-" #上行签约速率 35 | ambr_dl="-" #下行签约速率 36 | tx_rate="-" #上传速率 37 | rx_rate="-" #下载速率 38 | 39 | #小区信息 40 | network_mode="-" #网络模式 41 | #NR5G-SA模式 42 | nr_mcc='' 43 | nr_mnc='' 44 | nr_duplex_mode='' 45 | nr_cell_id='' 46 | nr_physical_cell_id='' 47 | nr_tac='' 48 | nr_arfcn='' 49 | nr_band='' 50 | nr_dl_bandwidth='' 51 | nr_rsrp='' 52 | nr_rsrq='' 53 | nr_sinr='' 54 | nr_rxlev='' 55 | nr_scs='' 56 | nr_srxlev='' 57 | #EN-DC模式(LTE) 58 | endc_lte_mcc='' 59 | endc_lte_mnc='' 60 | endc_lte_duplex_mode='' 61 | endc_lte_cell_id='' 62 | endc_lte_physical_cell_id='' 63 | endc_lte_earfcn='' 64 | endc_lte_freq_band_ind='' 65 | endc_lte_ul_bandwidth='' 66 | endc_lte_dl_bandwidth='' 67 | endc_lte_tac='' 68 | endc_lte_rsrp='' 69 | endc_lte_rsrq='' 70 | endc_lte_rssi='' 71 | endc_lte_sinr='' 72 | endc_lte_rxlev='' 73 | endc_lte_cql='' 74 | endc_lte_tx_power='' 75 | endc_lte_srxlev='' 76 | #EN-DC模式(NR5G-NSA) 77 | endc_nr_mcc='' 78 | endc_nr_mnc='' 79 | endc_nr_physical_cell_id='' 80 | endc_nr_arfcn='' 81 | endc_nr_band='' 82 | endc_nr_dl_bandwidth='' 83 | endc_nr_rsrp='' 84 | endc_nr_rsrq='' 85 | endc_nr_sinr='' 86 | endc_nr_scs='' 87 | #LTE模式 88 | lte_mcc='' 89 | lte_mnc='' 90 | lte_duplex_mode='' 91 | lte_cell_id='' 92 | lte_physical_cell_id='' 93 | lte_earfcn='' 94 | lte_freq_band_ind='' 95 | lte_ul_bandwidth='' 96 | lte_dl_bandwidth='' 97 | lte_tac='' 98 | lte_rsrp='' 99 | lte_rsrq='' 100 | lte_rssi='' 101 | lte_sinr='' 102 | lte_rxlev='' 103 | lte_cql='' 104 | lte_tx_power='' 105 | lte_srxlev='' 106 | #WCDMA模式 107 | wcdma_mcc='' 108 | wcdma_mnc='' 109 | wcdma_lac='' 110 | wcdma_cell_id='' 111 | wcdma_uarfcn='' 112 | wcdma_psc='' 113 | wcdma_rac='' 114 | wcdma_rscp='' 115 | wcdma_ecio='' 116 | wcdma_phych='' 117 | wcdma_sf='' 118 | wcdma_slot='' 119 | wcdma_speech_code='' 120 | wcdma_com_mod='' 121 | } 122 | 123 | #设置基本信息 124 | set_base_info() 125 | { 126 | base_info="\"base_info\":{ 127 | \"manufacturer\":\"$manufacturer\", 128 | \"revision\":\"$revision\", 129 | \"at_port\":\"$at_port\", 130 | \"mode\":\"$mode\", 131 | \"temperature\":\"$temperature\", 132 | \"update_time\":\"$update_time\" 133 | }," 134 | } 135 | 136 | #设置SIM卡信息 137 | set_sim_info() 138 | { 139 | if [ "$sim_status" = "ready" ]; then 140 | sim_info="\"sim_info\":[ 141 | {\"SIM Status\":\"$sim_status\", \"full_name\":\"SIM Status\"}, 142 | {\"ISP\":\"$isp\", \"full_name\":\"Internet Service Provider\"}, 143 | {\"SIM Slot\":\"$sim_slot\", \"full_name\":\"SIM Slot\"}, 144 | {\"SIM Number\":\"$sim_number\", \"full_name\":\"SIM Number\"}, 145 | {\"IMEI\":\"$imei\", \"full_name\":\"International Mobile Equipment Identity\"}, 146 | {\"IMSI\":\"$imsi\", \"full_name\":\"International Mobile Subscriber Identity\"}, 147 | {\"ICCID\":\"$iccid\", \"full_name\":\"Integrate Circuit Card Identity\"} 148 | ]," 149 | elif [ "$sim_status" = "miss" ]; then 150 | sim_info="\"sim_info\":[ 151 | {\"SIM Status\":\"$sim_status\", \"full_name\":\"SIM Status\"}, 152 | {\"IMEI\":\"$imei\", \"full_name\":\"International Mobile Equipment Identity\"} 153 | ]," 154 | elif [ "$sim_status" = "unknown" ]; then 155 | sim_info="\"sim_info\":[ 156 | {\"SIM Status\":\"$sim_status\", \"full_name\":\"SIM Status\"} 157 | ]," 158 | else 159 | sim_info="\"sim_info\":[ 160 | {\"SIM Status\":\"$sim_status\", \"full_name\":\"SIM Status\"}, 161 | {\"SIM Slot\":\"$sim_slot\", \"full_name\":\"SIM Slot\"}, 162 | {\"IMEI\":\"$imei\", \"full_name\":\"International Mobile Equipment Identity\"}, 163 | {\"IMSI\":\"$imsi\", \"full_name\":\"International Mobile Subscriber Identity\"}, 164 | {\"ICCID\":\"$iccid\", \"full_name\":\"Integrate Circuit Card Identity\"} 165 | ]," 166 | fi 167 | } 168 | 169 | #设置网络信息 170 | set_network_info() 171 | { 172 | network_info="\"network_info\":[ 173 | {\"Network Type\":\"$network_type\", \"full_name\":\"Network Type\"}, 174 | {\"CQI UL\":\"$cqi_ul\", \"full_name\":\"Channel Quality Indicator for Uplink\"}, 175 | {\"CQI DL\":\"$cqi_dl\", \"full_name\":\"Channel Quality Indicator for Downlink\"}, 176 | {\"AMBR UL\":\"$ambr_ul\", \"full_name\":\"Access Maximum Bit Rate for Uplink\"}, 177 | {\"AMBR DL\":\"$ambr_dl\", \"full_name\":\"Access Maximum Bit Rate for Downlink\"}, 178 | {\"Tx Rate\":\"$tx_rate\", \"full_name\":\"Transmit Rate\"}, 179 | {\"Rx Rate\":\"$rx_rate\", \"full_name\":\"Receive Rate\"} 180 | ]," 181 | } 182 | 183 | #设置信号信息 184 | set_cell_info() 185 | { 186 | if [ "$network_mode" = "NR5G-SA Mode" ]; then 187 | cell_info="\"cell_info\":{ 188 | \"NR5G-SA Mode\":[ 189 | {\"MCC\":\"$nr_mcc\", \"full_name\":\"Mobile Country Code\"}, 190 | {\"MNC\":\"$nr_mnc\", \"full_name\":\"Mobile Network Code\"}, 191 | {\"Duplex Mode\":\"$nr_duplex_mode\", \"full_name\":\"Duplex Mode\"}, 192 | {\"Cell ID\":\"$nr_cell_id\", \"full_name\":\"Cell ID\"}, 193 | {\"Physical Cell ID\":\"$nr_physical_cell_id\", \"full_name\":\"Physical Cell ID\"}, 194 | {\"TAC\":\"$nr_tac\", \"full_name\":\"Tracking area code of cell servedby neighbor Enb\"}, 195 | {\"ARFCN\":\"$nr_arfcn\", \"full_name\":\"Absolute Radio-Frequency Channel Number\"}, 196 | {\"Band\":\"$nr_band\", \"full_name\":\"Band\"}, 197 | {\"DL Bandwidth\":\"$nr_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"}, 198 | {\"RSRP\":\"$nr_rsrp\", \"full_name\":\"Reference Signal Received Power\"}, 199 | {\"RSRQ\":\"$nr_rsrq\", \"full_name\":\"Reference Signal Received Quality\"}, 200 | {\"SINR\":\"$nr_sinr\", \"full_name\":\"Signal to Interference plus Noise Ratio Bandwidth\"}, 201 | {\"RxLev\":\"$nr_rxlev\", \"full_name\":\"Received Signal Level\"}, 202 | {\"SCS\":\"$nr_scs\", \"full_name\":\"SCS\"}, 203 | {\"Srxlev\":\"$nr_srxlev\", \"full_name\":\"Serving Cell Receive Level\"} 204 | ] 205 | }" 206 | elif [ "$network_mode" = "EN-DC Mode" ]; then 207 | cell_info="\"cell_info\":{ 208 | \"EN-DC Mode\":[ 209 | {\"LTE\":[ 210 | {\"MCC\":\"$endc_lte_mcc\", \"full_name\":\"Mobile Country Code\"}, 211 | {\"MNC\":\"$endc_lte_mnc\", \"full_name\":\"Mobile Network Code\"}, 212 | {\"Duplex Mode\":\"$endc_lte_duplex_mode\", \"full_name\":\"Duplex Mode\"}, 213 | {\"Cell ID\":\"$endc_lte_cell_id\", \"full_name\":\"Cell ID\"}, 214 | {\"Physical Cell ID\":\"$endc_lte_physical_cell_id\", \"full_name\":\"Physical Cell ID\"}, 215 | {\"EARFCN\":\"$endc_lte_earfcn\", \"full_name\":\"E-UTRA Absolute Radio Frequency Channel Number\"}, 216 | {\"Freq band indicator\":\"$endc_lte_freq_band_ind\", \"full_name\":\"Freq band indicator\"}, 217 | {\"Band\":\"$endc_lte_band\", \"full_name\":\"Band\"}, 218 | {\"UL Bandwidth\":\"$endc_lte_ul_bandwidth\", \"full_name\":\"UL Bandwidth\"}, 219 | {\"DL Bandwidth\":\"$endc_lte_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"}, 220 | {\"TAC\":\"$endc_lte_tac\", \"full_name\":\"Tracking area code of cell servedby neighbor Enb\"}, 221 | {\"RSRP\":\"$endc_lte_rsrp\", \"full_name\":\"Reference Signal Received Power\"}, 222 | {\"RSRQ\":\"$endc_lte_rsrq\", \"full_name\":\"Reference Signal Received Quality\"}, 223 | {\"RSSI\":\"$endc_lte_rssi\", \"full_name\":\"Received Signal Strength Indicator\"}, 224 | {\"SINR\":\"$endc_lte_sinr\", \"full_name\":\"Signal to Interference plus Noise Ratio Bandwidth\"}, 225 | {\"RxLev\":\"$endc_lte_rxlev\", \"full_name\":\"Received Signal Level\"}, 226 | {\"RSSNR\":\"$endc_lte_rssnr\", \"full_name\":\"Radio Signal Strength Noise Ratio\"}, 227 | {\"CQI\":\"$endc_lte_cql\", \"full_name\":\"Channel Quality Indicator\"}, 228 | {\"TX Power\":\"$endc_lte_tx_power\", \"full_name\":\"TX Power\"}, 229 | {\"Srxlev\":\"$endc_lte_srxlev\", \"full_name\":\"Serving Cell Receive Level\"} 230 | ] 231 | }, 232 | 233 | {\"NR5G-NSA\":[ 234 | {\"MCC\":\"$endc_nr_mcc\", \"full_name\":\"Mobile Country Code\"}, 235 | {\"MNC\":\"$endc_nr_mnc\", \"full_name\":\"Mobile Network Code\"}, 236 | {\"Physical Cell ID\":\"$endc_nr_physical_cell_id\", \"full_name\":\"Physical Cell ID\"}, 237 | {\"ARFCN\":\"$endc_nr_arfcn\", \"full_name\":\"Absolute Radio-Frequency Channel Number\"}, 238 | {\"Band\":\"$endc_nr_band\", \"full_name\":\"Band\"}, 239 | {\"DL Bandwidth\":\"$endc_nr_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"}, 240 | {\"RSRP\":\"$endc_nr_rsrp\", \"full_name\":\"Reference Signal Received Power\"}, 241 | {\"RSRQ\":\"$endc_nr_rsrq\", \"full_name\":\"Reference Signal Received Quality\"}, 242 | {\"SINR\":\"$endc_nr_sinr\", \"full_name\":\"Signal to Interference plus Noise Ratio Bandwidth\"}, 243 | {\"SCS\":\"$endc_nr_scs\", \"full_name\":\"SCS\"} 244 | ] 245 | } 246 | ] 247 | }" 248 | elif [ "$network_mode" = "LTE Mode" ]; then 249 | cell_info="\"cell_info\":{ 250 | \"LTE Mode\":[ 251 | {\"MCC\":\"$lte_mcc\", \"full_name\":\"Mobile Country Code\"}, 252 | {\"MNC\":\"$lte_mnc\", \"full_name\":\"Mobile Network Code\"}, 253 | {\"Duplex Mode\":\"$lte_duplex_mode\", \"full_name\":\"Duplex Mode\"}, 254 | {\"Cell ID\":\"$lte_cell_id\", \"full_name\":\"Cell ID\"}, 255 | {\"Physical Cell ID\":\"$lte_physical_cell_id\", \"full_name\":\"Physical Cell ID\"}, 256 | {\"EARFCN\":\"$lte_earfcn\", \"full_name\":\"E-UTRA Absolute Radio Frequency Channel Number\"}, 257 | {\"Freq band indicator\":\"$lte_freq_band_ind\", \"full_name\":\"Freq band indicator\"}, 258 | {\"Band\":\"$lte_band\", \"full_name\":\"Band\"}, 259 | {\"UL Bandwidth\":\"$lte_ul_bandwidth\", \"full_name\":\"UL Bandwidth\"}, 260 | {\"DL Bandwidth\":\"$lte_dl_bandwidth\", \"full_name\":\"DL Bandwidth\"}, 261 | {\"TAC\":\"$lte_tac\", \"full_name\":\"Tracking area code of cell servedby neighbor Enb\"}, 262 | {\"RSRP\":\"$lte_rsrp\", \"full_name\":\"Reference Signal Received Power\"}, 263 | {\"RSRQ\":\"$lte_rsrq\", \"full_name\":\"Reference Signal Received Quality\"}, 264 | {\"RSSI\":\"$lte_rssi\", \"full_name\":\"Received Signal Strength Indicator\"}, 265 | {\"SINR\":\"$lte_sinr\", \"full_name\":\"Signal to Interference plus Noise Ratio Bandwidth\"}, 266 | {\"RxLev\":\"$lte_rxlev\", \"full_name\":\"RxLev\"}, 267 | {\"RSSNR\":\"$lte_rssnr\", \"full_name\":\"Radio Signal Strength Noise Ratio\"}, 268 | {\"CQI\":\"$lte_cql\", \"full_name\":\"Channel Quality Indicator\"}, 269 | {\"TX Power\":\"$lte_tx_power\", \"full_name\":\"TX Power\"}, 270 | {\"Srxlev\":\"$lte_srxlev\", \"full_name\":\"Serving Cell Receive Level\"} 271 | ] 272 | }" 273 | elif [ "$network_mode" = "WCDMA Mode" ]; then 274 | cell_info="\"cell_info\":{ 275 | \"WCDMA Mode\":[ 276 | {\"MCC\":\"$wcdma_mcc\", \"full_name\":\"Mobile Country Code\"}, 277 | {\"MNC\":\"$wcdma_mnc\", \"full_name\":\"Mobile Network Code\"}, 278 | {\"LAC\":\"$wcdma_lac\", \"full_name\":\"Location Area Code\"}, 279 | {\"Cell ID\":\"$wcdma_cell_id\", \"full_name\":\"Cell ID\"}, 280 | {\"UARFCN\":\"$wcdma_uarfcn\", \"full_name\":\"UTRA Absolute Radio Frequency Channel Number\"}, 281 | {\"PSC\":\"$wcdma_psc\", \"full_name\":\"Primary Scrambling Code\"}, 282 | {\"RAC\":\"$wcdma_rac\", \"full_name\":\"Routing Area Code\"}, 283 | {\"Band\":\"$wcdma_band\", \"full_name\":\"Band\"}, 284 | {\"RSCP\":\"$wcdma_rscp\", \"full_name\":\"Received Signal Code Power\"}, 285 | {\"Ec/Io\":\"$wcdma_ecio\", \"full_name\":\"Ec/Io\"}, 286 | {\"Ec/No\":\"$wcdma_ecno\", \"full_name\":\"Ec/No\"}, 287 | {\"Physical Channel\":\"$wcdma_phych\", \"full_name\":\"Physical Channel\"}, 288 | {\"Spreading Factor\":\"$wcdma_sf\", \"full_name\":\"Spreading Factor\"}, 289 | {\"Slot\":\"$wcdma_slot\", \"full_name\":\"Slot\"}, 290 | {\"Speech Code\":\"$wcdma_speech_code\", \"full_name\":\"Speech Code\"}, 291 | {\"Compression Mode\":\"$wcdma_com_mod\", \"full_name\":\"Compression Mode\"}, 292 | {\"RxLev\":\"$wcdma_rxlev\", \"full_name\":\"RxLev\"} 293 | ] 294 | }" 295 | fi 296 | } 297 | 298 | #以Json格式保存模组信息 299 | info_to_json() 300 | { 301 | base_info="\"base_info\":{}," 302 | sim_info="\"sim_info\":{}," 303 | network_info="\"network_info\":{}," 304 | cell_info="\"cell_info\":{}" 305 | 306 | #设置基本信息 307 | set_base_info 308 | 309 | #判断是否适配 310 | if [ "$manufacturer" != "unknown" ]; then 311 | #设置SIM卡信息 312 | set_sim_info 313 | fi 314 | 315 | #判断插卡和连接状态 316 | if [ "$sim_status" = "ready" ] && [ "$connect_status" = "connect" ]; then 317 | #设置网络信息 318 | set_network_info 319 | #设置小区信息 320 | set_cell_info 321 | fi 322 | 323 | #拼接所有信息(不要漏掉最后一个}) 324 | modem_info="{$base_info$modem_info$sim_info$network_info$cell_info}" 325 | } 326 | # echo $ECIO #参考信号接收质量 RSRQ ecio 327 | # echo $ECIO1 #参考信号接收质量 RSRQ ecio1 328 | # echo $RSCP #参考信号接收功率 RSRP rscp0 329 | # echo $RSCP1 #参考信号接收功率 RSRP rscp1 330 | # echo $SINR #信噪比 SINR rv["sinr"] 331 | 332 | # #基站信息 333 | # echo $COPS_MCC #MCC 334 | # echo $$COPS_MNC #MNC 335 | # echo $LAC #eNB ID 336 | # echo '' #LAC_NUM 337 | # echo $RNC #TAC 338 | # echo '' #RNC_NUM 339 | # echo $CID 340 | # echo '' #CID_NUM 341 | # echo $LBAND 342 | # echo $channel 343 | # echo $PCI 344 | # echo $MODTYPE 345 | # echo $QTEMP 346 | 347 | #获取模组信息 348 | get_modem_info() 349 | { 350 | update_time=$(date +"%Y-%m-%d %H:%M:%S") 351 | 352 | debug "检查模组的AT串口" 353 | #获取模块AT串口 354 | if [ -z "$at_port" ]; then 355 | debug "模组没有AT串口" 356 | return 357 | fi 358 | 359 | #检查模块状态(是否处于重启,重置,串口异常状态) 360 | local at_command="ATI" 361 | local response=$(at ${at_port} ${at_command}) 362 | if [[ "$response" = *"failed"* ]] || [[ "$response" = *"$at_port"* ]]; then 363 | debug "模组AT串口未就绪" 364 | return 365 | fi 366 | 367 | debug "根据模组的制造商获取信息" 368 | #更多信息获取 369 | case $manufacturer in 370 | "quectel") get_quectel_info "${at_port}" "${platform}" "${define_connect}" ;; 371 | "fibocom") get_fibocom_info "${at_port}" "${platform}" "${define_connect}" ;; 372 | "meig") get_meig_info "${at_port}" "${platform}" "${define_connect}" ;; 373 | "simcom") get_simcom_info "${at_port}" "${platform}" "${define_connect}" ;; 374 | *) debug "未适配该模组" ;; 375 | esac 376 | 377 | #获取更新时间 378 | update_time=$(date +"%Y-%m-%d %H:%M:%S") 379 | } 380 | 381 | #获取模组数据信息 382 | # $1:AT串口 383 | # $2:制造商 384 | # $3:平台 385 | # $4:连接定义 386 | modem_info() 387 | { 388 | #初值化模组信息 389 | debug "初值化模组信息" 390 | init_modem_info 391 | debug "初值化模组信息完成" 392 | 393 | #获取模组信息 394 | at_port="$1" 395 | manufacturer="$2" 396 | platform="$3" 397 | define_connect="$4" 398 | 399 | debug "获取模组信息" 400 | get_modem_info 401 | 402 | #整合模块信息 403 | info_to_json 404 | echo $modem_info 405 | } 406 | 407 | modem_info "$1" "$2" "$3" "$4" -------------------------------------------------------------------------------- /luasrc/view/modem/plugin_info.htm: -------------------------------------------------------------------------------- 1 | <%+header%> 2 | 3 | 83 | 84 |
85 |

<%:Plugin Info%>

86 |
<%:Check the version information of the plugin%>
87 | 88 | 93 | 94 | 95 |
96 |
97 | 98 |

<%:Plugin Info%>

99 |
100 |
101 | 102 |
103 |
104 | 105 |
106 | 109 |
110 |
111 |
112 |
113 |
114 | 115 |
116 |
117 | 118 |

<%:Dial Tool Info%>

119 |
120 |
121 | 122 |
123 |
124 | 125 |
126 | 129 |
130 |
131 |
132 | 133 |
134 |
135 | 136 |
137 | 140 |
141 |
142 |
143 | 144 |
145 |
146 | 147 |
148 | 151 |
152 |
153 |
154 | 155 |
156 |
157 | 158 |
159 | 162 |
163 |
164 |
165 |
166 |
167 | 168 |
169 |
170 | 171 |

<%:Modem General Driver Info%>

172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 194 | 195 |
<%:Driver Type%><%:Kernel Model%><%:Status%>
<%:USB Network%>usbnet.ko-
<%:Serial Port%>option.ko-
196 |
197 |
198 | 199 |
200 |
201 | 202 |

<%:Modem USB Driver Info%>

203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 |
<%:Driver Type%><%:Mode%><%:Kernel Model%><%:Status%>
<%:General%><%:QMI%>qmi_wwan.ko-
<%:General%><%:GobiNet%>GobiNet.ko-
<%:General%><%:ECM%>cdc_ether.ko-
<%:General%><%:MBIM%>cdc_mbim.ko-
<%:General%><%:RNDIS%>rndis_host.ko-
<%:General%><%:NCM%>cdc_ncm.ko-
<%:Private (Quectel)%><%:QMI%>qmi_wwan_q.ko-
<%:Private (Fibocom)%><%:QMI%>qmi_wwan_f.ko-
<%:Private (Meig)%><%:NCM%>meig_cdc_driver.ko-
267 |
268 |
269 | 270 |
271 |
272 | 273 |

<%:Modem PCIE Driver Info%>

274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 |
<%:Driver Type%><%:Kernel Model%><%:Status%>
<%:General%>mhi_net.ko-
<%:General%>qrtr_mhi.ko-
<%:General%>mhi_pci_generic.ko-
<%:General%>mhi_wwan_mbim.ko-
<%:General%>mhi_wwan_ctrl.ko-
<%:Private%>pcie_mhi.ko-
<%:Private%>mtk_pcie_wwan_m80.ko-
318 |
319 |
320 | 321 |
322 | 323 | <%+footer%> 324 | -------------------------------------------------------------------------------- /root/etc/init.d/modem: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | # Copyright (C) 2023 Siriling 3 | 4 | START=90 5 | STOP=13 6 | USE_PROCD=1 7 | 8 | #脚本目录 9 | SCRIPT_DIR="/usr/share/modem" 10 | 11 | #运行目录 12 | MODEM_RUNDIR="/var/run/modem" 13 | MODEM_RUN_CONFIG="${MODEM_RUNDIR}/config.cache" 14 | 15 | #导入组件工具 16 | source "${SCRIPT_DIR}/modem_scan.sh" 17 | 18 | #设置拨号模式 19 | # $1:拨号模式 20 | # set_mode() 21 | # { 22 | # #获取AT串口、制造商、模块名 23 | # local at_port=$(uci -q get modem.modem${modem_no}.at_port) 24 | # local manufacturer=$(uci -q get modem.modem${modem_no}.manufacturer) 25 | # local name=$(uci -q get modem.modem${modem_no}.name) 26 | 27 | # #分制造商设置不同的AT命令 28 | # local command 29 | # if [ "$manufacturer" = "quectel" ]; then 30 | # local mode_num 31 | # case $1 in 32 | # "qmi") mode_num='0' ;; 33 | # "gobinet") mode_num='0' ;; 34 | # "ecm") mode_num='1' ;; 35 | # "mbim") mode_num='2' ;; 36 | # "rndis") mode_num='3' ;; 37 | # "ncm") mode_num='5' ;; 38 | # *) mode_num='0' ;; 39 | # esac 40 | 41 | # #查询当前拨号模式 42 | # command='AT+QCFG="usbnet"' 43 | # local at_result=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $command) 44 | # if [[ "$at_result" != *"$mode_num"* ]]; then 45 | 46 | # #切换到指定的拨号模式 47 | # case $1 in 48 | # "qmi") command='AT+QCFG="usbnet",0' ;; 49 | # "gobinet") command='AT+QCFG="usbnet",0' ;; 50 | # "ecm") command='AT+QCFG="usbnet",1' ;; 51 | # "mbim") command='AT+QCFG="usbnet",2' ;; 52 | # "rndis") command='AT+QCFG="usbnet",3' ;; 53 | # "ncm") command='AT+QCFG="usbnet",5' ;; 54 | # *) command='AT+QCFG="usbnet",0' ;; 55 | # esac 56 | # at_result=$(sh ${SCRIPT_DIR}/modem_at.sh "$at_port" "$command") 57 | # #移远切换模式后,还需要重启模块,待测试 58 | # sleep 5 59 | # modem_scan 60 | # fi 61 | # elif [ "$manufacturer" = "fibocom" ]; then 62 | # if [ "$name" = "fm150-ae" ]; then 63 | # local mode_num 64 | # case $1 in 65 | # "qmi") mode_num='32' ;; 66 | # "gobinet") mode_num='32' ;; 67 | # "ecm") mode_num='23' ;; 68 | # "mbim") mode_num='29' ;; 69 | # "rndis") mode_num='24' ;; 70 | # "ncm") mode_num='23' ;; 71 | # *) mode_num='32' ;; 72 | # esac 73 | 74 | # #查询当前拨号模式 75 | # command='AT+GTUSBMODE?' 76 | # local at_result=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $command) 77 | # if [[ "$at_result" != *"$mode_num"* ]]; then 78 | # #切换到指定的拨号模式 79 | # case $1 in 80 | # "qmi") command='AT+GTUSBMODE=32' ;; 81 | # "gobinet") command='AT+GTUSBMODE=32' ;; 82 | # "ecm") command='AT+GTUSBMODE=23' ;; 83 | # "mbim") command='AT+GTUSBMODE=29' ;; 84 | # "rndis") command='AT+GTUSBMODE=24' ;; 85 | # "ncm") command='AT+GTUSBMODE=23' ;; 86 | # *) command='AT+GTUSBMODE=32' ;; 87 | # esac 88 | # at_result=$(sh ${SCRIPT_DIR}/modem_at.sh "$at_port" "$command") 89 | # sleep 5 90 | # modem_scan 91 | # fi 92 | # elif [ "$name" = "fm650" ]; then 93 | # #待处理 94 | # echo "fm650" 95 | # fi 96 | # else 97 | # #没有匹配到制造商,需要手动切换模块的拨号模式 98 | # echo "请手动切换模块的拨号模式" 99 | # fi 100 | # } 101 | 102 | #设置防火墙 103 | # $1:网络接口名称 104 | set_firewall() 105 | { 106 | local interface_name="$1" 107 | 108 | local num=$(uci show firewall | grep "name='wan'" | wc -l) 109 | local wwan_num=$(uci -q get firewall.@zone[$num].network | grep -w "${interface_name}" | wc -l) 110 | if [ "$wwan_num" = "0" ]; then 111 | uci add_list firewall.@zone[$num].network="${interface_name}" 112 | fi 113 | uci commit firewall 114 | } 115 | 116 | #设置IPv4网络接口 117 | # $1:网络接口名称 118 | # $2:网络接口 119 | set_ipv4_interface() 120 | { 121 | local interface_name="$1" 122 | local network_interface="$2" 123 | 124 | #删除原网络配置 125 | uci -q del network.${interface_name}.ipaddr 126 | uci -q del network.${interface_name}.netmask 127 | uci -q del network.${interface_name}.gateway 128 | uci -q del network.${interface_name}.peerdns 129 | uci -q del network.${interface_name}.dns 130 | 131 | #添加或修改网络配置 132 | uci set network.${interface_name}='interface' 133 | uci set network.${interface_name}.proto='dhcp' 134 | uci set network.${interface_name}.device="${network_interface}" 135 | uci set network.${interface_name}.ifname="${network_interface}" 136 | uci commit network 137 | 138 | #加入WAN防火墙 139 | set_firewall "${interface_name}" 140 | 141 | #启动网络接口 142 | ifup "${interface_name}" 143 | } 144 | 145 | #设置IPv6网络接口 146 | # $1:网络接口名称 147 | # $2:网络接口 148 | set_ipv6_interface() 149 | { 150 | local interface_name="$1" 151 | local network_interface="$2" 152 | 153 | #添加或修改网络配置 154 | uci set network.${interface_name}='interface' 155 | uci set network.${interface_name}.proto='dhcpv6' 156 | uci set network.${interface_name}.extendprefix='1' 157 | uci set network.${interface_name}.device="${network_interface}" 158 | uci set network.${interface_name}.ifname="${network_interface}" 159 | uci commit network 160 | 161 | #加入WAN防火墙 162 | set_firewall "${interface_name}" 163 | 164 | #启动网络接口 165 | ifup "${interface_name}" 166 | } 167 | 168 | #设置IPV4和IPv6网络接口 169 | # $1:IPV4网络接口名称 170 | # $2:IPv6网络接口名称 171 | # $3:网络接口 172 | set_ipv4v6_interface() 173 | { 174 | local ipv4_interface_name="$1" 175 | local ipv6_interface_name="$2" 176 | local network_interface="$3" 177 | 178 | #设置IPV4网络接口 179 | set_ipv4_interface "${ipv4_interface_name}" "${network_interface}" 180 | 181 | #设置IPV6网络接口 182 | local network_interface_alias=$(uci -q get modem.@global[0].network_interface_alias) 183 | case $network_interface_alias in 184 | "0") set_ipv6_interface "${ipv6_interface_name}" "${network_interface}" ;; 185 | "1") set_ipv6_interface "${ipv6_interface_name}" "@${ipv4_interface_name}" ;; #别名 186 | esac 187 | } 188 | 189 | #设置网络接口 190 | # $1:模块序号 191 | # $2:网络接口 192 | set_interface() 193 | { 194 | local modem_no="$1" 195 | local network_interface="$2" 196 | 197 | case $pdp_type in 198 | "ipv4") set_ipv4_interface "wwan_5g_${modem_no}" "${network_interface}" ;; 199 | "ipv6") set_ipv6_interface "wwan6_5g_${modem_no}" "${network_interface}" ;; 200 | "ipv4v6") set_ipv4v6_interface "wwan_5g_${modem_no}" "wwan6_5g_${modem_no}" "${network_interface}" ;; 201 | *) set_ipv4v6_interface "wwan_5g_${modem_no}" "wwan6_5g_${modem_no}" "${network_interface}" ;; 202 | esac 203 | } 204 | 205 | #设置移远模组MAC地址 206 | set_quectel_mac() 207 | { 208 | local mac_address="$(cat /sys/class/net/${network}/address)" 209 | local null_mac="00:00:00:00:00:00" 210 | [ -z "$mac_address" ] || [ "$mac_address" = "$null_mac" ] && { 211 | #方法一(lua) 212 | # local mac_address=$(lua -e 'math.randomseed(os.time()); for i=1,6 do io.write(string.format("%02X", math.random(0, 255))); if i < 6 then io.write(":") end; end') 213 | #方法二(shell) 214 | mac_address="$(generate_mac_address)" 215 | ifconfig "${network}" hw ether "${mac_address}" 216 | } 217 | } 218 | 219 | #移远拨号工具 220 | quectel_cm() 221 | { 222 | #获取制造商 223 | local manufacturer=$(uci -q get modem.modem${modem_no}.manufacturer) 224 | #移远500系列模组特殊处理(解决在6.x内核下缺失MAC地址使用制造商驱动导致拨号异常问题) 225 | [ "$manufacturer" = "quectel" ] && set_quectel_mac 226 | 227 | #拨号 228 | procd_open_instance 229 | procd_set_param command "quectel-CM" 230 | 231 | case $pdp_type in 232 | "ipv4") procd_append_param command "-4" ;; 233 | "ipv6") procd_append_param command "-6" ;; 234 | "ipv4v6") procd_append_param command "-4" "-6" ;; 235 | *) procd_append_param command "-4" "-6" ;; 236 | esac 237 | 238 | if [ "$network_bridge" = "1" ]; then 239 | procd_append_param command "-b" 240 | fi 241 | if [ "$apn" != "" ]; then 242 | procd_append_param command "-s" "$apn" 243 | fi 244 | if [ "$username" != "" ]; then 245 | procd_append_param command "$username" 246 | fi 247 | if [ "$password" != "" ]; then 248 | procd_append_param command "$password" 249 | fi 250 | if [ "$auth" != "none" ]; then 251 | procd_append_param command "$auth" 252 | fi 253 | if [ "$network" != "" ]; then 254 | procd_append_param command "-i" "$network" 255 | fi 256 | #日志 257 | procd_append_param command "-f" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache" 258 | 259 | procd_set_param respawn 260 | procd_set_param procd_pid "${MODEM_RUNDIR}/modem${modem_no}.pid" 261 | procd_close_instance 262 | } 263 | 264 | #设置网络接口(Modem Manager) 265 | # $1:接口名称 266 | # $2:模组路径 267 | set_interface_modemmanager() 268 | { 269 | local interface_name="$1" 270 | local path="$2" 271 | 272 | if [ "$(uci -q get network.${interface_name}.device)" != "${path}" ] ; then 273 | uci set network.${interface_name}='interface' 274 | uci set network.${interface_name}.proto='modemmanager' 275 | uci set network.${interface_name}.device="${path}" 276 | uci set network.${interface_name}.auth="$auth" 277 | uci set network.${interface_name}.iptype="$pdp_type" 278 | 279 | if [ "$apn" != "" ]; then 280 | uci set network.${interface_name}.apn="$apn" 281 | fi 282 | if [ "$pincode" != "" ]; then 283 | uci set network.${interface_name}.pincode="$pincode" 284 | fi 285 | if [ "$username" != "" ]; then 286 | uci set network.${interface_name}.username="$username" 287 | fi 288 | if [ "$password" != "" ]; then 289 | uci set network.${interface_name}.password="$password" 290 | fi 291 | 292 | uci commit network 293 | 294 | #加入WAN防火墙 295 | set_firewall "${interface_name}" 296 | fi 297 | 298 | #启动网络接口 299 | ifup "${interface_name}" 300 | } 301 | 302 | #模块管理 303 | modemmanager() 304 | { 305 | #获取接口名称 306 | local interface_name="wwan_5g_${modem_no}" 307 | #获取调制解调器设备(模组路径) 308 | local path=$(uci -q get modem.modem${modem_no}.path) 309 | #设置Modem Manager网络接口 310 | set_interface_modemmanager "$interface_name" "$path" 311 | 312 | #拨号 313 | procd_open_instance 314 | procd_set_param command sh ${SCRIPT_DIR}/modem_network_task.sh "${id}" "${modem_no}" "modemmanager" 315 | procd_set_param respawn 316 | procd_close_instance 317 | } 318 | 319 | qmi() 320 | { 321 | #选择拨号工具 322 | case $dial_tool in 323 | "quectel-CM") quectel_cm ;; 324 | "mmcli") modemmanager ;; 325 | "") quectel_cm ;; 326 | *) quectel_cm ;; 327 | esac 328 | } 329 | 330 | gobinet() 331 | { 332 | #获取制造商 333 | local manufacturer=$(uci -q get modem.modem${modem_no}.manufacturer) 334 | 335 | #拨号 336 | case $manufacturer in 337 | "quectel") qmi ;; 338 | *) 339 | procd_open_instance 340 | procd_set_param command sh ${SCRIPT_DIR}/modem_network_task.sh "${id}" "${modem_no}" "gobinet" 341 | procd_set_param respawn 342 | procd_close_instance 343 | ;; 344 | esac 345 | } 346 | 347 | ecm() 348 | { 349 | #拨号 350 | procd_open_instance 351 | procd_set_param command sh ${SCRIPT_DIR}/modem_network_task.sh "${id}" "${modem_no}" "ecm" 352 | procd_set_param respawn 353 | procd_close_instance 354 | } 355 | 356 | mbim() 357 | { 358 | qmi 359 | } 360 | 361 | rndis() 362 | { 363 | #拨号 364 | procd_open_instance 365 | procd_set_param command sh ${SCRIPT_DIR}/modem_network_task.sh "${id}" "${modem_no}" "rndis" 366 | procd_set_param respawn 367 | procd_close_instance 368 | } 369 | 370 | ncm() 371 | { 372 | ecm 373 | } 374 | 375 | stop_qmi() 376 | { 377 | #获取modem的实例信息 378 | local response=$(ubus call service list '{"name": "modem"}') 379 | local instance_number=$(echo "$response" | jq -r '.modem.instances | length') 380 | for i in $(seq 1 $((instance_number))); do 381 | #获取拨号命令 382 | local command=$(echo "$response" | jq -r ".modem.instances.instance$i.command") 383 | #移远拨号工具 384 | if [[ "$command" = *"$network"* ]]; then 385 | local pid=$(echo "$response" | jq -r ".modem.instances.$i.pid") 386 | kill $pid >/dev/null 2>&1 387 | fi 388 | 389 | #Modem Manager 390 | #获取接口名称 391 | local interface_name="wwan_5g_${modem_no}" 392 | if [[ "$command" = *"$interface_name"* ]]; then 393 | local pid=$(echo "$response" | jq -r ".modem.instances.$i.pid") 394 | kill $pid >/dev/null 2>&1 395 | 396 | #获取调制解调器设备(模组路径) 397 | local path=$(uci -q get modem.modem${modem_no}.path) 398 | mmcli -m "$path" --simple-disconnect 399 | #删除网络接口 400 | uci -q del network.${interface_name} 401 | uci commit network 402 | fi 403 | done 404 | } 405 | 406 | stop_gobinet() 407 | { 408 | #获取AT串口、制造商 409 | local at_port=$(uci -q get modem.modem${modem_no}.at_port) 410 | local manufacturer=$(uci -q get modem.modem${modem_no}.manufacturer) 411 | 412 | #停止拨号 413 | local at_command 414 | if [ "$manufacturer" = "quectel" ]; then 415 | stop_qmi 416 | elif [ "$manufacturer" = "fibocom" ]; then 417 | at_command='AT$QCRMCALL=0,1' 418 | elif [ "$manufacturer" = "meig" ]; then 419 | at_command="AT$QCRMCALL=0,1,${define_connect},2,1" 420 | else 421 | at_command='ATI' 422 | fi 423 | 424 | tmp=$(at "${at_port}" "${at_command}") 425 | } 426 | 427 | stop_ecm() 428 | { 429 | #获取AT串口、制造商、平台、连接定义 430 | local at_port=$(uci -q get modem.modem${modem_no}.at_port) 431 | local manufacturer=$(uci -q get modem.modem${modem_no}.manufacturer) 432 | local platform=$(uci -q get modem.modem${modem_no}.platform) 433 | local define_connect=$(uci -q get modem.modem${modem_no}.define_connect) 434 | 435 | #停止拨号 436 | local at_command 437 | if [ "$manufacturer" = "quectel" ]; then 438 | at_command="AT+QNETDEVCTL=${define_connect},2,1" 439 | elif [ "$manufacturer" = "fibocom" ]; then 440 | #联发科平台(广和通FM350-GL) 441 | if [ "$platform" = "mediatek" ]; then 442 | at_command="AT+CGACT=0,${define_connect}" 443 | else 444 | at_command="AT+GTRNDIS=0,${define_connect}" 445 | fi 446 | elif [ "$manufacturer" = "meig" ]; then 447 | at_command="AT^NDISDUP=${define_connect},0" 448 | else 449 | at_command='ATI' 450 | fi 451 | 452 | tmp=$(at "${at_port}" "${at_command}") 453 | } 454 | 455 | stop_mbim() 456 | { 457 | stop_qmi 458 | } 459 | 460 | stop_rndis() 461 | { 462 | stop_ecm 463 | #广和通的rndis和ecm不同,后续再测试 464 | } 465 | 466 | stop_ncm() 467 | { 468 | stop_ecm 469 | } 470 | 471 | #获取模块序号 472 | # $1:移动网络 473 | get_modem_no() 474 | { 475 | local modem_number=$(uci -q get modem.@global[0].modem_number) 476 | local modem_network 477 | for i in $(seq 0 $((modem_number-1))); do 478 | modem_network=$(uci -q get modem.modem${i}.network) 479 | if [ "$modem_network" = "$1" ]; then 480 | #模块序号 481 | modem_no=${i} 482 | break 483 | fi 484 | done 485 | } 486 | 487 | #获取实例运行状态(未使用) 488 | # $1:配置ID 489 | get_instance_status() 490 | { 491 | local config_id="$1" 492 | 493 | #获取modem的实例信息 494 | local response=$(ubus call service list '{"name": "modem"}') 495 | local instance_number=$(echo "$response" | jq -r ".modem.instances | length") 496 | for i in $(seq 1 $((instance_number))); do 497 | #获取运行状态和拨号命令 498 | local running_status=$(echo "$response" | jq -r ".modem.instances.instance$i.running") 499 | local command=$(echo "$response" | jq -r ".modem.instances.instance$i.command") 500 | if [ "$running_status" = "true" ] && [[ "$command" = *"$network"* ]]; then 501 | #查看配置ID是否记录在已运行的文件里 502 | local run_config="/var/run/modem" 503 | local run_config_id=$(grep -n "$network" "$run_config" | cut -d ',' -f 2) 504 | if [ "${config_id}" = "$run_config_id" ]; then 505 | status=2 506 | break 507 | else 508 | status=1 509 | break 510 | fi 511 | fi 512 | done 513 | } 514 | 515 | #获取拨号模式 516 | # $1:模块号 517 | get_mode() 518 | { 519 | local modem_no="$1" 520 | 521 | local manufacturer=$(uci -q get modem.modem${modem_no}.manufacturer) 522 | local at_port=$(uci -q get modem.modem${modem_no}.at_port) 523 | local platform=$(uci -q get modem.modem${modem_no}.platform) 524 | 525 | mode=$(${manufacturer}_get_mode ${at_port} ${platform}) 526 | echo "$mode" 527 | } 528 | 529 | #网络预设 530 | connect_presets() 531 | { 532 | local at_port=$(uci -q get modem.modem${modem_no}.at_port) 533 | 534 | #运营商选择设置 535 | local at_command='AT+COPS=0,0' 536 | tmp=$(at "${at_port}" "${at_command}") 537 | 538 | #获取连接定义 539 | local define_connect=$(uci -q get modem.modem${modem_no}.define_connect) 540 | #获取PDP类型和APN 541 | local pdp_type_tmp="IPV4V6" 542 | if [ -n "$pdp_type" ]; then 543 | pdp_type_tmp=$(echo $pdp_type | tr 'a-z' 'A-Z') 544 | fi 545 | local apn_tmp="" 546 | if [ -n "$apn" ]; then 547 | apn_tmp=$(echo $apn | tr 'a-z' 'A-Z') 548 | fi 549 | 550 | #PDP设置 551 | at_command="AT+CGDCONT=$define_connect,\"$pdp_type_tmp\",\"$apn_tmp\"" 552 | tmp=$(at "${at_port}" "${at_command}") 553 | 554 | #制造商私有预设 555 | # quectel_presets 556 | # fibocom_presets 557 | } 558 | 559 | #停止拨号 560 | # $1:配置ID 561 | stop_dial() 562 | { 563 | local id="$1" #配置ID 564 | local network=$(uci -q get modem.$1.network) #移动网络 565 | 566 | #把配置ID从临时列表中移除 567 | if [ -f "${MODEM_RUN_CONFIG}" ] && grep -q "${network}" "${MODEM_RUN_CONFIG}"; then 568 | #该配置ID在运行,需要删除记录 569 | sed -i "/${id}/d" "${MODEM_RUN_CONFIG}" 570 | 571 | #获取模块序号 572 | get_modem_no "${network}" 573 | 574 | #获取模组的拨号模式 575 | [ -z "${modem_no}" ] && return 0 576 | local mode=$(get_mode ${modem_no}) 577 | [ -z "$mode" ] || [ "$mode" = "unknown" ] && return 578 | 579 | #根据不同的拨号模式停止拨号 580 | if [ "$mode" = "qmi" ]; then 581 | stop_qmi 582 | elif [ "$mode" = "gobinet" ]; then 583 | stop_gobinet 584 | elif [ "$mode" = "ecm" ]; then 585 | stop_ecm 586 | elif [ "$mode" = "mbim" ]; then 587 | stop_mbim 588 | elif [ "$mode" = "rndis" ]; then 589 | stop_rndis 590 | elif [ "$mode" = "ncm" ]; then 591 | stop_ncm 592 | fi 593 | 594 | fi 595 | } 596 | 597 | dial() 598 | { 599 | local enable #启用 600 | local id #ID 601 | 602 | config_get enable $1 enable 603 | config_get id $1 id 604 | 605 | #停止拨号配置 606 | [ "$enable" = "0" ] && { 607 | stop_dial "$id" 608 | return 0 609 | } 610 | 611 | local remarks #备注 612 | local network #移动网络 613 | local dial_tool #拨号工具 614 | local pdp_type #网络类型(IP类型) 615 | local network_bridge #网络桥接 616 | local apn #接入点 617 | local username #用户名 618 | local password #密码 619 | local auth #认证类型 620 | 621 | config_get remarks $1 remarks 622 | config_get network $1 network 623 | config_get dial_tool $1 dial_tool 624 | config_get pdp_type $1 pdp_type 625 | config_get network_bridge $1 network_bridge 626 | config_get apn $1 apn 627 | config_get username $1 username 628 | config_get password $1 password 629 | config_get auth $1 auth 630 | 631 | #获取模块序号 632 | get_modem_no "${network}" 633 | [ -z "${modem_no}" ] && return 0 634 | 635 | #获取模组的拨号模式 636 | local time=0 637 | local mode 638 | while [ $time -lt 10 ]; do 639 | mode=$(get_mode ${modem_no}) 640 | [ -n "$mode" ] && [ "$mode" != "unknown" ] && break 641 | sleep 5s 642 | time=$((time+1)) 643 | done 644 | 645 | #获取不到拨号模式 646 | [ -z "$mode" ] || [ "$mode" = "unknown" ] && { 647 | uci set modem.$1.enable=0 648 | uci commit modem 649 | return 0 650 | } 651 | 652 | #查看该移动网络是否已经有拨号配置在运行 653 | mkdir -m 0755 -p "${MODEM_RUNDIR}" 654 | if [ ! -f "${MODEM_RUN_CONFIG}" ] || ! grep -q "${network}" "${MODEM_RUN_CONFIG}"; then 655 | #文件不存在或者未记录该移动网络 656 | echo "${network},${id}" >> "${MODEM_RUN_CONFIG}" 657 | 658 | #获取网络接口 659 | local network_interface=$(uci -q get modem.modem${modem_no}.network_interface) 660 | #设置网络接口 661 | set_interface "${modem_no}" "${network_interface}" 662 | else 663 | local config_id=$(awk -v network="${network}" -F',' '!/^#/ && $0 ~ network { print $2 }' "${MODEM_RUN_CONFIG}") 664 | #该移动网络已存在,且已有其他拨号配置在运行 665 | if [ "$id" != "$config_id" ]; then 666 | uci set modem.$1.enable=0 667 | uci commit modem 668 | return 0 669 | fi 670 | fi 671 | 672 | #设置网络预设 673 | connect_presets 674 | 675 | #根据不同的拨号模式拨号 676 | if [ "$mode" = "qmi" ]; then 677 | qmi 678 | elif [ "$mode" = "gobinet" ]; then 679 | gobinet 680 | elif [ "$mode" = "ecm" ]; then 681 | ecm 682 | elif [ "$mode" = "mbim" ]; then 683 | mbim 684 | elif [ "$mode" = "rndis" ]; then 685 | rndis 686 | elif [ "$mode" = "ncm" ]; then 687 | ncm 688 | fi 689 | 690 | # sleep 15 691 | } 692 | 693 | #手动设置模组信息 694 | manual_set_modem_config() 695 | { 696 | local manual #手动配置 697 | local network #移动网络 698 | # local name #模组名称 699 | # local at_port #AT串口 700 | 701 | config_get manual $1 manual 702 | config_get network $1 network 703 | # config_get name $1 name 704 | # config_get at_port $1 at_port 705 | 706 | [ -z "$manual" ] || [ "$manual" = "0" ] && return 707 | 708 | #获取网络设备路径 709 | local network_path="$(readlink -f /sys/class/net/${network})" 710 | 711 | #只处理最上级的网络设备 712 | local count=$(echo "${network_path}" | grep -o "/net" | wc -l) 713 | [ "$count" -ge "2" ] && return 714 | 715 | #判断路径是否带有usb(排除其他eth网络设备) 716 | if [[ "$network" = *"eth"* ]] && [[ "$network_path" != *"usb"* ]]; then 717 | return 718 | fi 719 | 720 | #获取物理路径 721 | local physical_path=$(m_get_device_physical_path ${network_path}) 722 | 723 | #获取当前模组数量(下面新增配置会导致多一个,这里需要减掉一个) 724 | local modem_number=$(uci -q get modem.@global[0].modem_number) 725 | uci set modem.@global[0].modem_number=$((modem_number-1)) 726 | 727 | #设置模组硬件配置 728 | m_set_modem_hardware_config "${physical_path}" 729 | 730 | #设置模组网络配置 731 | m_set_network_config "${network}" "${physical_path}" 732 | 733 | #设置模组串口 734 | m_set_modem_port "${physical_path}" 735 | 736 | #获取模组数量 737 | modem_number=$(uci -q get modem.@global[0].modem_number) 738 | #获取模组序号 739 | local modem_no 740 | for i in $(seq 0 $((modem_number-1))); do 741 | local modem_path=$(uci -q get modem.modem${i}.path) 742 | if [ "$modem_path" = "$physical_path" ]; then 743 | modem_no="${i}" 744 | break 745 | fi 746 | done 747 | 748 | #设置模组配置(由于AT串口已经提前设置,则跳过了模组配置,这里需要手动执行一次) 749 | m_set_modem_config "${modem_no}" "${physical_path}" 750 | uci commit modem 751 | } 752 | 753 | #删除拨号配置 754 | del_dial_config() 755 | { 756 | #运行配置是否存在 757 | if [ -f "${MODEM_RUN_CONFIG}" ]; then 758 | 759 | local configs=$(cat ${MODEM_RUN_CONFIG}) 760 | for config in $configs; do 761 | #设置标志位 762 | local flag="0" 763 | local id=$(echo "$config" | awk -F',' '{print $2}') 764 | 765 | local config_number=2 766 | for i in $(seq 0 $((config_number-1))); do 767 | local config_id=$(uci -q get modem.@dial-config[${i}].id) 768 | [ "$config_id" = "$id" ] && { 769 | flag="1" 770 | } 771 | done 772 | 773 | #删除运行配置 774 | [ "$flag" = "0" ] && { 775 | sed -i "/${id}/d" "${MODEM_RUN_CONFIG}" 776 | } 777 | done 778 | fi 779 | } 780 | 781 | #统计模组数量 782 | count_modem_number() 783 | { 784 | local network #移动网络 785 | 786 | config_get network $1 network 787 | 788 | modem_count=$((modem_count+1)) 789 | } 790 | 791 | service_triggers() 792 | { 793 | procd_add_reload_trigger "modem" 794 | } 795 | 796 | start_service() { 797 | 798 | #加载模组配置 799 | config_load modem 800 | 801 | #统计模组数量 802 | modem_count=0 803 | config_foreach count_modem_number "modem-device" 804 | #设置模组数量 805 | uci set modem.@global[0].modem_number=${modem_count} 806 | uci commit modem 807 | 808 | #手动设置模组信息 809 | config_foreach manual_set_modem_config "modem-device" 810 | 811 | local enable_dial=$(uci -q get modem.@global[0].enable_dial) 812 | if [ "$enable_dial" = "0" ]; then 813 | stop_service 814 | else 815 | #删除拨号配置 816 | del_dial_config 817 | #加载拨号配置 818 | config_foreach dial "dial-config" 819 | fi 820 | } 821 | 822 | stop_service() 823 | { 824 | #删除记录文件 825 | rm -rf ${MODEM_RUN_CONFIG} 826 | #停止qmi、mbim拨号 827 | killall quectel-CM >/dev/null 2>&1 828 | #停止gobinet、ecm、rndis、ncm拨号 829 | local modem_number=$(uci -q get modem.@global[0].modem_number) 830 | for i in $(seq 0 $((modem_number-1))); do 831 | modem_no=$i 832 | local mode=$(uci -q get modem.modem${modem_no}.mode) 833 | case $mode in 834 | "gobinet") stop_gobinet ;; 835 | "ecm") stop_ecm ;; 836 | "rndis") stop_rndis ;; 837 | "ncm") stop_ncm ;; 838 | *) stop_ecm ;; 839 | esac 840 | done 841 | } 842 | --------------------------------------------------------------------------------