diff --git a/luci-app-3ginfo-lite/Makefile b/luci-app-3ginfo-lite/Makefile index 92e13670..c23b7bb6 100644 --- a/luci-app-3ginfo-lite/Makefile +++ b/luci-app-3ginfo-lite/Makefile @@ -8,10 +8,16 @@ PKG_NAME:=luci-app-3ginfo-lite LUCI_TITLE:=LuCI panel for 3ginfo-lite LUCI_PKGARCH:=all LUCI_DEPENDS:=+sms-tool +comgt -PKG_VERSION:=1.0.27-20221008 +PKG_VERSION:=1.0.28-20221017 include $(TOPDIR)/feeds/luci/luci.mk +define Package/luci-app-3ginfo-lite/description + LuCI panel for 3ginfo-lite + The package allows visualization of the parameters of a + mobile Internet connection. +endef + $(eval $(call BuildPackage,$(PKG_NAME))) # call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-3ginfo-lite/htdocs/luci-static/resources/view/modem/3gdetail.js b/luci-app-3ginfo-lite/htdocs/luci-static/resources/view/modem/3gdetail.js index d0886abb..e8fcfa40 100644 --- a/luci-app-3ginfo-lite/htdocs/luci-static/resources/view/modem/3gdetail.js +++ b/luci-app-3ginfo-lite/htdocs/luci-static/resources/view/modem/3gdetail.js @@ -316,7 +316,7 @@ return view.extend({ if (json.registration == '0') { view.textContent = _('Not registered'); } - if (json.registration == '1') { + if (json.registration == '1' || json.registration == '6') { view.textContent = _('Registered'); } if (json.registration == '2') { @@ -325,6 +325,9 @@ return view.extend({ if (json.registration == '3') { view.textContent = _('Registering denied'); } + if (json.registration == '5' || json.registration == '7') { + view.textContent = _('Registered (roaming)'); + } } } diff --git a/luci-app-3ginfo-lite/po/pl/3ginfo.po b/luci-app-3ginfo-lite/po/pl/3ginfo.po index 518bd8cf..c62be071 100644 --- a/luci-app-3ginfo-lite/po/pl/3ginfo.po +++ b/luci-app-3ginfo-lite/po/pl/3ginfo.po @@ -114,6 +114,9 @@ msgstr "Nie zalogowana do sieci" msgid "Registered" msgstr "Zalogowana do sieci" +msgid "Registered (roaming)" +msgstr "Zalogowana do sieci (roaming)" + msgid "Searching.." msgstr "Wyszukiwanie.." diff --git a/luci-app-3ginfo-lite/root/etc/uci-defaults/set_3ginfo_port.sh b/luci-app-3ginfo-lite/root/etc/uci-defaults/set_3ginfo_port.sh index b914c1de..357c6c5f 100644 --- a/luci-app-3ginfo-lite/root/etc/uci-defaults/set_3ginfo_port.sh +++ b/luci-app-3ginfo-lite/root/etc/uci-defaults/set_3ginfo_port.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2020-2021 Rafał Wabik (IceG) - From eko.one.pl forum +# Copyright 2020-2022 Rafał Wabik (IceG) - From eko.one.pl forum # MIT License chmod +x /usr/share/3ginfo-lite/3ginfo.sh @@ -27,3 +27,33 @@ if [ $work != false ]; then uci set 3ginfo.@3ginfo[0].device=$work uci commit 3ginfo fi + +DEVICE=$(cat /tmp/sysinfo/board_name) + +if [[ "$DEVICE" == *"mf289f"* ]]; then + + uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" + uci commit 3ginfo + +fi + +if [[ "$DEVICE" == *"mf286r"* ]]; then + + uci set 3ginfo.@3ginfo[0].device="/dev/ttyACM0" + uci commit 3ginfo + +fi + +if [[ "$DEVICE" == *"mf286d"* ]]; then + + uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" + uci commit 3ginfo + +fi + +if [[ "$DEVICE" == *"mf286"* ]]; then + + uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" + uci commit 3ginfo + +fi diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/03f0581d b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/03f0581d index 8ee95e3f..11fe29c2 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/03f0581d +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/03f0581d @@ -60,6 +60,50 @@ then PROTO="ncm" fi +# International Mobile Equipment Identity (IMEI) +O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs) +NR_I=$(echo "$O" | sed 's/AT+GSN//g' | xargs) +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//g' | xargs) +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 + +# DL / UL / Band +OTB=$(sms_tool -d $DEVICE at "AT^HFREQINFO?") +TBX=$(echo "$OTB" | awk -F [:] '/^\^HFREQINFO:/{print $2}' | xargs) +TB=$(echo "$TBX" | cut -d ',' -f3-3 ) + +TDL=$(echo "$TBX" | cut -d ',' -f6-6 ) +DL=$(($TDL/1000)) + +TUL=$(echo "$TBX" | cut -d ',' -f9-9 ) +UL=$(($TUL/1000)) + +ULBW="UL: @$UL MHz" +DLBW="DL: @$DL MHz" + +PBAND="$(band $TB "") $DLBW $ULBW" +EARFCN=$(echo "$TBX" | cut -d ',' -f4-4 ) +PCI="-" + +# LAC & TAC +T_HEX=$LAC_HEX +T_DEC=$LAC_DEC + # Temperature T=$(echo "$O" | awk -F[,:] '/^\^CHIPTEMP/ {gsub(/[ \r]/,"");t=0;for(i=2;i<=NF;i++)if($i!=65535){if($i>100){$i=$i/10};if($i>t){t=$i}};printf "%.1f", t}') if [ "x$T" != "x0.0" ]; then diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d11506 b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d11506 index 8ee95e3f..11fe29c2 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d11506 +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d11506 @@ -60,6 +60,50 @@ then PROTO="ncm" fi +# International Mobile Equipment Identity (IMEI) +O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs) +NR_I=$(echo "$O" | sed 's/AT+GSN//g' | xargs) +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//g' | xargs) +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 + +# DL / UL / Band +OTB=$(sms_tool -d $DEVICE at "AT^HFREQINFO?") +TBX=$(echo "$OTB" | awk -F [:] '/^\^HFREQINFO:/{print $2}' | xargs) +TB=$(echo "$TBX" | cut -d ',' -f3-3 ) + +TDL=$(echo "$TBX" | cut -d ',' -f6-6 ) +DL=$(($TDL/1000)) + +TUL=$(echo "$TBX" | cut -d ',' -f9-9 ) +UL=$(($TUL/1000)) + +ULBW="UL: @$UL MHz" +DLBW="DL: @$DL MHz" + +PBAND="$(band $TB "") $DLBW $ULBW" +EARFCN=$(echo "$TBX" | cut -d ',' -f4-4 ) +PCI="-" + +# LAC & TAC +T_HEX=$LAC_HEX +T_DEC=$LAC_DEC + # Temperature T=$(echo "$O" | awk -F[,:] '/^\^CHIPTEMP/ {gsub(/[ \r]/,"");t=0;for(i=2;i<=NF;i++)if($i!=65535){if($i>100){$i=$i/10};if($i>t){t=$i}};printf "%.1f", t}') if [ "x$T" != "x0.0" ]; then diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d1156c b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d1156c index 8ee95e3f..11fe29c2 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d1156c +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/12d1156c @@ -60,6 +60,50 @@ then PROTO="ncm" fi +# International Mobile Equipment Identity (IMEI) +O=$(sms_tool -d $DEVICE at "AT+GSN" | xargs) +NR_I=$(echo "$O" | sed 's/AT+GSN//g' | xargs) +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//g' | xargs) +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 + +# DL / UL / Band +OTB=$(sms_tool -d $DEVICE at "AT^HFREQINFO?") +TBX=$(echo "$OTB" | awk -F [:] '/^\^HFREQINFO:/{print $2}' | xargs) +TB=$(echo "$TBX" | cut -d ',' -f3-3 ) + +TDL=$(echo "$TBX" | cut -d ',' -f6-6 ) +DL=$(($TDL/1000)) + +TUL=$(echo "$TBX" | cut -d ',' -f9-9 ) +UL=$(($TUL/1000)) + +ULBW="UL: @$UL MHz" +DLBW="DL: @$DL MHz" + +PBAND="$(band $TB "") $DLBW $ULBW" +EARFCN=$(echo "$TBX" | cut -d ',' -f4-4 ) +PCI="-" + +# LAC & TAC +T_HEX=$LAC_HEX +T_DEC=$LAC_DEC + # Temperature T=$(echo "$O" | awk -F[,:] '/^\^CHIPTEMP/ {gsub(/[ \r]/,"");t=0;for(i=2;i<=NF;i++)if($i!=65535){if($i>100){$i=$i/10};if($i>t){t=$i}};printf "%.1f", t}') if [ "x$T" != "x0.0" ]; then diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21489 b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21489 index 59fe8184..84272096 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21489 +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/3ginfo-addon/19d21489 @@ -3,6 +3,7 @@ _DEVICE=/dev/ttyACM0 OB=$(sms_tool -d $_DEVICE at "at+zrssi;+zcellinfo?;+zcainfo?") + O=$(echo $OB | tr -d " \t\n\r" | xargs) case "$MODE_NUM" in @@ -33,6 +34,8 @@ case "$MODE_NUM" in [ -n "$ADDON" ] && ADDON="$ADDON," T_HEX=$(printf "%X" $T) T_DEC=$T + LAC_DEC=$T_DEC + LAC_HEX=$T_HEX fi T=$(echo "$OB" | awk -F[,:] '/^\+ZRSSI/ {print $4}' | xargs) @@ -54,8 +57,8 @@ case "$MODE_NUM" in SINRB="$T" SINR=$(echo $SINRB | tr ' ' '\n' | grep -E '^[+-]?[0-9]*\.?([0-9]+)$' | cut -f1 -d"." ) - T=$(echo "$OB" | awk -F[,:] '/^\+ZCELLINFO/ {print $4}' | xargs) - case "$T" in + TU=$(echo "$OB" | awk -F[,:\;] '/^\+ZCELLINFO/ {print $4}' | xargs) + case "$TU" in *"LTE B1") MODE=$(band 1 "LTE ");; *"LTE B3") MODE=$(band 3 "LTE ");; *"LTE B5") MODE=$(band 5 "LTE ");; @@ -66,49 +69,37 @@ case "$MODE_NUM" in *"LTE B38") MODE=$(band 38 "LTE ");; *"LTE B40") MODE=$(band 40 "LTE ");; *"LTE B41") MODE=$(band 41 "LTE ");; - *) MODE="${T}";; + *) MODE="${TU}";; esac T=$(echo "$OB" | awk -F[,:\;] '/^\+ZCAINFO/ {print $3}' | xargs) - if [ -n "$T" ] && [ "x$T" != "x0" ]; then + if [ -n "$T" ]; then T1=$(echo "$OB" | 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 "$OB" | awk -F[,:\;] '/^\+ZCAINFO/ {print $2}' | xargs) - if [ -n "$T" ] && [ "x$T" != "x0" ]; then + if [ -n "$T" ]; then [ -n "$ADDON" ] && ADDON="$ADDON," PCI="$T" - + ADDON="$ADDON"'{"PCI":"'$T'"}' fi T=$(echo "$OB" | awk -F[,:\;] '/^\+ZCAINFO/ {print $5}' | xargs) - if [ -n "$T" ] && [ "x$T" != "x0" ]; then + if [ -n "$T" ]; then [ -n "$ADDON" ] && ADDON="$ADDON," EARFCN="$T" - + ADDON="$ADDON"'{"EARFCN":"'$T'"}' fi - if [ "x$MODE_NUM" = "x9" ]; then - T=$(echo "$OB" | 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 "");; - *"5") MODE="${MODE/LTE/LTE_A} / "$(band 5 "");; - *"7") MODE="${MODE/LTE/LTE_A} / "$(band 7 "");; - *"8") MODE="${MODE/LTE/LTE_A} / "$(band 8 "");; - *"20") MODE="${MODE/LTE/LTE_A} / "$(band 20 "");; - *"28") MODE="${MODE/LTE/LTE_A} / "$(band 28 "");; - *"38") MODE="${MODE/LTE/LTE_A} / "$(band 38 "");; - *"40") MODE="${MODE/LTE/LTE_A} / "$(band 40 "");; - *"41") MODE="${MODE/LTE/LTE_A} / "$(band 41 "");; - *) MODE="${MODE/LTE/LTE_A} / B${T}";; - esac - MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,') - fi + TS=$(echo "$OB" | awk -F[,:\;] '/^\+ZCAINFO/ {print $9}' | xargs) + if [ -n "$TS" ]; then + case $TS in + *) MODE="${MODE/LTE/LTE_A} / $(band $TS "")";; + esac T=$(echo "$OB" | awk -F[,:\;] '/^\+ZCAINFO/ {print $9}' | xargs) + if [ -n "$T" ]; then T2=$(echo "$OB" | awk -F[,:\;] '/^\+ZCAINFO/ {print $11}' | xargs) [ -n "$ADDON" ] && ADDON="$ADDON," @@ -127,29 +118,39 @@ case "$MODE_NUM" in [ -n "$ADDON" ] && ADDON="$ADDON," S1EARFCN="$T" fi + fi ;; esac +MODE=$(echo $MODE | sed "s/LTE_A/LTE-A |/g" | sed 's,/,+,') + # Firmware FWB=$(sms_tool -d $_DEVICE at "AT+GMR") FW=$(echo $FWB | tr -d " \t\n\r" | xargs) if [[ "$FW" == *"MF286RA"* && "$CSQ" == *"-"* ]]; then -OQ=$(sms_tool -D -d $DEVICE at "AT+CSQ") +OQ=$(sms_tool -D -d $_DEVICE at "AT+CSQ") CSQ=$(echo "$OQ" | awk -F[,\ ] '/^\+CSQ/ {print $2}') [ "x$CSQ" = "x" ] && CSQ=-1 if [ $CSQ -ge 0 -a $CSQ -le 31 ]; then CSQ_PER=$(($CSQ * 100/31)) - fi + fi + +fi + +if [[ "$FW" == *"MF286RA"* && "$REG" == *"-"* ]]; then + +OR=$(sms_tool -D -d $_DEVICE at "AT+CREG?") +REG=$(echo "$OR" | awk -F [:] '/^\+CREG:/{print $2}' | head -c 4 | tail -c 1) + fi # Modem MODELA=$(sms_tool -d $_DEVICE at "AT+CGMI" | tr -s "\n" | xargs) -SUB='ZTE' -if [[ "$MODELA" == *"$SUB"* ]]; then +if [[ "$MODELA" == *"ZTE"* ]]; then MODELACUT=$(echo $MODELA | awk -F'CGMI: ' '{print $2}' | sed 's/"//g' | sed 's/ CORPORATION//g') MODELO=$(echo $MODELACUT | tr -d " \t\n\r" | xargs) MODELB=$(sms_tool -d $_DEVICE at "AT+CGMM") @@ -171,7 +172,12 @@ DEVICE=$(cat /tmp/modem 2>/dev/null) # International Mobile Equipment Identity (IMEI) O=$(sms_tool -d $_DEVICE at "AT+GSN" | xargs) NR_I=$(echo "$O" | cut -c 8-) -if [ -n "$NR_I" ]; then +if [ -z "NR_I" ] +then + O=$(sms_tool -d $_DEVICE at "AT*MRD_IMEI?" | xargs) + NR_I=$(echo "$O" | awk -F [:] '/^\*MRD_IMEI:/{print $2}' | xargs) + NR_IMEI="$NR_I" +else NR_IMEI="$NR_I" fi @@ -183,11 +189,7 @@ if [ -n "$NR_C" ]; then 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 +NR_D="-" # Protocol # DRIVER=QMI_WWAN & DRIVER=CDC_MBIM & DRIVER=CDC_ETHER diff --git a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/set_3ginfo_port.sh b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/set_3ginfo_port.sh index 48f5b82a..f8280515 100644 --- a/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/set_3ginfo_port.sh +++ b/luci-app-3ginfo-lite/root/usr/share/3ginfo-lite/set_3ginfo_port.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright 2020-2021 Rafał Wabik (IceG) - From eko.one.pl forum +# Copyright 2020-2022 Rafał Wabik (IceG) - From eko.one.pl forum # MIT License work=false @@ -19,3 +19,33 @@ if [ $work != false ]; then uci set 3ginfo.@3ginfo[0].device=$work uci commit 3ginfo fi + +DEVICE=$(cat /tmp/sysinfo/board_name) + +if [[ "$DEVICE" == *"mf289f"* ]]; then + + uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" + uci commit 3ginfo + +fi + +if [[ "$DEVICE" == *"mf286r"* ]]; then + + uci set 3ginfo.@3ginfo[0].device="/dev/ttyACM0" + uci commit 3ginfo + +fi + +if [[ "$DEVICE" == *"mf286d"* ]]; then + + uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" + uci commit 3ginfo + +fi + +if [[ "$DEVICE" == *"mf286"* ]]; then + + uci set 3ginfo.@3ginfo[0].device="/dev/ttyUSB1" + uci commit 3ginfo + +fi