From e44cc4c31715a4b684779b4a36b46268f69e51db Mon Sep 17 00:00:00 2001 From: fujr Date: Mon, 13 May 2024 10:30:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E7=89=88=E6=9C=AC=E9=94=81?= =?UTF-8?q?=E9=A2=91=EF=BC=8C=E5=8F=AF=E4=BB=A5=E5=B0=863=E3=80=814?= =?UTF-8?q?=E3=80=815G=E9=A2=91=E6=AE=B5=E5=88=86=E5=BC=80=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../luasrc/view/modem/modem_debug.htm | 261 ++++++------ .../root/usr/share/modem/fibocom.sh | 59 ++- .../root/usr/share/modem/quectel.sh | 384 ++++++++++++------ 3 files changed, 458 insertions(+), 246 deletions(-) diff --git a/luci-app-modem/luasrc/view/modem/modem_debug.htm b/luci-app-modem/luasrc/view/modem/modem_debug.htm index 706b032..17eb548 100644 --- a/luci-app-modem/luasrc/view/modem/modem_debug.htm +++ b/luci-app-modem/luasrc/view/modem/modem_debug.htm @@ -2,6 +2,7 @@
@@ -1495,25 +1537,16 @@ style="display: none;"> - - +
+ - - - - -
<%:Config%>
-
- -
diff --git a/luci-app-modem/root/usr/share/modem/fibocom.sh b/luci-app-modem/root/usr/share/modem/fibocom.sh index 1a9ce5c..3b78058 100755 --- a/luci-app-modem/root/usr/share/modem/fibocom.sh +++ b/luci-app-modem/root/usr/share/modem/fibocom.sh @@ -596,7 +596,25 @@ fibocom_get_lockband() get_lockband_config_res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_lockband_config_command) get_available_band_res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $get_available_band_command) json_init + + json_add_object "UMTS" json_add_object "available_band" + json_close_object + json_add_array "lock_band" + json_close_object + json_close_object + json_add_object "LTE" + json_add_object "available_band" + json_close_object + json_add_array "lock_band" + json_close_object + json_close_object + json_add_object "NR" + json_add_object "available_band" + json_close_object + json_add_array "lock_band" + json_close_object + json_close_object index=0 for i in $(echo "$get_available_band_res"| sed 's/\r//g' | awk -F"[()]" '{for(j=8; j&1 > /dev/null } -quectel_set_lockband_qualcomm(){ +quectel_set_lockband_nr(){ local at_port="$1" local lock_band="$2" - gw_band="" - lte_band="" - nsa_nr_band="" - sa_nr_band="" - for i in $(echo $2 | awk -F"," '{for(j=1; j<=NF; j++) print $j}' );do - num_match=$(echo $i | grep -o "[0-9]\+") - case "$i" in - UMTS_*) - if [ -z "$gw_band" ]; then - gw_band=$num_match - else - gw_band=$gw_band:$num_match - fi - ;; - LTE_B*) - if [ -z "$lte_band" ]; then - lte_band=$num_match - else - lte_band=$lte_band:$num_match - fi - ;; - NSA_NR_N*) - if [ -z "$nsa_nr_band" ]; then - nsa_nr_band=$num_match - else - nsa_nr_band=$nsa_nr_band:$num_match - fi - ;; - SA_NR_N*) - if [ -z "$sa_nr_band" ]; then - sa_nr_band=$num_match - else - sa_nr_band=$sa_nr_band:$num_match - fi - ;; - esac - done - if [ -n "$gw_band" ]; then - at_command="AT+QNWPREFCFG=\"gw_band\",$gw_band" - res1=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command) - fi - if [ -n "$lte_band" ]; then - at_command="AT+QNWPREFCFG=\"lte_band\",$lte_band" - res2=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command) - fi - if [ -n "$nsa_nr_band" ]; then - at_command="AT+QNWPREFCFG=\"nsa_nr5g_band\",$nsa_nr_band" - res3=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command) - fi - if [ -n "$sa_nr_band" ]; then - at_command="AT+QNWPREFCFG=\"nr5g_band\",$sa_nr_band" - res4=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command) - fi + local rat="$3" + lock_band=$(echo $lock_band | tr ',' ':') + case "$rat" in + "UMTS") + at_command="AT+QNWPREFCFG=\"gw_band\",$lock_band" + res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command) + ;; + "LTE") + at_command="AT+QNWPREFCFG=\"lte_band\",$lock_band" + res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command) + ;; + "NR_NSA") + at_command="AT+QNWPREFCFG=\"nsa_nr5g_band\",$lock_band" + res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command) + ;; + "NR") + at_command="AT+QNWPREFCFG=\"nr5g_band\",$lock_band" + res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command) + ;; + esac json_init - json_add_string result1 "$res1" - json_add_string result2 "$res2" - json_add_string result3 "$res3" - json_add_string result4 "$res4" + json_add_string result "$res" json_result=`json_dump` echo "$json_result" } @@ -836,24 +973,13 @@ quectel_set_lockband() { debug "quectel set lockband info" local at_port="$1" - local platform - local modem_number=$(uci -q get modem.@global[0].modem_number) - for i in $(seq 0 $((modem_number-1))); do - local at_port_tmp=$(uci -q get modem.modem$i.at_port) - if [ "$at_port" = "$at_port_tmp" ]; then - platform=$(uci -q get modem.modem$i.platform) - break - fi - done - case "$platform" in - "qualcomm") - quectel_set_lockband_qualcomm $at_port $2 + local rat="$3" + case "$rat" in + "Lte") + quectel_set_lockband_lte $at_port $2 ;; - "unisoc") - quectel_set_lockband_unisoc $at_port $2 - ;; - "generic") - quectel_set_lockband_generic $at_port $2 + *) + quectel_set_lockband_nr $at_port $2 $3 ;; esac @@ -983,8 +1109,8 @@ quectel_get_neighborcell_lte(){ lte_lock_status=$(echo $lte_status | awk -F',' '{print $2}') lte_lock_freq=$(echo $lte_status | awk -F',' '{print $3}') lte_lock_pci=$(echo $lte_status | awk -F',' '{print $4}') - lte_lock_finish=$(echo $lte_status | awk -F',' '{print $5}') - if [ "$lte_lock_finish" == "1" ]; then + lte_lock_finish=$(echo $lte_status | awk -F',' '{print $5}' | sed 's/\r//g') + if [ "$lte_lock_finish" == "0" ]; then lte_lock_finish="finish" else lte_lock_finish="not finish" @@ -1077,7 +1203,7 @@ quectel_get_neighborcell(){ "unisoc") quectel_get_neighborcell_unisoc $at_port ;; - *) + "lte") quectel_get_neighborcell_lte $at_port ;; esac @@ -1175,7 +1301,7 @@ quectel_lockarfn_lte(){ local pci="$4" local scs="$5" local nrband="$6" - locklte="AT+QNWLOCK=\"common/lte\",1,$arfcn" + locklte="AT+QNWLOCK=\"common/lte\",1,$arfcn,0" res=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $locklte) }