From dcb42fcac0e402eaf692f258ad0aa81aa821cebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Wabik?= <4rafal@gmail.com> Date: Thu, 6 Apr 2023 09:00:11 +0200 Subject: [PATCH] Update to 1.0.43-20230406 Update scripts for Mikrotik R11e-LTE6. --- luci-app-3ginfo-lite/Makefile | 2 +- .../root/usr/share/3ginfo-lite/modem/19d21489 | 19 ++-- .../root/usr/share/3ginfo-lite/modem/2c7c0306 | 68 +++++++++++++- .../root/usr/share/3ginfo-lite/modem/2cd20004 | 94 ++++++++++++------- 4 files changed, 137 insertions(+), 46 deletions(-) diff --git a/luci-app-3ginfo-lite/Makefile b/luci-app-3ginfo-lite/Makefile index dfa411f7..4c875273 100644 --- a/luci-app-3ginfo-lite/Makefile +++ b/luci-app-3ginfo-lite/Makefile @@ -11,7 +11,7 @@ LUCI_TITLE:=LuCI JS Support for 3ginfo-lite LUCI_DESCRIPTION:=LuCI JS interface for the 3ginfo-lite. The package allows you to view the parameters of the mobile internet connection. LUCI_PKGARCH:=all LUCI_DEPENDS:=+sms-tool +comgt -PKG_VERSION:=1.0.42-20230404 +PKG_VERSION:=1.0.43-20230406 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/19d21489 b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/19d21489 index 75be2708..7ceda42d 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/19d21489 +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/19d21489 @@ -37,19 +37,20 @@ case "$MODE_NUM" in T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs) MODE="LTE $(band ${T/LTE B/})" - + T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $3}' | xargs) if [ -n "$T" ] && [ "x$T" != "x0" ]; then T1=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $6}' | xargs) PBAND="$(band $T "") @$T1 MHz" - fi - T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $2}' | xargs) - if [ -n "$T" ] && [ "x$T" != "x0" ]; then - PCI="$T" - fi - T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $5}' | xargs) - if [ -n "$T" ] && [ "x$T" != "x0" ]; then - EARFCN="$T" + + T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $2}' | xargs) + if [ -n "$T" ] && [ "x$T" != "x0" ]; then + PCI="$T" + fi + T=$(echo "$O" | awk -F[,:\;] '/^\+ZCAINFO/ {print $5}' | xargs) + if [ -n "$T" ] && [ "x$T" != "x0" ]; then + EARFCN="$T" + fi fi if [ "x$MODE_NUM" = "x9" ]; then diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0306 b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0306 index b491a5e8..26048532 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0306 +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2c7c0306 @@ -1,10 +1,74 @@ # Quectel EP06 +# Quectel EG06 -. "$RES/modem/05c69215" +O=$(sms_tool -d $DEVICE at "at+qtemp") -O=$(sms_tool -d $DEVICE at "AT+QCAINFO") +T=$(echo "$O" | awk -F[,:] '/^\+QTEMP/ {t=$2*1;if($3*1>t)t=$3*1;if($4*1>t)t=$4*1;printf "%d", t}') +[ -n "$T" ] && TEMP="$T °C" + +O=$(sms_tool -d $DEVICE at "at+qnwinfo;+qeng=\"servingcell\";+qspn") + +T=$(echo "$O" | awk -F[,:] '/^\+QNWINFO/ {print $2"/"$4}' | xargs) +if [ -n "$T" ]; then + if [ "x$MODE_NUM" = "x7" ]; then + B=$(echo $T | sed 's/.*LTE BAND \(.*\)/\1/') + MODE="LTE $(band ${B})" + MAINCUT="$(band ${B})" + fi +fi + +T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $4}' | xargs) +if [ "x$T" = "xLTE" ] || [ "x$T" = "x4G" ]; then + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $14}') + T_DEC=$(printf "%d" "0x$T") + T_HEX=$T + + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $12}') + case $T in + 0) T1="1.4";; + 1) T1="3";; + 2) T1="5";; + 3) T1="10";; + 4) T1="15";; + 5) T1="20";; + *) T1="?";; + esac + ULBW="UL: @$T1 MHz" + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $13}') + case $T in + 0) T1="1.4";; + 1) T1="3";; + 2) T1="5";; + 3) T1="10";; + 4) T1="15";; + 5) T1="20";; + *) T1="?";; + esac + DLBW="DL: @$T1 MHz" + PBAND="$MAINCUT $DLBW $ULBW" + + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $9}') + PCI=$T + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $10}') + EARFCN=$T + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $17}') + RSSI=$T + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $15}') + RSRP=$T + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $16}') + RSRQ=$T + T=$(echo "$O" | awk -F[,:] '/^\+QENG:/ {print $18}' | awk '{printf "%.1f\n", $1*0.2-20}') + SINR=$T +fi + +T=$(echo "$O" | awk -F[,:] '/^\+QSPN/ {print $2}' | xargs) +if [ -n "$T" ] && [ -z "$FORCE_PLMN" ]; then + COPS="$T" +fi if [ "x$MODE_NUM" = "x7" ]; then + O=$(sms_tool -d $DEVICE at "AT+QCAINFO") + T=$(echo "$O" | awk -F[,] '/^\+QCAINFO: "scc"/{print $4}' | xargs) if [ -n "$T" ]; then B=$(echo $T | sed 's/.*LTE BAND \(.*\)/\1/') diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2cd20004 b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2cd20004 index 3eee0a33..6cde8b67 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2cd20004 +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/modem/2cd20004 @@ -1,35 +1,31 @@ # Mikrotik R11e-LTE6 O=$(sms_tool -d $DEVICE at "at+cesq;+zcainfo?;+zpas?;+zcellinfo?") +T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $2}' | xargs) +if [ -n "$T" ]; then + [ "$T" != "99" ] && RSSI="$((T - 111))" +fi T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $4}' | xargs) if [ -n "$T" ]; then - if [ "$T" != "255" ]; then - RSCP="-$T" - [ -n "$ADDON" ] && ADDON="$ADDON," - ADDON="$ADDON"'{"RSCP":"-'$T' dBm"}' - fi + [ "$T" != "255" ] && RSCP="$((T - 121))" fi T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $5}' | xargs) if [ -n "$T" ]; then if [ "$T" != "255" ]; then - [ -n "$ADDON" ] && ADDON="$ADDON," - ADDON="$ADDON"'{"ECNO":"-'$T' dB"}' + T=$(echo "$T" | awk '{printf "%.1f", -1 * (24.5 - $1 * 0.5)}') + ECIO="$T dB" fi fi -T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $6}' | xargs) +T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $7}' | xargs) if [ -n "$T" ]; then - if [ "$T" != "255" ]; then - RSRQ="-$T" - [ -n "$ADDON" ] && ADDON="$ADDON," - ADDON="$ADDON"'{"RSRQ":"-'$T' dB"}' - fi + [ "$T" != "255" ] && RSRP="$((T - 141))" fi -T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $7}' | xargs) +T=$(echo "$O" | awk -F[,:] '/^\+CESQ/ {print $6}' | xargs) if [ -n "$T" ]; then if [ "$T" != "255" ]; then - RSRP="-$T" - [ -n "$ADDON" ] && ADDON="$ADDON," - ADDON="$ADDON"'{"RSRP":"-'$T' dBm"}' + T=$(echo "$T" | awk '{printf "%.1f", -1 * (20 - $1 * 0.5)}') + RSRQ="-$T" + SINR="" fi fi @@ -37,15 +33,10 @@ T=$(echo "$O" | awk -F[,:] '/^\+ZPAS/ {print $2}' | xargs) if [ -n "$T" ]; then MODE=$T T=$(echo "$O" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs) - if [ -n "$T" ]; then - case $T in - *"LTE B1") MODE=$(band 1 "$MODE ");; - *"LTE B3") MODE=$(band 3 "$MODE ");; - *"LTE B7") MODE=$(band 7 "$MODE ");; - *"LTE B8") MODE=$(band 8 "$MODE ");; - *"LTE B20") MODE=$(band 20 "$MODE ");; - *) MODE="$MODE / $T";; - esac + if [ "x$MODE_NUM" = "x7" ]; then + MODE="$MODE $(band ${T/LTE B/})" + else + MODE="$MODE $T" fi fi @@ -54,15 +45,50 @@ case "$MODE_NUM" in T=$(echo "$O" | awk -F[,] '/^\+ZCAINFO: /{print $11}') if [ -n "$T" ]; then if [ "$T" != "0" ]; 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="$MODE / $(band ${T})" fi fi ;; esac + +MODE=$(echo $MODE | sed 's,/,+,' | sed "s/LTE_A/LTE-A | /g") + +# Modem +FWA=$(sms_tool -d $DEVICE at "AT+CGMR" | xargs) +FW=$(echo $FWA | sed s/"AT+CGMR"//) + +MODELA=$(sms_tool -d $DEVICE at "AT+CGMM" | xargs) +MODELB=$(sms_tool -d $DEVICE at "AT+CGMI" | xargs) +MODELACUT=$(echo $MODELA | awk -F [:] '/^\+CGMM:/{print $2}' | xargs) +MODELBCUT=$(echo $MODELB | awk -F [:] '/^\+CGMI:/{print $2}' | xargs) +MODEL="$MODELBCUT "$MODELACUT + +# International Mobile Equipment Identity (IMEI) +O=$(sms_tool -d $DEVICE at "AT+CGSN" | xargs) +NR_I=$(echo "$O" | sed s/"AT+CGSN"//) +if [ -n "$NR_I" ]; then + NR_IMEI="$NR_I" +fi + +# International Mobile Subscriber Identity (IMSI) +O=$(sms_tool -d $DEVICE at "AT+CIMI" | xargs) +NR_C=$(echo "$O" | sed s/"AT+CIMI"//) +if [ -n "$NR_C" ]; then + NR_IMSI="$NR_C" +fi + +# Integrated Circuit Card Identifier (ICCID) +O=$(sms_tool -d $DEVICE at "AT*ICCID?") +NR_D=$(echo "$O" | awk -F [:] '/^\*ICCID:/{print $2}' | xargs) +if [ -n "$NR_D" ]; then + NR_ICCID="$NR_D" +fi + +# Protocol +# DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER +PV=$(cat /sys/kernel/debug/usb/devices 2>/dev/null) +PVCUT=$(echo $PV | awk -F 'Vendor=2cd2 ProdID=0004' '{print $2}' | cut -c-1220) +if echo "$PVCUT" | grep -q "cdc_ncm" +then + PROTO="ncm" +fi