优化拨号连接

This commit is contained in:
ling 2024-04-21 23:57:55 +08:00
parent e6d49de1ff
commit 4337313ef1
4 changed files with 28 additions and 9 deletions

View File

@ -375,6 +375,7 @@ function getDialLogInfo()
local logs={}
local names={}
local translation={}
for key in pairs(log_paths) do
local log_path=log_paths[key]
@ -394,14 +395,17 @@ function getDialLogInfo()
modem_log[modem]=log
table.insert(logs, modem_log)
--设置模组名
names[modem]=modem_name
-- 设置翻译
translation[modem_name]=luci.i18n.translate(modem_name)
end
end
-- 设置值
local data={}
data["dial_log_info"]=logs
data["modem_name"]=names
data["modem_name_info"]=names
data["translation"]=translation
-- 写入Web界面

View File

@ -137,7 +137,8 @@
function(x, data)
{
var dial_log_info=data["dial_log_info"];
var modem_name=data["modem_name"];
var modem_name_info=data["modem_name_info"];
var translation=data["translation"];
var tab_menu=document.getElementById("tab_menu");
var dial_log_div=document.getElementById('dial_log_view');
@ -195,7 +196,8 @@
}
// 设置拨号日志标签
tab_view+='<li class="'+class_name+'" data-tab="'+key+'_tab"><a>'+modem_name[key].toUpperCase()+' ('+key.replace("modem","")+')</a></li>';
var modem_name=translation[modem_name_info[key]].toUpperCase();
tab_view+='<li class="'+class_name+'" data-tab="'+key+'_tab"><a>'+modem_name+' ('+key.replace("modem","")+')</a></li>';
// 设置拨号日志
dial_log_view += '<div class="cbi-section" data-tab="'+key+'_tab" data-tab-title="'+key+'" data-tab-active="'+active+'" style="display: '+display+';">';
dial_log_view += '<div><textarea readonly="readonly" id="'+key+'_log" rows="20" maxlength="160" style="'+log_style+'">'+dial_log[key]+'</textarea></div>';

View File

@ -39,7 +39,7 @@ fibocom_get_dns()
#获取DNS地址
at_command="AT+GTDNS=${define_connect}"
local response=$(at ${at_port} ${at_command} | grep "+GTDNS: ")
local response=$(at ${at_port} ${at_command} | grep "+GTDNS: " | grep -E '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | sed -n '1p')
local ipv4_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $1}')
[ -z "$ipv4_dns1" ] && {

View File

@ -59,7 +59,7 @@ reset_network_interface()
service network reload
#输出日志
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Reset network interface ${interface_name} successful" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Reset network interface successful" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
fi
}
@ -153,6 +153,8 @@ rndis_dial()
dial_log "${at_command}" "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
#激活并拨号
at "${at_port}" "${at_command}"
sleep 3s
else
#拨号
ecm_dial "${at_port}" "${manufacturer}"
@ -234,7 +236,18 @@ modem_network_task()
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Unable to get IPv4 address" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Redefine connect to ${define_connect}" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
service modem reload
# sleep 1s
#输出日志
echo "[$(date +"%Y-%m-%d %H:%M:%S")] Modem dial" >> "${MODEM_RUNDIR}/modem${modem_no}_dial.cache"
#拨号针对获取IPv4返回为空的模组
case "$mode" in
"gobinet") gobinet_dial "${at_port}" "${manufacturer}" "${define_connect}" ;;
"ecm") ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" ;;
"rndis") rndis_dial "${at_port}" "${manufacturer}" "${platform}" "${define_connect}" "${modem_no}" ;;
"modemmanager") modemmanager_dial "${interface_name}" "${define_connect}" ;;
*) ecm_dial "${at_port}" "${manufacturer}" "${define_connect}" ;;
esac
elif [[ "$ipv4" = *"0.0.0.0"* ]]; then
#输出日志