From 8853a3a76f33cab4950c482b5a05c382009dfd6b Mon Sep 17 00:00:00 2001 From: stich86 Date: Fri, 5 Aug 2022 14:27:13 +0200 Subject: [PATCH] Update 19d21432 add AWKFILTER for MF289F modem's variant on HW REV AT2 to parse 3rd and 4th band --- .../share/3ginfo-lite/3ginfo-addon/19d21432 | 267 +++++++++++------- 1 file changed, 169 insertions(+), 98 deletions(-) diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21432 b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21432 index fc0e1e2b..ba01b77f 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21432 +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21432 @@ -1,108 +1,179 @@ -# ZTE MF286/MF286A +# ZTE MF286/MF286A/MF289F HW AT2 #O=$(sms_tool -d $DEVICE at "at+zrssi;+zcellinfo?;+zcainfo?;+zdon?") O=$(sms_tool -d $DEVICE at "at+zrssi;+zcellinfo?;+zcainfo?") +MODEL=$(sms_tool -d /dev/ttyUSB2 at "ati" | grep -i Model | awk '{print $2}') case "$MODE_NUM" in - 3*) - T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - RSSI="$T" - ADDON="$ADDON"'{"RSSI":"'$T' dBm"}' - ;; - 2*|\ - 4*|\ - 5*|\ - 6*) - T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - ADDON="$ADDON"'{"RSCP":"'$T' dBm"}' - T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - ADDON="$ADDON"'{"ECIO":"'$T' dB"}' - T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs) - [ -n "$T" ] && MODE="$T" - ;; - 7*) - T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - RSRP="$T" - ADDON="$ADDON"'{"RSRP":"'$T' dBm"}' - T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - RSRQ="$T" - ADDON="$ADDON"'{"RSRQ":"'$T' dB"}' - T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $4}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - RSSI="$T" - ADDON="$ADDON"'{"RSSI":"'$T' dBm"}' - T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $5}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - SINR="$T" - ADDON="$ADDON"'{"SINR":"'$T' dB"}' - T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs) - case "$T" in - *"LTE B1") MODE=$(band 1 "LTE ");; - *"LTE B3") MODE=$(band 3 "LTE ");; - *"LTE B7") MODE=$(band 7 "LTE ");; - *"LTE B8") MODE=$(band 8 "LTE ");; - *"LTE B20") MODE=$(band 20 "LTE ");; - *) MODE="${T}";; - esac - T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $9}' | xargs) - if [ -n "$T" ]; then - case $T in - *"1") MODE="${MODE/LTE/LTE_A} / "$(band 1 "");; - *"3") MODE="${MODE/LTE/LTE_A} / "$(band 3 "");; - *"7") MODE="${MODE/LTE/LTE_A} / "$(band 7 "");; - *"8") MODE="${MODE/LTE/LTE_A} / "$(band 8 "");; - *"20") MODE="${MODE/LTE/LTE_A} / "$(band 20 "");; - *) MODE="${MODE/LTE/LTE_A} / B${T}";; - esac - MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,') - fi + 3*) + T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + RSSI="$T" + ADDON="$ADDON"'{"RSSI":"'$T' dBm"}' + ;; + 2*|\ + 4*|\ + 5*|\ + 6*) + T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + ADDON="$ADDON"'{"RSCP":"'$T' dBm"}' + T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + ADDON="$ADDON"'{"ECIO":"'$T' dB"}' + T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs) + [ -n "$T" ] && MODE="$T" + ;; + 7*) - T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $3}' | xargs) - if [ -n "$T" ]; then - T1=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $6}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - PBAND="$(band $T "") @$T1 MHz" - ADDON="$ADDON"'{"Primary band":"'$(band $T "")', '$T1' MHz"}' - fi - T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $2}' | xargs) - if [ -n "$T" ]; then - [ -n "$ADDON" ] && ADDON="$ADDON," - PCI="$T" - ADDON="$ADDON"'{"PCI":"'$T'"}' - fi - T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $5}' | xargs) - if [ -n "$T" ]; then - [ -n "$ADDON" ] && ADDON="$ADDON," - EARFCN="$T" - ADDON="$ADDON"'{"EARFCN":"'$T'"}' - fi + if [ $MODEL = MF289F ]; then + AWK_FILTER="[,:\;]" + else + AWK_FILTER="[,:]" + fi - T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $9}' | xargs) - if [ -n "$T" ]; then - T1=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $11}' | xargs) - [ -n "$ADDON" ] && ADDON="$ADDON," - S1BAND="$(band $T "") @$T1 MHz" - ADDON="$ADDON"'{"(S) band":"'$(band $T "")', '$T1' MHz"}' - fi - T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $7}' | xargs) - if [ -n "$T" ]; then - [ -n "$ADDON" ] && ADDON="$ADDON," - S1PCI="$T" - ADDON="$ADDON"'{"(S) PCI":"'$T'"}' - fi - T=$(echo "$O" | awk -F[,:] '/^\+ZCAINFO/ {print $10}' | xargs) - if [ -n "$T" ]; then - [ -n "$ADDON" ] && ADDON="$ADDON," - S1EARFCN="$T" - ADDON="$ADDON"'{"(S) EARFCN":"'$T'"}' - fi + T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $2}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + RSRP="$T" + ADDON="$ADDON"'{"RSRP":"'$T' dBm"}' + T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $3}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + RSRQ="$T" + ADDON="$ADDON"'{"RSRQ":"'$T' dB"}' + T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $4}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + RSSI="$T" + ADDON="$ADDON"'{"RSSI":"'$T' dBm"}' + T=$(echo "$O" | awk -F[,:] '/^\+ZRSSI/ {print $5}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + SINR="$T" + ADDON="$ADDON"'{"SINR":"'$T' dB"}' + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCELLINFO/ {print $4}' | xargs) + case "$T" in + *"LTE B1") MODE=$(band 1 "LTE ");; + *"LTE B3") MODE=$(band 3 "LTE ");; + *"LTE B7") MODE=$(band 7 "LTE ");; + *"LTE B8") MODE=$(band 8 "LTE ");; + *"LTE B20") MODE=$(band 20 "LTE ");; + *) MODE="${T}";; + esac + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $9}' | xargs) - ;; + if [ -n "$T" ]; then + case $T in + *"1") MODE="${MODE/LTE/LTE_A} / "$(band 1 "");; + *"3") MODE="${MODE/LTE/LTE_A} / "$(band 3 "");; + *"7") MODE="${MODE/LTE/LTE_A} / "$(band 7 "");; + *"8") MODE="${MODE/LTE/LTE_A} / "$(band 8 "");; + *"20") MODE="${MODE/LTE/LTE_A} / "$(band 20 "");; + *) MODE="${MODE/LTE/LTE_A} / B${T}";; + esac + T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $14}' | xargs) + if [ -n "$T" ]; then + case $T in + *"1") MODE="$MODE / "$(band 1 "");; + *"3") MODE="$MODE / "$(band 3 "");; + *"7") MODE="$MODE / "$(band 7 "");; + *"8") MODE="$MODE / "$(band 8 "");; + *"20") MODE="$MODE / "$(band 20 "");; + *) MODE="$MODE / B${T}";; + esac + MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,') + fi + T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $19}' | xargs) + if [ -n "$T" ]; then + case $T in + *"1") MODE="$MODE / "$(band 1 "");; + *"3") MODE="$MODE / "$(band 3 "");; + *"7") MODE="$MODE / "$(band 7 "");; + *"8") MODE="$MODE / "$(band 8 "");; + *"20") MODE="$MODE / "$(band 20 "");; + *) MODE="$MODE / B${T}";; + esac + MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,') + fi + + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $3}' | xargs) + if [ -n "$T" ]; then + T1=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $6}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + PBAND="$(band $T "") @$T1 MHz" + ADDON="$ADDON"'{"Primary band":"'$(band $T "")', '$T1' MHz"}' + fi + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $2}' | xargs) + if [ -n "$T" ]; then + [ -n "$ADDON" ] && ADDON="$ADDON," + PCI="$T" + ADDON="$ADDON"'{"PCI":"'$T'"}' + fi + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $5}' | xargs) + if [ -n "$T" ]; then + [ -n "$ADDON" ] && ADDON="$ADDON," + EARFCN="$T" + ADDON="$ADDON"'{"EARFCN":"'$T'"}' + fi + + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $9}' | xargs) + if [ -n "$T" ]; then + T1=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $11}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + S1BAND="$(band $T "") @$T1 MHz" + ADDON="$ADDON"'{"(S) band":"'$(band $T "")', '$T1' MHz"}' + fi + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $7}' | xargs) + if [ -n "$T" ]; then + [ -n "$ADDON" ] && ADDON="$ADDON," + S1PCI="$T" + ADDON="$ADDON"'{"(S) PCI":"'$T'"}' + fi + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $10}' | xargs) + if [ -n "$T" ]; then + [ -n "$ADDON" ] && ADDON="$ADDON," + S1EARFCN="$T" + ADDON="$ADDON"'{"(S) EARFCN":"'$T'"}' + fi + + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $14}' | xargs) + if [ -n "$T" ]; then + T1=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $16}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + S2BAND="$(band $T "") @$T1 MHz" + ADDON="$ADDON"'{"(T) band":"'$(band $T "")', '$T1' MHz"}' + fi + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $12}' | xargs) + if [ -n "$T" ]; then + [ -n "$ADDON" ] && ADDON="$ADDON," + S2PCI="$T" + ADDON="$ADDON"'{"(T) PCI":"'$T'"}' + fi + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $15}' | xargs) + if [ -n "$T" ]; then + [ -n "$ADDON" ] && ADDON="$ADDON," + S2EARFCN="$T" + ADDON="$ADDON"'{"(T) EARFCN":"'$T'"}' + fi + + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $19}' | xargs) + if [ -n "$T" ]; then + T1=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $16}' | xargs) + [ -n "$ADDON" ] && ADDON="$ADDON," + S3BAND="$(band $T "") @$T1 MHz" + ADDON="$ADDON"'{"(F) band":"'$(band $T "")', '$T1' MHz"}' + fi + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $17}' | xargs) + if [ -n "$T" ]; then + [ -n "$ADDON" ] && ADDON="$ADDON," + S3PCI="$T" + ADDON="$ADDON"'{"(F) PCI":"'$T'"}' + fi + T=$(echo "$O" | awk -F$AWK_FILTER '/^\+ZCAINFO/ {print $20}' | xargs) + if [ -n "$T" ]; then + [ -n "$ADDON" ] && ADDON="$ADDON," + S3EARFCN="$T" + ADDON="$ADDON"'{"(F) EARFCN":"'$T'"}' + fi + fi + ;; esac OF=$(sms_tool -d $DEVICE at "ati") @@ -135,5 +206,5 @@ fi #T=$(echo "$O" | awk -F[,:] '/^\+ZDON/ {print $2}' | xargs) #if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then -# COPS="$T" +# COPS="$T" #fi