Skip to content

Commit

Permalink
Merge pull request #12 from stich86/main
Browse files Browse the repository at this point in the history
Add AWKFILTER for MF289F HW REV AT2
  • Loading branch information
4IceG authored Aug 6, 2022
2 parents 6212a9c + 8853a3a commit 64a1ab1
Showing 1 changed file with 169 additions and 98 deletions.
267 changes: 169 additions & 98 deletions luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21432
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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

0 comments on commit 64a1ab1

Please sign in to comment.