diff --git a/luci/luci-app-qmodem/luasrc/view/qmodem/modem_debug.htm b/luci/luci-app-qmodem/luasrc/view/qmodem/modem_debug.htm index 0e33ef6..0634f97 100644 --- a/luci/luci-app-qmodem/luasrc/view/qmodem/modem_debug.htm +++ b/luci/luci-app-qmodem/luasrc/view/qmodem/modem_debug.htm @@ -748,20 +748,25 @@ this.get_action = "get_neighborcell"; this.set_action = "set_neighborcell"; this.task = null; - this.init_nc_table(); + this.init_nc_table(); } - pause(){ - if (this.task != null) { - clearInterval(this.task); - } + scan_neighborcell(){ + this.get_config(); } - update(){ - this.task = setInterval(() => { - this.get_config(); - },10000); - } + // pause(){ + // if (this.task != null) { + // clearInterval(this.task); + // } + // } + + // update(){ + + // this.task = setInterval(() => { + // this.get_config(); + // },10000); + // } nr_options(){ if (this.rat_input.selectedIndex == 0) { @@ -865,12 +870,19 @@ this.set_config(JSON.stringify(config)); }); + //add scan button + var scan_btn = this.createBTN("<%:Scan%>",() => { + this.scan_neighborcell(); + }); + + this.setting_table.appendChild(header); this.setting_table.appendChild(rat_tr); this.setting_table.appendChild(pci_tr); this.setting_table.appendChild(arfcn_tr); this.setting_table.appendChild(band_tr); this.setting_table.appendChild(scs_tr); + this.setting_table.appendChild(scan_btn); this.setting_table.appendChild(submit_btn); } @@ -925,17 +937,18 @@ } } let tr_left = this.createTD(text); - let tr_right = this.create_copy_btn_td(rat,cell_info.pci,cell_info.arfcn); + let tr_right = this.create_copy_btn_td(rat,cell_info); let tr = this.createTR(); tr.appendChild(tr_left); tr.appendChild(tr_right); this.neighborcell_table.appendChild(tr); } - create_copy_btn_td(rat,pci,arfcn){ + create_copy_btn_td(rat,cell_info){ var copy_btn = this.createBTN("<%:Copy%>",() => { - this.pci_input.value = pci; - this.arfcn_input.value = arfcn; + this.pci_input.value = cell_info.pci; + this.arfcn_input.value = cell_info.arfcn; + this.band_input.value = cell_info.band; this.rat_input.selectedIndex = rat; this.nr_options() }); diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/at_commands.json b/luci/luci-app-qmodem/root/usr/share/qmodem/at_commands.json index 9d515e1..f867702 100644 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/at_commands.json +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/at_commands.json @@ -597,6 +597,12 @@ { "关闭sim热插拔 > AT+UIMHOTSWAPON=0": "AT+UIMHOTSWAPON=0" }, + { + "解除LTE小区锁定 > AT+CCELLCFG=0": "AT+CCELLCFG=0" + }, + { + "解除5G小区锁定 > AT+C5GCELLCFG=\"unlock\"": "AT+C5GCELLCFG=\"unlock\"" + }, { "更改imei > AT+SIMEI=imei": "AT+SIMEI=imei" }, diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh index ee1ae49..dfdab2a 100644 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh @@ -548,8 +548,8 @@ get_neighborcell_qualcomm(){ local at_command='AT+CPSI?' nr_lock_check="AT+C5GCELLCFG?" lte_lock_check="AT+CCELLCFG?" - lte_status=$(at $at_port $lte_lock_check | grep "+CCELLCFG:") - if [ "$lte_status" != "+CCELLCFG: 0,0" ]; then + lte_status=$(at $at_port $lte_lock_check | grep "+CCELLCFG:") + if [ ! -z "$lte_status" ]; then lte_lock_status="locked" else lte_lock_status="" @@ -557,19 +557,28 @@ get_neighborcell_qualcomm(){ lte_lock_freq=$(echo $lte_status | awk -F',' '{print $2}' | sed 's/\r//g') lte_lock_pci=$(echo $lte_status | awk -F',' '{print $1}' | sed 's/+CCELLCFG: //g' | sed 's/\r//g') nr_status=$(at $at_port $nr_lock_check | grep "+C5GCELLCFG:") - nr_lock_status=$(echo $nr_status | awk -F': ' '{print $2}' | sed 's/\r//g') - nr_lock_pci=$(echo $nr_status | awk -F',' '{print $2}' | sed 's/\r//g') - nr_lock_freq=$(echo $nr_status | awk -F',' '{print $3}' | sed 's/\r//g') - nr_lock_scs=$(echo $nr_status | awk -F',' '{print $4}' | sed 's/\r//g') - nr_lock_band=$(echo $nr_status | awk -F',' '{print $5}' | sed 's/\r//g') + nr_lock_status=$(echo "$nr_status" | awk -F': ' '{print $2}' | xargs) + nr_lock_pci=$(echo "$nr_status" | awk -F',' '{print $2}' | xargs) + nr_lock_freq=$(echo "$nr_status" | awk -F',' '{print $3}' | xargs) + nr_lock_scs=$(echo "$nr_status" | awk -F',' '{print $4}' | xargs) + nr_lock_band=$(echo "$nr_status" | awk -F',' '{print $5}' | xargs) if [ "$nr_lock_status" != "0" ]; then nr_lock_status="locked" else nr_lock_status="" fi - - at $at_port $at_command > /tmp/neighborcell + modem_status=$(at $at_port $at_command) + modem_status_net=$(echo "$modem_status"|grep "+CPSI:"|awk -F',' '{print $1}'|awk -F':' '{print $2}'|xargs) + modem_status_band=$(echo "$modem_status"|grep "+CPSI:"|awk -F',' '{print $7}'|awk -F'_' '{print $2}'|sed 's/BAND//g'|xargs) + if [ $modem_status_net == "NR5G_SA" ];then + scans=$(at $at_port "AT+CNWSEARCH=\"nr5g\"") + sleep 10 + at $at_port "AT+CNWSEARCH=\"nr5g\",3" > /tmp/neighborcell + elif [ $modem_status_net == "LTE" ];then + at $at_port "AT+CNWSEARCH=\"lte\",1" > /tmp/neighborcell + sleep 5 + fi json_add_object "Feature" json_add_string "Unlock" "2" json_add_string "Lock PCI" "1" @@ -599,9 +608,9 @@ get_neighborcell_qualcomm(){ fi json_close_object while read line; do - if [ -n "$(echo $line | grep "+CPSI:")" ]; then + if [ -n "$(echo $line | grep "+NR_NGH_CELL:")" ] || [ -n "$(echo $line | grep "+LTE_CELL:")" ]; then # CPSI: NR5G_SA,Online,460-01,0x6F4700,29869309958,95,NR5G_BAND78,627264,-800,-110,14 - line=$(echo $line | sed 's/+CPSI: //g') + case $line in *WCDMA*) type="WCDMA" @@ -611,37 +620,34 @@ get_neighborcell_qualcomm(){ rscp=$(echo $line | awk -F',' '{print $11}') ecno=$(echo $line | awk -F',' '{print $10}') ;; - *LTE*) + *LTE_CELL*) type="LTE" - arfcn=$(echo $line | awk -F',' '{print $8}') - pci=$(echo $line | awk -F',' '{print $6}') - rsrp=$(echo $line | awk -F',' '{print $12}') - rsrq=$(echo $line | awk -F',' '{print $11}') + arfcn=$(echo $line | awk -F',' '{print $6}') + pci=$(echo $line | awk -F',' '{print $7}') + rsrp=$(echo $line | awk -F',' '{print $8}') + rsrq=$(echo $line | awk -F',' '{print $9}') + band=$(echo $line | awk -F',' '{print $5}') + mnc=$(echo $line | awk -F',' '{print $2}') ;; - *NR5G_SA*) - type="NR5G_SA" - arfcn=$(echo $line | awk -F',' '{print $8}') - pci=$(echo $line | awk -F',' '{print $6}') - rsrp=$(echo $line | awk -F',' '{print $9}') - rsrq=$(echo $line | awk -F',' '{print $10}') - ;; - *NR5G_NSA*) - type="NR5G_NSA" - arfcn=$(echo $line | awk -F',' '{print $4}') + *NR_NGH_CELL*) + type="NR" + arfcn=$(echo $line | awk -F',' '{print $1}'| awk -F':' '{print $2}'| xargs) pci=$(echo $line | awk -F',' '{print $2}') - rsrp=$(echo $line | awk -F',' '{print $5}') - rsrq=$(echo $line | awk -F',' '{print $6}') + rsrp=$(echo $line | awk -F',' '{print $3}') + rsrq=$(echo $line | awk -F',' '{print $4}') + band=$modem_status_band ;; esac json_select $type json_add_object "" - json_add_string "neighbourcell" "neighbourcell" + json_add_string "mnc" "$mnc" json_add_string "arfcn" "$arfcn" json_add_string "pci" "$pci" json_add_string "rscp" "$rscp" json_add_string "ecno" "$ecno" json_add_string "rsrp" "$rsrp" json_add_string "rsrq" "$rsrq" + json_add_string "band" "$band" json_close_object json_select ".." fi @@ -695,8 +701,8 @@ lockcell_qualcomm(){ res2=$(at $at_port $unlock4g) res=$res1,$res2 else - lock4g="AT+CCELLCFG=1,$arfcn,$pci;+CNMP=38" - locknr="AT+C5GCELLCFG="pci",$pci,$arfcn,$(get_scs $scs),$band;+CNMP=71" + lock4g="AT+CCELLCFG=1,$pci,$arfcn;+CNMP=38" + locknr="AT+C5GCELLCFG=\"pci\",$pci,$arfcn,$scs,$band;+CNMP=71" if [ $rat = "1" ]; then res=$(at $at_port $locknr) else