luci-app-qmodem: perf: Neoway support & use ndisc6 for connect check

This commit is contained in:
sfwtw 2025-06-14 14:31:25 +08:00
parent 5186c841ec
commit 8c295e84ab
9 changed files with 147 additions and 98 deletions

View File

@ -0,0 +1,40 @@
#
# Copyright (C) 2007-2021 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ndisc6
PKG_VERSION:=1.0.8
PKG_RELEASE:=1
PKG_SOURCE:=ndisc6-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://www.remlab.net/files/ndisc6/
PKG_HASH:=1f2fb2dc1172770aa5a09d39738a44d8b753cc5e2e25e306ca78682f9fea0b4f
PKG_INSTALL:=1
PKG_FIXUP:=autoreconf
include $(INCLUDE_DIR)/package.mk
define Package/ndisc6
URL:=https://www.remlab.net/ndisc6/
SECTION:=network
CATEGORY:=Network
TITLE:=NDisc6
endef
define Package/ndisc6/description
NDisc6 is a small collection of useful tools for IPv6 networking
endef
define Package/ndisc6/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndisc6 $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rdisc6 $(1)/usr/bin
endef
$(eval $(call BuildPackage,ndisc6))

View File

@ -28,15 +28,13 @@ define Build/Prepare
$(CP) src/* $(PKG_BUILD_DIR)/ $(CP) src/* $(PKG_BUILD_DIR)/
endef endef
define Build/Compile define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \ $(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS)" $(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS)"
endef endef
define Package/$(PKG_NAME)/install define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tom_modem $(1)/usr/bin/ $(INSTALL_BIN) $(PKG_BUILD_DIR)/tom_modem $(1)/usr/bin/
endef endef

View File

@ -12,7 +12,7 @@ PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com> PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
LUCI_DEPENDS:=+luci-compat \ LUCI_DEPENDS:=+luci-compat \
+kmod-usb2 +kmod-usb3 \ +kmod-usb2 +kmod-usb3 \
+kmod-usb-serial +kmod-usb-serial-option +kmod-usb-serial-qualcomm \ +kmod-usb-serial +kmod-usb-serial-option +kmod-usb-serial-qualcomm \
+kmod-usb-net +kmod-usb-acm \ +kmod-usb-net +kmod-usb-acm \
+kmod-usb-wdm \ +kmod-usb-wdm \
+kmod-usb-net-cdc-ether \ +kmod-usb-net-cdc-ether \
@ -34,7 +34,8 @@ LUCI_DEPENDS:=+luci-compat \
+PACKAGE_luci-app-qmodem_USING_NORMAL_QUECTEL_CM:quectel-cm \ +PACKAGE_luci-app-qmodem_USING_NORMAL_QUECTEL_CM:quectel-cm \
+tom_modem \ +tom_modem \
+jq +bc\ +jq +bc\
+coreutils +coreutils-stat +coreutils +coreutils-stat \
+ndisc6
define Package/luci-app-qmodem/conffiles define Package/luci-app-qmodem/conffiles
/etc/config/qmodem /etc/config/qmodem

View File

@ -78,10 +78,10 @@ soft_reboot = s:taboption("advanced", Flag, "soft_reboot", translate("Soft Reboo
soft_reboot.description = translate("enable modem soft reboot") soft_reboot.description = translate("enable modem soft reboot")
soft_reboot.default = "0" soft_reboot.default = "0"
-- 350 v4/v6存活检查 -- Connect Check
mtk_check = s:taboption("advanced", Flag, "mtk_check", translate("MTK V4/V6 Check")) connect_check = s:taboption("advanced", Flag, "connect_check", translate("V4/V6 Connect Check"))
mtk_check.description = translate("Only for Fibocom MTK modem.") connect_check.description = translate("Only for AT dial modem.")
mtk_check.default = "0" connect_check.default = "0"
-- 网络类型 -- 网络类型
pdp_type= s:taboption("advanced", ListValue, "pdp_type", translate("PDP Type")) pdp_type= s:taboption("advanced", ListValue, "pdp_type", translate("PDP Type"))

View File

@ -73,10 +73,10 @@ end
soft_reboot = s:option(Flag, "soft_reboot", translate("Soft Reboot")) soft_reboot = s:option(Flag, "soft_reboot", translate("Soft Reboot"))
soft_reboot.default = "0" soft_reboot.default = "0"
-- MTK Check -- Connect Check
mtk_check = s:option(Flag, "mtk_check", translate("MTK V4/V6 Check")) connect_check = s:option(Flag, "connect_check", translate("V4/V6 Connect Check"))
mtk_check.description = translate("Only for Fibocom MTK modem.") connect_check.description = translate("Only for AT dial modem.")
mtk_check.default = "0" connect_check.default = "0"
-- PDP Context Index -- PDP Context Index
define_connect = s:option(Value, "define_connect", translate("PDP Context Index")) define_connect = s:option(Value, "define_connect", translate("PDP Context Index"))

View File

@ -852,8 +852,8 @@ msgstr "(仍在测试中)"
msgid "beta" msgid "beta"
msgstr "(测试)" msgstr "(测试)"
msgid "MTK V4/V6 Check" msgid "V4/V6 Connect Check"
msgstr "MTK V4/V6 存活检测" msgstr "V4/V6 存活检测"
msgid "Only for Fibocom MTK modem." msgid "Only for AT dial modem."
msgstr "只适用于广和通MTK模组。" msgstr "只适用于AT拨号模组。"

View File

@ -848,8 +848,8 @@ msgstr "(仍在测试中)"
msgid "beta" msgid "beta"
msgstr "(测试)" msgstr "(测试)"
msgid "MTK V4/V6 Check" msgid "V4/V6 Connect Check"
msgstr "MTK V4/V6 存活检测" msgstr "V4/V6 存活检测"
msgid "Only for Fibocom MTK modem." msgid "Only for AT dial modem."
msgstr "只适用于广和通MTK模组。" msgstr "只适用于AT拨号模组。"

View File

@ -114,7 +114,7 @@ update_config()
config_get en_bridge $modem_config en_bridge config_get en_bridge $modem_config en_bridge
config_get do_not_add_dns $modem_config do_not_add_dns config_get do_not_add_dns $modem_config do_not_add_dns
config_get dns_list $modem_config dns_list config_get dns_list $modem_config dns_list
[ "$manufacturer" == "fibocom" ] && [ "$platform" == "mediatek" ] && config_get mtk_check $modem_config mtk_check config_get connect_check $modem_config connect_check
config_get global_dial main enable_dial config_get global_dial main enable_dial
# config_get ethernet_5g u$modem_config ethernet 转往口获取命令更新,待测试 # config_get ethernet_5g u$modem_config ethernet 转往口获取命令更新,待测试
config_foreach get_associate_ethernet_by_path modem-slot config_foreach get_associate_ethernet_by_path modem-slot
@ -266,7 +266,7 @@ check_ip()
"neoway") "neoway")
case $platform in case $platform in
"unisoc") "unisoc")
check_ip_command='AT$MYUSBNETACT?' check_ip_command="AT+CGPADDR=1"
;; ;;
esac esac
;; ;;
@ -280,9 +280,6 @@ check_ip()
local config=$(umbim -d $mbim_port config) local config=$(umbim -d $mbim_port config)
ipaddr=$(echo "$config" | grep "ipv4address:" | awk '{print $2}' | cut -d'/' -f1) ipaddr=$(echo "$config" | grep "ipv4address:" | awk '{print $2}' | cut -d'/' -f1)
ipaddr="$ipaddr $(echo "$config" | grep "ipv6address:" | awk '{print $2}' | cut -d'/' -f1)" ipaddr="$ipaddr $(echo "$config" | grep "ipv6address:" | awk '{print $2}' | cut -d'/' -f1)"
elif [ "$manufacturer" = "neoway" ]; then
# $MYURCACT: 0,1,"10.92.220.73"
ipaddr=$(at "$at_port" "$check_ip_command" | grep '$MYUSBNETACT:')
else else
ipaddr=$(at "$at_port" "$check_ip_command" | grep +CGPADDR:) ipaddr=$(at "$at_port" "$check_ip_command" | grep +CGPADDR:)
fi fi
@ -315,10 +312,10 @@ check_ip()
fi fi
} }
check_mtk_connection() check_connection()
{ {
[ "$connection_status" = "0" ] || [ "$connection_status" = "-1" ] && return 0 [ "$connection_status" = "0" ] || [ "$connection_status" = "-1" ] && return 0
if [ "$mtk" -eq 1 ] && [ -n "$ipv4" ] && [ -n "$modem_netcard" ]; then if [ -n "$ipv4" ] && [ -n "$modem_netcard" ]; then
for i in 1 2; do for i in 1 2; do
if ping -I "$modem_netcard" -w 1 1.1.1.1 >/dev/null 2>&1 || if ping -I "$modem_netcard" -w 1 1.1.1.1 >/dev/null 2>&1 ||
ping -I "$modem_netcard" -w 2 8.8.8.8 >/dev/null 2>&1; then ping -I "$modem_netcard" -w 2 8.8.8.8 >/dev/null 2>&1; then
@ -331,18 +328,9 @@ check_mtk_connection()
sleep 1 sleep 1
done done
local ifup_time=$(ubus call network.interface.$interface6_name status 2>/dev/null | jsonfilter -e '@.uptime' 2>/dev/null || echo 0) local ifup_time=$(ubus call network.interface.$interface6_name status 2>/dev/null | jsonfilter -e '@.uptime' 2>/dev/null || echo 0)
if [ -n "$ifup_time" ] && [ "$ifup_time" -gt 5 ] && [ "$pdp_type" = "ipv4v6" ] && [ -n "$ipv6" ]; then if [ "$ifup_time" -gt 5 ] && [ "$pdp_type" = "ipv4v6" ]; then
for i in 1 2; do rdisc6 $origin_device &
if ping6 -I "$modem_netcard" -w 1 2400:3200::1 >/dev/null 2>&1 || ndisc6 fe80::1 $origin_device &
ping6 -I "$modem_netcard" -w 2 2001:4860:4860::8888 >/dev/null 2>&1; then
break
fi
if [ $i -eq 2 ]; then
m_debug "IPv6 connection test failed, restarting IPv6 interface"
[ -n "$interface6_name" ] && ifdown "$interface6_name" && sleep 2 && ifup "$interface6_name"
fi
sleep 1
done
fi fi
fi fi
return 0 return 0
@ -660,14 +648,15 @@ ecm_hang()
at_command="AT^NDISDUP=0,0" at_command="AT^NDISDUP=0,0"
;; ;;
"neoway") "neoway")
delay=3
at_command='AT$MYUSBNETACT=0,0' at_command='AT$MYUSBNETACT=0,0'
;; ;;
*) *)
at_command="ATI" at_command="ATI"
;; ;;
esac esac
fastat "${at_port}" "${at_command}" fastat "${at_port}" "${at_command}"
sleep "$delay"
} }
hang() hang()
@ -819,7 +808,7 @@ at_dial()
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\"" cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;; ;;
"mediatek") "mediatek")
mtk=1 delay=3
if [ "$apn" = "auto" ];then if [ "$apn" = "auto" ];then
apn="cbnet" apn="cbnet"
fi fi
@ -859,17 +848,13 @@ at_dial()
at_command='AT$MYUSBNETACT=0,1' at_command='AT$MYUSBNETACT=0,1'
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\"" cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;; ;;
"unisoc")
at_command=""
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;;
esac esac
;; ;;
esac esac
m_debug "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command ; $at_command" m_debug "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command ; $at_command"
at "${at_port}" "${cgdcont_command}" at "${at_port}" "${cgdcont_command}"
fastat "$at_port" "$at_command" fastat "$at_port" "$at_command"
[ "$mtk" -eq 1 ] && sleep 2 sleep "$delay"
if [ "$driver" = "mtk_pcie" ];then if [ "$driver" = "mtk_pcie" ];then
fastat "$at_port" "AT+CGACT=0,3" fastat "$at_port" "AT+CGACT=0,3"
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g') mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
@ -1058,7 +1043,7 @@ at_dial_monitor()
ipv4_cache=$ipv4 ipv4_cache=$ipv4
ipv6_cache=$ipv6 ipv6_cache=$ipv6
fi fi
[ "$mtk_check" -eq 1 ] && { sleep 5; check_mtk_connection || { fastat "$at_port" "AT+CGACT=0,3" && at_dial; }; } || sleep 15 [ "$connect_check" -eq 1 ] && { sleep 5; check_connection || { hang && at_dial; }; } || sleep 15
;; ;;
esac esac
check_logfile_line check_logfile_line

View File

@ -1,17 +1,32 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2025 Fujr <fjrcn@outlook.com> # Copyright (C) 2025 sfwtw
_Vendor="neoway" _Vendor="neoway"
_Author="Fujr" _Author="sfwtw"
_Maintainer="Fujr <fjrcn@outlook.com>" _Maintainer="sfwtw <unknown>"
source /usr/share/qmodem/generic.sh source /usr/share/qmodem/generic.sh
debug_subject="neoway_ctrl" debug_subject="neoway_ctrl"
vendor_get_disabled_features(){ vendor_get_disabled_features(){
json_add_string "" "NeighborCell" json_add_string "" "NeighborCell"
json_add_string "" "IMEI"
json_add_string "" "DialMode" json_add_string "" "DialMode"
} }
get_imei(){
at_command="AT+CGSN"
imei=$(at $at_port $at_command | grep -o "[0-9]\{15\}")
json_add_string "imei" "$imei"
}
set_imei(){
local imei="$1"
at_command="AT+SPIMEI=0,\"$imei\""
res=$(at $at_port $at_command)
json_select "result"
json_add_string "set_imei" "$res"
json_close_object
get_imei
}
#获取网络偏好 #获取网络偏好
# $1:AT串口 # $1:AT串口
get_network_prefer() get_network_prefer()
@ -218,6 +233,30 @@ sim_info()
esac esac
} }
rate_convert()
{
#check if bc is installed
is_bc_installed=$(which bc)
local rate=$1
rate_units="Kbps Mbps Gbps Tbps"
if [ -z "$is_bc_installed" ]; then
for i in $(seq 0 3); do
if [ $rate -lt 1024 ]; then
break
fi
rate=$(($rate / 1024))
done
else
for i in $(seq 0 3); do
if [ $(echo "$rate < 1024" | bc) -eq 1 ]; then
break
fi
rate=$(echo "scale=2; $rate / 1024" | bc)
done
fi
echo "$rate `echo $rate_units | cut -d ' ' -f $(($i+1))`"
}
#网络信息 #网络信息
network_info() network_info()
{ {
@ -240,8 +279,8 @@ network_info()
ambr_ul=$(echo "$response" | awk -F',' '{print $8}' | sed 's/\r//g') ambr_ul=$(echo "$response" | awk -F',' '{print $8}' | sed 's/\r//g')
# Convert kbit/s to Mbit/s for display if values exist # Convert kbit/s to Mbit/s for display if values exist
[ -n "$ambr_dl" ] && ambr_dl=$(awk "BEGIN { printf \"%.2f\", $ambr_dl/1000 }") [ -n "$ambr_dl" ] && ambr_dl=$(rate_convert $ambr_dl)
[ -n "$ambr_ul" ] && ambr_ul=$(awk "BEGIN { printf \"%.2f\", $ambr_ul/1000 }") [ -n "$ambr_ul" ] && ambr_ul=$(rate_convert $ambr_ul)
fi fi
class="Network Information" class="Network Information"
@ -527,7 +566,6 @@ cell_info()
response=$(at $at_port $at_command) response=$(at $at_port $at_command)
if [ -n "$(echo "$response" | grep "+NETDMSGEX:")" ]; then if [ -n "$(echo "$response" | grep "+NETDMSGEX:")" ]; then
m_debug "Using Neoway AT+NETDMSGEX command"
net_mode=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $1}' | sed 's/+NETDMSGEX: "//g' | sed 's/"//g') net_mode=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $1}' | sed 's/+NETDMSGEX: "//g' | sed 's/"//g')
network_mode=$(get_network_mode "$net_mode") network_mode=$(get_network_mode "$net_mode")
@ -536,31 +574,24 @@ cell_info()
mcc=$(echo "$mcc_mnc" | cut -d'+' -f1) mcc=$(echo "$mcc_mnc" | cut -d'+' -f1)
mnc=$(echo "$mcc_mnc" | cut -d'+' -f2) mnc=$(echo "$mcc_mnc" | cut -d'+' -f2)
band=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $3}' | sed 's/LTE BAND //g' | sed 's/NR BAND //g') band=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $3}' | sed 's/"//g')
arfcn=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $4}') arfcn=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $4}' | sed 's/\r//g')
case "$net_mode" in case "$net_mode" in
"NR to 5GCN"|"NR to EPS"|"NR-LTE ENDC"|"NR-LTE NEDC") "NR to 5GCN"|"NR to EPS"|"NR-LTE ENDC"|"NR-LTE NEDC")
gnbid=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $5}') gnbid=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $5}' | sed 's/\r//g')
pci=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $6}') pci=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $6}' | sed 's/\r//g')
ss_rsrp=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $7}') ss_rsrp=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $7}' | sed 's/\r//g')
ss_rsrq=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $8}') ss_rsrq=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $8}' | sed 's/\r//g')
ss_sinr=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $9}') ss_sinr=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $9}' | sed 's/\r//g')
if [ "$(echo "$response" | grep -o ',' | wc -l)" -ge 12 ]; then [ -n "$ss_rsrp" ] && ss_rsrp_actual=$(printf "%.1f" $(echo "$ss_rsrp / 10" | bc -l 2>/dev/null))
csi_rsrp=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $10}')
csi_rsrq=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $11}')
csi_sinr=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $12}' | sed 's/\r//g')
fi
[ -n "$ss_rsrp" ] && ss_rsrp_actual=$(awk "BEGIN { printf \"%.1f\", $ss_rsrp/10 }") [ -n "$ss_rsrq" ] && ss_rsrq_actual=$(printf "%.1f" $(echo "$ss_rsrq / 10" | bc -l 2>/dev/null))
[ -n "$ss_rsrq" ] && ss_rsrq_actual=$(awk "BEGIN { printf \"%.1f\", $ss_rsrq/10 }")
[ -n "$ss_sinr" ] && ss_sinr_actual=$(awk "BEGIN { printf \"%.1f\", $ss_sinr/10 }") [ -n "$ss_sinr" ] && ss_sinr_actual=$(printf "%.1f" $(echo "$ss_sinr / 10" | bc -l 2>/dev/null))
[ -n "$csi_rsrp" ] && csi_rsrp_actual=$(awk "BEGIN { printf \"%.1f\", $csi_rsrp/10 }")
[ -n "$csi_rsrq" ] && csi_rsrq_actual=$(awk "BEGIN { printf \"%.1f\", $csi_rsrq/10 }")
[ -n "$csi_sinr" ] && csi_sinr_actual=$(awk "BEGIN { printf \"%.1f\", $csi_sinr/10 }")
network_mode="NR5G-SA Mode" network_mode="NR5G-SA Mode"
nr_mcc="$mcc" nr_mcc="$mcc"
@ -587,9 +618,6 @@ cell_info()
rssi=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $13}') rssi=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $13}')
if [ "$(echo "$response" | grep -o ',' | wc -l)" -ge 17 ]; then if [ "$(echo "$response" | grep -o ',' | wc -l)" -ge 17 ]; then
srxlev=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $14}')
squal=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $15}')
cqi=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $16}')
dl_bw_num=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $17}') dl_bw_num=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $17}')
ul_bw_num=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $18}' | sed 's/\r//g') ul_bw_num=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $18}' | sed 's/\r//g')
@ -597,10 +625,13 @@ cell_info()
ul_bandwidth=$(get_bandwidth "LTE" "$ul_bw_num") ul_bandwidth=$(get_bandwidth "LTE" "$ul_bw_num")
fi fi
[ -n "$rsrp" ] && rsrp_actual=$(awk "BEGIN { printf \"%.1f\", $rsrp/10 }") [ -n "$rsrp" ] && rsrp_actual=$(printf "%.1f" $(echo "$rsrp / 10" | bc -l 2>/dev/null))
[ -n "$rsrq" ] && rsrq_actual=$(awk "BEGIN { printf \"%.1f\", $rsrq/10 }")
[ -n "$sinr" ] && sinr_actual=$(awk "BEGIN { printf \"%.1f\", $sinr/10 }") [ -n "$rsrq" ] && rsrq_actual=$(printf "%.1f" $(echo "$rsrq / 10" | bc -l 2>/dev/null))
[ -n "$rssi" ] && rssi_actual=$(awk "BEGIN { printf \"%.1f\", $rssi/10 }")
[ -n "$sinr" ] && sinr_actual=$(printf "%.1f" $(echo "$sinr / 10" | bc -l 2>/dev/null))
[ -n "$rssi" ] && rssi_actual=$(printf "%.1f" $(echo "$rssi / 10" | bc -l 2>/dev/null))
network_mode="LTE Mode" network_mode="LTE Mode"
lte_mcc="$mcc" lte_mcc="$mcc"
@ -647,8 +678,9 @@ cell_info()
slot=$(get_slot "$slot_num") slot=$(get_slot "$slot_num")
fi fi
[ -n "$rscp" ] && rscp_actual=$(awk "BEGIN { printf \"%.1f\", $rscp/10 }") [ -n "$rscp" ] && rscp_actual=$(printf "%.1f" $(echo "$rscp / 10" | bc -l 2>/dev/null))
[ -n "$ecio" ] && ecio_actual=$(awk "BEGIN { printf \"%.1f\", $ecio/10 }")
[ -n "$ecio" ] && ecio_actual=$(printf "%.1f" $(echo "$ecio / 10" | bc -l 2>/dev/null))
network_mode="WCDMA Mode" network_mode="WCDMA Mode"
wcdma_mcc="$mcc" wcdma_mcc="$mcc"
@ -679,23 +711,16 @@ cell_info()
case $network_mode in case $network_mode in
"NR5G-SA Mode") "NR5G-SA Mode")
add_plain_info_entry "MCC" "$nr_mcc" "Mobile Country Code" add_plain_info_entry "MCC" "$mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$nr_mnc" "Mobile Network Code" add_plain_info_entry "MNC" "$mnc" "Mobile Network Code"
add_plain_info_entry "Cell ID" "$nr_cell_id" "Cell ID" add_plain_info_entry "Cell ID" "$nr_cell_id" "Cell ID"
add_plain_info_entry "Physical Cell ID" "$nr_physical_cell_id" "Physical Cell ID" add_plain_info_entry "Physical Cell ID" "$nr_physical_cell_id" "Physical Cell ID"
add_plain_info_entry "ARFCN" "$nr_arfcn" "Absolute Radio-Frequency Channel Number" add_plain_info_entry "ARFCN" "$nr_arfcn" "Absolute Radio-Frequency Channel Number"
add_plain_info_entry "Band" "$nr_band" "Band" add_plain_info_entry "Band" "$nr_band" "Band"
add_bar_info_entry "SS-RSRP" "$nr_rsrp" "Reference Signal Received Power (SS)" -187 -29 dBm add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "SS-RSRQ" "$nr_rsrq" "Reference Signal Received Quality (SS)" -43 20 dBm add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SS-SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio (SS)" -23 40 dB add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio" 0 30 dB
if [ -n "$csi_rsrp" ]; then
add_bar_info_entry "CSI-RSRP" "$csi_rsrp_actual" "Reference Signal Received Power (CSI)" -187 -29 dBm
add_bar_info_entry "CSI-RSRQ" "$csi_rsrq_actual" "Reference Signal Received Quality (CSI)" -43 20 dBm
add_bar_info_entry "CSI-SINR" "$csi_sinr_actual" "Signal to Interference plus Noise Ratio (CSI)" -23 40 dB
fi
;; ;;
"LTE Mode") "LTE Mode")
add_plain_info_entry "MCC" "$lte_mcc" "Mobile Country Code" add_plain_info_entry "MCC" "$lte_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$lte_mnc" "Mobile Network Code" add_plain_info_entry "MNC" "$lte_mnc" "Mobile Network Code"
@ -707,9 +732,9 @@ cell_info()
add_plain_info_entry "RX Power" "$lte_rx_power" "RX Power (dBm)" add_plain_info_entry "RX Power" "$lte_rx_power" "RX Power (dBm)"
add_plain_info_entry "TX Power" "$lte_tx_power" "TX Power (dBm)" add_plain_info_entry "TX Power" "$lte_tx_power" "TX Power (dBm)"
add_bar_info_entry "RSRP" "$lte_rsrp" "Reference Signal Received Power" -140 -44 dBm add_bar_info_entry "RSRP" "$lte_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -20 20 dBm add_bar_info_entry "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio" -23 40 dB add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio" 0 30 dB
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -140 -44 dBm add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -120 -20 dBm
if [ -n "$lte_cql" ]; then if [ -n "$lte_cql" ]; then
add_plain_info_entry "CQI" "$lte_cql" "Channel Quality Indicator" add_plain_info_entry "CQI" "$lte_cql" "Channel Quality Indicator"