Detect all activated PDPs instead of just the fixed one to ensure compatibility with older RM5xxQ firmware.

This commit is contained in:
fujr 2024-11-06 15:56:01 +08:00
parent 6e8abbf34c
commit 5275942584

View File

@ -238,8 +238,13 @@ get_rat()
#return raw data
get_connect_status()
{
at_cmd="AT+CGPADDR=1"
[ "$define_connect" == "3" ] && at_cmd="AT+CGPADDR=3"
#get active pdp context
at_cmd="AT+CGACT?"
expect="+CGACT:"
result=`at $at_port $at_cmd | grep $expect|tr '\r' '\n'`
for pdp_index in `echo "$result" | tr -d "\r" | awk -F'[,:]' '$3 == 1 {print $2}'`; do
at_cmd="AT+CGPADDR=%s"
at_cmd=$(printf "$at_cmd" "$pdp_index")
expect="+CGPADDR:"
result=$(at $at_port $at_cmd | grep $expect)
if [ -n "$result" ];then
@ -253,10 +258,16 @@ get_connect_status()
fi
if [ -n "$ipv4" ] || [ -n "$ipv6" ];then
connect_status="Yes"
return_flag=1
else
connect_status="No"
fi
add_plain_info_entry "connect_status" "$connect_status" "Connect Status"
if [ "$return_flag" -eq 1 ];then
return
fi
done
}
#获取移远模组信息