更新
This commit is contained in:
parent
e8394c927d
commit
7ea94507fd
@ -19,6 +19,8 @@ LUCI_DEPENDS:=+luci-compat +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm
|
||||
+kmod-pcie_mhi \
|
||||
+pciutils \
|
||||
+quectel-CM-5G \
|
||||
+modemmanager \
|
||||
+luci-proto-modemmanager \
|
||||
+sms-tool \
|
||||
+jq +grep\
|
||||
|
||||
|
@ -69,18 +69,19 @@ getMobileNetwork()
|
||||
--------advanced--------
|
||||
|
||||
-- 拨号工具
|
||||
dial_tool = s:taboption("advanced", Value, "dial_tool", translate("Dial Tool"))
|
||||
dial_tool = s:taboption("advanced", ListValue, "dial_tool", translate("Dial Tool"))
|
||||
dial_tool.rmempty = true
|
||||
dial_tool:value("", translate("Auto Choose"))
|
||||
dial_tool:value("quectel-CM", translate("quectel-CM"))
|
||||
dial_tool:value("mmcli", translate("mmcli"))
|
||||
|
||||
-- 网络类型
|
||||
pdp_type= s:taboption("advanced", ListValue, "pdp_type", translate("PDP Type"))
|
||||
pdp_type.default = "ipv4_ipv6"
|
||||
pdp_type.default = "ipv4v6"
|
||||
pdp_type.rmempty = false
|
||||
pdp_type:value("ipv4", translate("IPv4"))
|
||||
pdp_type:value("ipv6", translate("IPv6"))
|
||||
pdp_type:value("ipv4_ipv6", translate("IPv4/IPv6"))
|
||||
pdp_type:value("ipv4v6", translate("IPv4/IPv6"))
|
||||
|
||||
-- 接入点
|
||||
apn = s:taboption("advanced", Value, "apn", translate("APN"))
|
||||
@ -99,13 +100,12 @@ username.rmempty = true
|
||||
password = s:taboption("advanced", Value, "password", translate("PAP/CHAP Password"))
|
||||
password.rmempty = true
|
||||
|
||||
auth = s:taboption("advanced", Value, "auth", translate("Authentication Type"))
|
||||
auth.default = ""
|
||||
auth.rmempty = true
|
||||
auth:value("", translate("NONE"))
|
||||
auth:value("both", "PAP/CHAP (both)")
|
||||
auth = s:taboption("advanced", ListValue, "auth", translate("Authentication Type"))
|
||||
auth.default = "none"
|
||||
auth.rmempty = false
|
||||
auth:value("none", translate("NONE"))
|
||||
auth:value("both", translate("PAP/CHAP (both)"))
|
||||
auth:value("pap", "PAP")
|
||||
auth:value("chap", "CHAP")
|
||||
-- auth:value("none", "NONE")
|
||||
|
||||
return m
|
||||
|
@ -63,14 +63,19 @@ o = s:option(DummyValue, "dial_tool", translate("Dial Tool"))
|
||||
o.cfgvalue = function(t, n)
|
||||
local dial_tool = (Value.cfgvalue(t, n) or "")
|
||||
if dial_tool == "" then
|
||||
dial_tool=translate("Auto Choose")
|
||||
dial_tool = translate("Auto Choose")
|
||||
end
|
||||
return dial_tool
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "pdp_type", translate("PDP Type"))
|
||||
o.cfgvalue = function(t, n)
|
||||
local pdp_type = (Value.cfgvalue(t, n) or ""):gsub("_","/"):upper():gsub("V","v")
|
||||
local pdp_type = (Value.cfgvalue(t, n) or "")
|
||||
if pdp_type == "ipv4v6" then
|
||||
pdp_type = translate("IPv4/IPv6")
|
||||
else
|
||||
pdp_type = pdp_type:gsub("_","/"):upper():gsub("V","v")
|
||||
end
|
||||
return pdp_type
|
||||
end
|
||||
|
||||
@ -78,7 +83,7 @@ o = s:option(DummyValue, "apn", translate("APN"))
|
||||
o.cfgvalue = function(t, n)
|
||||
local apn = (Value.cfgvalue(t, n) or "")
|
||||
if apn == "" then
|
||||
apn=translate("Auto Choose")
|
||||
apn = translate("Auto Choose")
|
||||
end
|
||||
return apn
|
||||
end
|
||||
|
@ -35,13 +35,10 @@
|
||||
|
||||
//获取快捷AT命令选择框元素
|
||||
command_select = document.getElementById('command_select');
|
||||
//点击快捷AT命令时触发(解决选择第一条命令的问题)
|
||||
//点击快捷AT命令时触发(解决情况再选的问题)
|
||||
command_select.addEventListener("click", function() {
|
||||
//选择框不为空,且选中的为第一个
|
||||
if (command_select.options.length != 0 && command_select.selectedIndex == 0) {
|
||||
//自动填写到命令输入框
|
||||
copy_to_input();
|
||||
}
|
||||
});
|
||||
|
||||
//获取网络偏好选项元素
|
||||
@ -354,7 +351,7 @@
|
||||
}
|
||||
|
||||
// 设置拨号模式信息
|
||||
function set_mode_info(mode_info)
|
||||
function set_mode_info(mode_info,first_cache)
|
||||
{
|
||||
//获取当前拨号模式
|
||||
var current_mode=mode_info["mode"];
|
||||
@ -367,8 +364,7 @@
|
||||
//设置当前拨号模式
|
||||
document.getElementById('current_mode').innerHTML=current_mode_view;
|
||||
|
||||
var first_element=document.getElementById('first_checked');
|
||||
if (first_element.value=="true")
|
||||
if (first_cache)
|
||||
{
|
||||
//设置支持的拨号模式
|
||||
var mode_option_view='';
|
||||
@ -405,8 +401,6 @@
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "set_mode")%>', {"port":at_port,"mode_config":mode_config},
|
||||
function(x, data)
|
||||
{
|
||||
console.log(data);
|
||||
|
||||
//获取模组拨号模式
|
||||
var current_mode=data;
|
||||
|
||||
@ -448,7 +442,7 @@
|
||||
}
|
||||
|
||||
// 设置网络偏好信息
|
||||
function set_network_prefer_info(network_prefer_info)
|
||||
function set_network_prefer_info(network_prefer_info,first_cache)
|
||||
{
|
||||
//获取模组网络偏好
|
||||
var network_prefer=network_prefer_info["network_prefer"];
|
||||
@ -460,8 +454,7 @@
|
||||
document.getElementById('current_prefer').innerHTML=current_prefer_view;
|
||||
|
||||
//设置偏好选项和复选框
|
||||
var first_element=document.getElementById('first_checked');
|
||||
if (first_element.value=="true")
|
||||
if (first_cache)
|
||||
{
|
||||
if (network_prefer["3G"]&&network_prefer["4G"]&&network_prefer["5G"])
|
||||
{
|
||||
@ -539,7 +532,7 @@
|
||||
}
|
||||
|
||||
// 获取模组调试信息
|
||||
function get_modem_debug_info(params)
|
||||
function get_modem_debug_info(debug_params)
|
||||
{
|
||||
//获取选中的模组
|
||||
var at_port = document.getElementById("modem_select").value;
|
||||
@ -548,7 +541,6 @@
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "get_modem_debug_info")%>', {"port":at_port},
|
||||
function(x, data)
|
||||
{
|
||||
|
||||
var mode_info=data["mode_info"];
|
||||
var network_prefer_info=data["network_prefer_info"];
|
||||
if (Object.keys(mode_info).length==0||Object.keys(network_prefer_info).length==0) {
|
||||
@ -558,13 +550,13 @@
|
||||
}
|
||||
|
||||
//设置模式信息
|
||||
set_mode_info(mode_info);
|
||||
set_mode_info(mode_info,debug_params.first_cache);
|
||||
|
||||
//设置网络偏好信息
|
||||
set_network_prefer_info(network_prefer_info);
|
||||
set_network_prefer_info(network_prefer_info,debug_params.first_cache);
|
||||
|
||||
//设置第一次获取数据标志
|
||||
document.getElementById('first_checked').value=false;
|
||||
debug_params.first_cache=false;
|
||||
|
||||
//显示全功能界面
|
||||
all_function_view();
|
||||
@ -574,42 +566,46 @@
|
||||
|
||||
// 定时触发更新AT串口
|
||||
XHR.poll(5,'<%=luci.dispatcher.build_url("admin", "network", "modem", "get_at_port")%>', null,
|
||||
function(x, data)
|
||||
(function()
|
||||
{
|
||||
var at_ports=data["at_ports"];
|
||||
var translation=data["translation"];
|
||||
|
||||
//设置AT串口选项
|
||||
set_at_port(at_ports,translation);
|
||||
|
||||
//获取快捷命令
|
||||
if (Object.keys(at_ports).length==0)
|
||||
//缓存当前选择的模组
|
||||
var modem_select_cache="";
|
||||
var debug_params={first_cache:true};
|
||||
return function(x, data)
|
||||
{
|
||||
//显示无模组界面
|
||||
no_modems_view();
|
||||
}
|
||||
else
|
||||
{
|
||||
//获取缓存的模组
|
||||
var modem_select_cache = document.getElementById("modem_select_cache");
|
||||
//获取当前的选择的模组名称
|
||||
var modem_select_element = document.getElementById('modem_select');
|
||||
var select_modem_name = modem_select_element.options[modem_select_element.selectedIndex].text;
|
||||
|
||||
if (select_modem_name != modem_select_cache.value)
|
||||
var at_ports=data["at_ports"];
|
||||
var translation=data["translation"];
|
||||
|
||||
//设置AT串口选项
|
||||
set_at_port(at_ports,translation);
|
||||
|
||||
//获取快捷命令
|
||||
if (Object.keys(at_ports).length==0)
|
||||
{
|
||||
//获取快捷选项
|
||||
var quick_option = document.querySelector('input[name="quick_option"]:checked').value;
|
||||
if (quick_option=="auto") {
|
||||
get_quick_commands();
|
||||
}
|
||||
modem_select_cache.value=select_modem_name;
|
||||
//显示无模组界面
|
||||
no_modems_view();
|
||||
}
|
||||
else
|
||||
{
|
||||
//获取当前的选择的模组名称
|
||||
var modem_select_element = document.getElementById('modem_select');
|
||||
var select_modem_name = modem_select_element.options[modem_select_element.selectedIndex].text;
|
||||
|
||||
if (select_modem_name != modem_select_cache)
|
||||
{
|
||||
//获取快捷选项
|
||||
var quick_option = document.querySelector('input[name="quick_option"]:checked').value;
|
||||
if (quick_option=="auto") {
|
||||
get_quick_commands();
|
||||
}
|
||||
modem_select_cache=select_modem_name;
|
||||
}
|
||||
|
||||
//获取模组调试信息
|
||||
get_modem_debug_info();
|
||||
}
|
||||
}
|
||||
//获取模组调试信息
|
||||
get_modem_debug_info(debug_params);
|
||||
}
|
||||
};
|
||||
})()
|
||||
);
|
||||
|
||||
//]]>
|
||||
@ -635,16 +631,6 @@
|
||||
font-size: 15px;
|
||||
} */
|
||||
|
||||
/* 模组选择缓存 */
|
||||
[name="modem_select_cache"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 网络偏好第一次复选框 */
|
||||
[name="first_checked"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 终端 */
|
||||
textarea {
|
||||
background:#373737;
|
||||
@ -704,12 +690,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div name="modem_select_cache">
|
||||
<input type="hidden" id="modem_select_cache" value="">
|
||||
</div>
|
||||
<div name="first_checked">
|
||||
<input type="hidden" id="first_checked" value="true">
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
@ -178,6 +178,9 @@ msgstr "自动选择"
|
||||
msgid "quectel-CM"
|
||||
msgstr "移远模组拨号工具"
|
||||
|
||||
msgid "mmcli"
|
||||
msgstr "模组管理工具"
|
||||
|
||||
msgid "PDP Type"
|
||||
msgstr "网络类型"
|
||||
|
||||
@ -208,6 +211,9 @@ msgstr "PAP/CHAP 密码"
|
||||
msgid "Authentication Type"
|
||||
msgstr "认证类型"
|
||||
|
||||
msgid "PAP/CHAP (both)"
|
||||
msgstr "PAP/CHAP (均使用)"
|
||||
|
||||
msgid "NONE"
|
||||
msgstr "无"
|
||||
|
||||
|
@ -16,9 +16,13 @@ config custom-commands
|
||||
option command 'AT+CPIN?'
|
||||
|
||||
config custom-commands
|
||||
option description '查询此时信号强度 > AT+CSQ'
|
||||
option description '查询网络信号质量(4G) > AT+CSQ'
|
||||
option command 'AT+CSQ'
|
||||
|
||||
config custom-commands
|
||||
option description '查询网络信号质量(5G) > AT+CESQ'
|
||||
option command 'AT+CESQ'
|
||||
|
||||
config custom-commands
|
||||
option description '查询网络信息 > AT+COPS?'
|
||||
option command 'AT+COPS?'
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
|
||||
START=21
|
||||
START=90
|
||||
STOP=13
|
||||
USE_PROCD=1
|
||||
|
||||
@ -90,6 +90,7 @@ USE_PROCD=1
|
||||
# }
|
||||
|
||||
#设置防火墙
|
||||
# $1:网络接口名称
|
||||
set_firewall()
|
||||
{
|
||||
local num=`uci show firewall | grep "name='wan'" | wc -l`
|
||||
@ -136,13 +137,25 @@ set_ipv6_interface()
|
||||
|
||||
#加入WAN防火墙
|
||||
set_firewall $1
|
||||
|
||||
#启动网络接口
|
||||
ifup $1
|
||||
else
|
||||
uci set network.$1.extendprefix='1'
|
||||
uci commit network
|
||||
fi
|
||||
|
||||
#启动网络接口
|
||||
ifup $1
|
||||
}
|
||||
|
||||
#设置IPV4和IPv6网络接口
|
||||
# $1:IPV4网络接口名称
|
||||
# $2:IPv6网络接口名称
|
||||
# $3:网络接口
|
||||
set_ipv4v6_interface()
|
||||
{
|
||||
#设置IPV4网络接口
|
||||
set_ipv4_interface $1 $3
|
||||
#设置IPV6网络接口(别名)
|
||||
set_ipv6_interface $2 "@$1"
|
||||
}
|
||||
|
||||
#设置网络接口
|
||||
@ -153,51 +166,35 @@ set_interface()
|
||||
case $pdp_type in
|
||||
"ipv4") set_ipv4_interface wwan_5g_$1 $2 ;;
|
||||
"ipv6") set_ipv6_interface wwan6_5g_$1 $2 ;;
|
||||
"ipv4_ipv6")
|
||||
set_ipv4_interface "wwan_5g_$1" $2
|
||||
set_ipv6_interface "wwan6_5g_$1" $2
|
||||
;;
|
||||
*)
|
||||
set_ipv4_interface "wwan_5g_$1" $2
|
||||
set_ipv6_interface "wwan6_5g_$1" $2
|
||||
;;
|
||||
"ipv4v6") set_ipv4v6_interface "wwan_5g_$1" "wwan6_5g_$1" $2 ;;
|
||||
*) set_ipv4v6_interface "wwan_5g_$1" "wwan6_5g_$1" $2 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
qmi()
|
||||
#移远拨号工具
|
||||
quectel_cm()
|
||||
{
|
||||
#设置网络接口
|
||||
local network_interface=$(uci -q get modem.modem$modem_no.network_interface)
|
||||
set_interface $modem_no $network_interface
|
||||
|
||||
#拨号
|
||||
procd_open_instance
|
||||
|
||||
if [ "$dial_tool" = "quectel-CM" ]; then
|
||||
procd_set_param command quectel-CM
|
||||
elif [[ -z "$dial_tool" ]]; then
|
||||
procd_set_param command quectel-CM
|
||||
else
|
||||
procd_set_param command $dial_tool
|
||||
fi
|
||||
procd_set_param command quectel-CM
|
||||
|
||||
case $pdp_type in
|
||||
"ipv4") procd_append_param command -4 ;;
|
||||
"ipv6") procd_append_param command -6 ;;
|
||||
"ipv4_ipv6") procd_append_param command -4 -6 ;;
|
||||
"ipv4v6") procd_append_param command -4 -6 ;;
|
||||
*) procd_append_param command -4 -6 ;;
|
||||
esac
|
||||
|
||||
if [ "$apn" != "" ]; then
|
||||
procd_append_param command -s $apn
|
||||
fi
|
||||
if [ "$user" != "" ]; then
|
||||
procd_append_param command $user
|
||||
if [ "$username" != "" ]; then
|
||||
procd_append_param command $username
|
||||
fi
|
||||
if [ "$password" != "" ]; then
|
||||
procd_append_param command $password
|
||||
fi
|
||||
if [ "$auth" != "" ]; then
|
||||
if [ "$auth" != "none" ]; then
|
||||
procd_append_param command $auth
|
||||
fi
|
||||
if [ "$network" != "" ]; then
|
||||
@ -208,6 +205,82 @@ qmi()
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
#设置网络接口(Modem Manager)
|
||||
# $1:接口名称
|
||||
# $2:模组路径
|
||||
set_interface_modemmanager()
|
||||
{
|
||||
if [ "$(uci -q get network.$1.device)" != "$2" ] ; then
|
||||
uci set network.$1='interface'
|
||||
uci set network.$1.proto='modemmanager'
|
||||
uci set network.$1.device="$2"
|
||||
uci set network.$1.auth="$auth"
|
||||
uci set network.$1.iptype="$pdp_type"
|
||||
|
||||
if [ "$apn" != "" ]; then
|
||||
uci set network.$1.apn="$apn"
|
||||
fi
|
||||
if [ "$pincode" != "" ]; then
|
||||
uci set network.$1.pincode="$pincode"
|
||||
fi
|
||||
if [ "$username" != "" ]; then
|
||||
uci set network.$1.username="$username"
|
||||
fi
|
||||
if [ "$password" != "" ]; then
|
||||
uci set network.$1.password="$password"
|
||||
fi
|
||||
|
||||
uci commit network
|
||||
|
||||
#加入WAN防火墙
|
||||
set_firewall $1
|
||||
fi
|
||||
|
||||
#启动网络接口
|
||||
ifup $1
|
||||
}
|
||||
|
||||
#模块管理
|
||||
modemmanager()
|
||||
{
|
||||
#获取接口名称
|
||||
local interface_name="wwan_5g_$modem_no"
|
||||
|
||||
#获取调制解调器设备(模组路径)
|
||||
local path=$(uci -q get modem.modem$modem_no.path)
|
||||
|
||||
#设置Modem Manager网络接口
|
||||
set_interface_modemmanager "$interface_name" "$path"
|
||||
|
||||
#获取网络接口、AT串口、制造商
|
||||
local network_interface=$(uci -q get modem.modem$modem_no.network_interface)
|
||||
local at_port=$(uci -q get modem.modem$modem_no.at_port)
|
||||
local manufacturer=$(uci -q get modem.modem$modem_no.manufacturer)
|
||||
#设置网络接口
|
||||
set_interface $modem_no "$network_interface"
|
||||
|
||||
#拨号
|
||||
procd_open_instance
|
||||
procd_set_param command sh /usr/share/modem/modem_network_task.sh "$id" "$at_port" "$manufacturer" "modemmanager" "$interface_name"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
qmi()
|
||||
{
|
||||
#设置网络接口
|
||||
local network_interface=$(uci -q get modem.modem$modem_no.network_interface)
|
||||
set_interface $modem_no "$network_interface"
|
||||
|
||||
#选择拨号工具
|
||||
case $dial_tool in
|
||||
"quectel-CM") quectel_cm ;;
|
||||
"mmcli") modemmanager ;;
|
||||
"") quectel_cm ;;
|
||||
*) quectel_cm ;;
|
||||
esac
|
||||
}
|
||||
|
||||
gobinet()
|
||||
{
|
||||
#获取网络接口、AT串口、制造商
|
||||
@ -215,11 +288,11 @@ gobinet()
|
||||
local at_port=$(uci -q get modem.modem$modem_no.at_port)
|
||||
local manufacturer=$(uci -q get modem.modem$modem_no.manufacturer)
|
||||
#设置网络接口
|
||||
set_interface $modem_no $network_interface
|
||||
set_interface $modem_no "$network_interface"
|
||||
|
||||
#拨号
|
||||
procd_open_instance
|
||||
procd_set_param command sh /usr/share/modem/modem_usb_network.sh $id $at_port $manufacturer "gobinet"
|
||||
procd_set_param command sh /usr/share/modem/modem_network_task.sh "$id" "$at_port" "$manufacturer" "gobinet"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
@ -231,11 +304,11 @@ ecm()
|
||||
local at_port=$(uci -q get modem.modem$modem_no.at_port)
|
||||
local manufacturer=$(uci -q get modem.modem$modem_no.manufacturer)
|
||||
#设置网络接口
|
||||
set_interface $modem_no $network_interface
|
||||
set_interface $modem_no "$network_interface"
|
||||
|
||||
#拨号
|
||||
procd_open_instance
|
||||
procd_set_param command sh /usr/share/modem/modem_usb_network.sh $id $at_port $manufacturer "ecm"
|
||||
procd_set_param command sh /usr/share/modem/modem_network_task.sh "$id" "$at_port" "$manufacturer" "ecm"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
@ -263,11 +336,30 @@ stop_qmi()
|
||||
local instance_number=$(echo "$response" | jq -r '.modem.instances | length')
|
||||
for i in $(seq 1 $((instance_number))); do
|
||||
#获取拨号命令
|
||||
local command=$(echo "$response" | jq -r '.modem.instances.instance$i.command')
|
||||
if [ "$command" = *"$network"* ]; then
|
||||
local pid=$(echo "$response" | jq -r '.modem.instances.$i.pid')
|
||||
local command=$(echo "$response" | jq -r ".modem.instances.instance$i.command")
|
||||
#移远拨号工具
|
||||
if [[ "$command" = *"$network"* ]]; then
|
||||
local pid=$(echo "$response" | jq -r ".modem.instances.$i.pid")
|
||||
kill $pid >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
#Modem Manager
|
||||
#获取接口名称
|
||||
local interface_name="wwan_5g_$modem_no"
|
||||
echo "$interface_name" >> /root/a
|
||||
if [[ "$command" = *"$interface_name"* ]]; then
|
||||
echo "111" >> /root/a
|
||||
local pid=$(echo "$response" | jq -r ".modem.instances.$i.pid")
|
||||
kill $pid >/dev/null 2>&1
|
||||
|
||||
#获取调制解调器设备(模组路径)
|
||||
local path=$(uci -q get modem.modem$modem_no.path)
|
||||
mmcli -m "$path" --simple-disconnect
|
||||
|
||||
# uci set network.$interface_name.auto='0'
|
||||
uci del network.$interface_name
|
||||
uci commit network
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@ -412,21 +504,21 @@ dial()
|
||||
return 0
|
||||
}
|
||||
|
||||
local remarks #备注
|
||||
local network #移动网络
|
||||
local dial_tool #拨号工具
|
||||
local pdp_type #网络类型
|
||||
local apn
|
||||
local user
|
||||
local password
|
||||
local auth
|
||||
local remarks #备注
|
||||
local network #移动网络
|
||||
local dial_tool #拨号工具
|
||||
local pdp_type #网络类型(IP类型)
|
||||
local apn #接入点
|
||||
local username #用户名
|
||||
local password #密码
|
||||
local auth #认证类型
|
||||
|
||||
config_get remarks $1 remarks
|
||||
config_get network $1 network
|
||||
config_get dial_tool $1 dial_tool
|
||||
config_get pdp_type $1 pdp_type
|
||||
config_get apn $1 apn
|
||||
config_get user $1 user
|
||||
config_get username $1 username
|
||||
config_get password $1 password
|
||||
config_get auth $1 auth
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
{"****************通用****************":"ATI"},
|
||||
{"模组信息 > ATI":"ATI"},
|
||||
{"查询SIM卡状态 > AT+CPIN?":"AT+CPIN?"},
|
||||
{"查询此时信号强度 > AT+CSQ":"AT+CSQ"},
|
||||
{"查询网络信号质量(4G) > AT+CSQ":"AT+CSQ"},
|
||||
{"查询网络信号质量(5G) > AT+CESQ":"AT+CESQ"},
|
||||
{"查询网络信息 > AT+COPS?":"AT+COPS?"},
|
||||
{"查询PDP信息 > AT+CGDCONT?":"AT+CGDCONT?"},
|
||||
{"最小功能模式 > AT+CFUN=0":"AT+CFUN=0"},
|
||||
|
@ -337,7 +337,7 @@ fibocom_sim_info()
|
||||
iccid=$(sh $current_dir/modem_at.sh $at_port $at_command | grep -o "+ICCID:[ ]*[-0-9]\+" | grep -o "[-0-9]\{1,4\}")
|
||||
}
|
||||
|
||||
#获取信号强度指示
|
||||
#获取信号强度指示(4G)
|
||||
# $1:信号强度指示数字
|
||||
fibocom_get_rssi()
|
||||
{
|
||||
@ -372,11 +372,11 @@ fibocom_network_info()
|
||||
at_command="AT+CSQ"
|
||||
response=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+CSQ:" | sed 's/+CSQ: //g' | sed 's/\r//g')
|
||||
|
||||
#RSSI(信号强度指示)
|
||||
rssi_num=$(echo $response | awk -F',' '{print $1}')
|
||||
rssi=$(fibocom_get_rssi $rssi_num)
|
||||
#BER(信道误码率)
|
||||
ber=$(echo $response | awk -F',' '{print $2}')
|
||||
#RSSI(4G信号强度指示)
|
||||
# rssi_num=$(echo $response | awk -F',' '{print $1}')
|
||||
# rssi=$(fibocom_get_rssi $rssi_num)
|
||||
#BER(4G信道误码率)
|
||||
# ber=$(echo $response | awk -F',' '{print $2}')
|
||||
|
||||
# #PER(信号强度)
|
||||
# if [ -n "$csq" ]; then
|
||||
|
@ -2,7 +2,8 @@
|
||||
"quick_commands":[
|
||||
{"模组信息 > ATI":"ATI"},
|
||||
{"查询SIM卡状态 > AT+CPIN?":"AT+CPIN?"},
|
||||
{"查询此时信号强度 > AT+CSQ":"AT+CSQ"},
|
||||
{"查询网络信号质量(4G) > AT+CSQ":"AT+CSQ"},
|
||||
{"查询网络信号质量(5G) > AT+CESQ":"AT+CESQ"},
|
||||
{"查询网络信息 > AT+COPS?":"AT+COPS?"},
|
||||
{"查询PDP信息 > AT+CGDCONT?":"AT+CGDCONT?"},
|
||||
{"最小功能模式 > AT+CFUN=0":"AT+CFUN=0"},
|
||||
|
@ -29,8 +29,6 @@ init_modem_info()
|
||||
#网络信息
|
||||
connect_status="disconnect" #SIM卡状态
|
||||
network_type="-" #蜂窝网络类型
|
||||
rssi="" #RSSI
|
||||
ber="" #BER
|
||||
tx_rate="-" #上传速率
|
||||
rx_rate="-" #下载速率
|
||||
|
||||
@ -167,9 +165,7 @@ set_network_info()
|
||||
network_info="\"network_info\":[
|
||||
{\"Network Type\":\"$network_type\", \"full_name\":\"Network Type\"},
|
||||
{\"Tx Rate\":\"$tx_rate\", \"full_name\":\"Transmit Rate\"},
|
||||
{\"Rx Rate\":\"$rx_rate\", \"full_name\":\"Receive Rate\"},
|
||||
{\"RSSI\":\"$rssi\", \"full_name\":\"Received Signal Strength Indicator\"},
|
||||
{\"BER\":\"$ber\", \"full_name\":\"Bit Error Rate\"}
|
||||
{\"Rx Rate\":\"$rx_rate\", \"full_name\":\"Receive Rate\"}
|
||||
],"
|
||||
}
|
||||
|
||||
|
19
luci-app-modem/root/usr/share/modem/modem_usb_network.sh → luci-app-modem/root/usr/share/modem/modem_network_task.sh
Executable file → Normal file
19
luci-app-modem/root/usr/share/modem/modem_usb_network.sh → luci-app-modem/root/usr/share/modem/modem_network_task.sh
Executable file → Normal file
@ -3,7 +3,7 @@ current_dir="$(dirname "$0")"
|
||||
source "$current_dir/modem_debug.sh"
|
||||
source "$current_dir/modem_scan.sh"
|
||||
|
||||
#拨号
|
||||
#ECM拨号
|
||||
# $1:AT串口
|
||||
# $2:制造商
|
||||
ecm_dial()
|
||||
@ -21,7 +21,7 @@ ecm_dial()
|
||||
sh "$current_dir/modem_at.sh" $1 $at_command
|
||||
}
|
||||
|
||||
#拨号
|
||||
#GobiNet拨号
|
||||
# $1:AT串口
|
||||
# $2:制造商
|
||||
gobinet_dial()
|
||||
@ -39,11 +39,19 @@ gobinet_dial()
|
||||
sh "$current_dir/modem_at.sh" $1 $at_command
|
||||
}
|
||||
|
||||
#Modem Manager拨号
|
||||
# $1:接口名称
|
||||
modemmanager_dial()
|
||||
{
|
||||
ifup "$1";
|
||||
}
|
||||
|
||||
#检查模组网络连接
|
||||
# $1:配置ID
|
||||
# $2:AT串口
|
||||
# $3:制造商
|
||||
# $4:拨号模式
|
||||
# $5:接口名称
|
||||
modem_network_task()
|
||||
{
|
||||
while true; do
|
||||
@ -63,9 +71,10 @@ modem_network_task()
|
||||
local connect_status=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p')
|
||||
if [ "$connect_status" = "0" ]; then
|
||||
case "$4" in
|
||||
"ecm") ecm_dial $at_port $3 ;;
|
||||
"gobinet") gobinet_dial $at_port $3 ;;
|
||||
*) ecm_dial $at_port $3 ;;
|
||||
"ecm") ecm_dial "$at_port" "$3" ;;
|
||||
"gobinet") gobinet_dial "$at_port" "$3" ;;
|
||||
"modemmanager") modemmanager_dial "$5" ;;
|
||||
*) ecm_dial "$at_port" "$3" ;;
|
||||
esac
|
||||
fi
|
||||
debug "结束网络连接检查任务"
|
@ -364,10 +364,10 @@ quectel_network_info()
|
||||
response=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+CSQ:" | sed 's/+CSQ: //g' | sed 's/\r//g')
|
||||
|
||||
#RSSI(信号强度指示)
|
||||
rssi_num=$(echo $response | awk -F',' '{print $1}')
|
||||
rssi=$(quectel_get_rssi $rssi_num)
|
||||
# rssi_num=$(echo $response | awk -F',' '{print $1}')
|
||||
# rssi=$(quectel_get_rssi $rssi_num)
|
||||
#Ber(信道误码率)
|
||||
ber=$(echo $response | awk -F',' '{print $2}')
|
||||
# ber=$(echo $response | awk -F',' '{print $2}')
|
||||
|
||||
#PER(信号强度)
|
||||
# if [ -n "$csq" ]; then
|
||||
|
@ -2,7 +2,8 @@
|
||||
"quick_commands":[
|
||||
{"模组信息 > ATI":"ATI"},
|
||||
{"查询SIM卡状态 > AT+CPIN?":"AT+CPIN?"},
|
||||
{"查询此时信号强度 > AT+CSQ":"AT+CSQ"},
|
||||
{"查询网络信号质量(4G) > AT+CSQ":"AT+CSQ"},
|
||||
{"查询网络信号质量(5G) > AT+CESQ":"AT+CESQ"},
|
||||
{"查询网络信息 > AT+COPS?":"AT+COPS?"},
|
||||
{"查询PDP信息 > AT+CGDCONT?":"AT+CGDCONT?"},
|
||||
{"最小功能模式 > AT+CFUN=0":"AT+CFUN=0"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user