Compare commits

..

18 Commits
v2.8.0 ... main

Author SHA1 Message Date
Fu Jianrong
88b90bbea7
可怜的TOM又来水commit了 2025-06-29 19:52:55 +08:00
GitHub Action
f6211575d4 Update support list 2025-06-27 21:35:54 +08:00
sfwtw
c04684dabe luci-app-qmodem: add support for Telit FN990A40
Signed-off-by: sfwtw <wtw@cr.cx>
2025-06-27 21:35:03 +08:00
sfwtw
6788934e46 quectel_MHI: revert: mhi_mbim_enabled
Signed-off-by: sfwtw <wtw@cr.cx>
2025-06-27 10:36:29 +08:00
coolsnowwolf
a631b62d53 luci-app-qmodem: add terminfo depends 2025-06-20 12:40:59 +08:00
GitHub Action
ef18492ba4 Update support list 2025-06-19 23:05:03 +08:00
sfwtw
b9ef79b982 luci-app-qmodem: Add support for Quectel RG520F-JO 2025-06-19 23:04:49 +08:00
coolsnowwolf
d4621e1496 luci-app-qmodem: fix scan ATI port OK message 2025-06-19 21:36:34 +08:00
sfwtw
82f401bf05 luci-app-qmodem: fix: dial delay null 2025-06-17 21:19:15 +08:00
fujr
5dc6b7cdad workflow: Split the original workflow and separate the support list update.
No longer check the support list in the main workflow.
Enable automatic updates to the support list only for the main branch.
Check the support list information in PRs:
Automatically close the PR if there are errors.
If there are no errors, comment on the changes made.
2025-06-15 16:14:11 +08:00
sfwtw
06ce7101ce luci-app-qmodem: fix: Foxconn bar_info & perf: signal info display 2025-06-15 00:23:34 +08:00
sfwtw
8c295e84ab luci-app-qmodem: perf: Neoway support & use ndisc6 for connect check 2025-06-15 00:19:24 +08:00
GitHub Action
5186c841ec Update support list 2025-06-12 14:26:54 +08:00
Tommy
384d2adad9
Add Support RM510q-gl pcie mode (#58) 2025-06-12 14:26:45 +08:00
GitHub Action
36bd30bccd Update support list 2025-06-12 04:42:57 +08:00
coolsnowwolf
fcfcda7321 luci-app-qmodem: Add support for TD Tech S10/EM350/EM360 support 2025-06-12 04:42:42 +08:00
GitHub Action
410bff1d54 Update support list 2025-06-11 10:41:11 +08:00
Jason Huang
2a465bcdfe
luci-app-qmodem: Add support for Quectel EM160R-GL (#57) 2025-06-11 10:41:01 +08:00
30 changed files with 1392 additions and 316 deletions

View File

@ -0,0 +1,44 @@
name: "Update Support List"
on:
push:
branches:
- 'main'
# only run when "luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json" is changed
paths:
- 'luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json'
env:
TZ: Asia/Shanghai
jobs:
update_support_list:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
env:
GH_TOKEN: ${{ github.token }}
branch_name: ${{ github.ref_name }}
with:
path: 'qmodem'
- name: Update Modem_support_list
id: update_modem_support_list
run: |
cd qmodem
is_json_invalid=0
is_diff=0
python3 ./scripts/update_support_list.py temp_support_list ./luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json || is_json_invalid=1
diff ./temp_support_list.md ./docs/support_list.md -u > /tmp/file_diff.txt || is_diff=1
if [ "$is_json_invalid" == "1" ];then
exit 1
fi
if [ "$is_diff" == "1" ];then
mv temp_support_list.md ./docs/support_list.md
git config --global user.name "GitHub Action"
git config --global user.email "github-action@users.noreply.github.com"
git add ./docs/support_list.md
git commit -m "Update support list"
git push origin ${{ env.branch_name }}
fi

View File

@ -55,21 +55,11 @@ jobs:
with:
path: 'qmodem'
- name: Update Modem_support_list
- name: Generate Release Note
id: update_modem_support_list
run: |
cd qmodem
python3 ./scripts/update_support_list.py temp_support_list ./luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json
is_diff=$(diff ./temp_support_list.md ./docs/support_list.md > /dev/null 2>&1 && echo 0 || echo 1)
echo "is_diff=${is_diff}" >> $GITHUB_ENV
if [[ ${is_pr} == 0 ]] && [[ ${is_diff} == 1 ]]; then
mv temp_support_list.md ./docs/support_list.md
git config --global user.name "GitHub Action"
git config --global user.email "github-action@users.noreply.github.com"
git add ./docs/support_list.md
git commit -m "Update support list"
git push origin ${{ env.branch_name }}
fi
mv temp_support_list_release_notes.md ./release_note.md
- name: Upload Release Note

View File

@ -0,0 +1,77 @@
name: "PR Update Support List"
on:
pull_request:
# only run when "luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json" is changed
paths:
- 'luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json'
env:
TZ: Asia/Shanghai
jobs:
update_support_list:
runs-on: ubuntu-latest
steps:
- name: Checkout PR Branch
uses: actions/checkout@v2
with:
path: 'pr_branch'
- name: Checkout Base Branch
uses: actions/checkout@v2
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.base.ref }}
path: 'base_branch'
- name: Update Support List and Check
id: update_modem_support_list
env:
GH_TOKEN: ${{ github.token }}
run: |
cd pr_branch
is_json_invalid=0
python3 ./scripts/update_support_list.py temp_support_list ./luci/luci-app-qmodem/root/usr/share/qmodem/modem_support.json || is_json_invalid=1
if [ "$is_json_invalid" = "1" ]; then
echo "pr_close=1" >> $GITHUB_OUTPUT
echo "The JSON file is invalid, please check" >> pr_comment.txt
exit 0
fi
# Compare with base branch support_list.md
is_diff=0
if ! diff ./temp_support_list.md ../base_branch/docs/support_list.md > /dev/null 2>&1; then
is_diff=1
fi
# Generate pr_comment.txt for comment
echo '```' > ./pr_comment.txt
diff -u ./temp_support_list.md ../base_branch/docs/support_list.md >> ./pr_comment.txt || true
echo '```' >> ./pr_comment.txt
if [ "$is_diff" = "1" ]; then
echo "The support list has been updated, please check the changes" >> ./pr_comment.txt
echo "pr_close=0" >> $GITHUB_OUTPUT
echo "has_diff=1" >> $GITHUB_OUTPUT
else
echo "No changes in the support list" >> ./pr_comment.txt
echo "pr_close=0" >> $GITHUB_OUTPUT
echo "has_diff=0" >> $GITHUB_OUTPUT
fi
- name: Close PR if JSON Invalid
if: steps.update_modem_support_list.outputs.pr_close == '1'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd base_branch
gh pr comment ${{ github.event.pull_request.number }} -F ../pr_branch/pr_comment.txt
gh pr close ${{ github.event.pull_request.number }}
- name: Comment on PR if JSON Valid
if: steps.update_modem_support_list.outputs.pr_close == '0'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd base_branch
gh pr comment ${{ github.event.pull_request.number }} -F ../pr_branch/pr_comment.txt

View File

@ -1,3 +1,22 @@
# 舔狗计划
最近刚追到高中时期的白月光✨,脑子里全是和妹妹聊天的剧本📖。
工作基本停摆了,游戏也卸了,连熬夜刷剧都不敢了,怕眼圈太黑影响形象👀。
等我谈稳定了👫,再说要不要恢复正常更新!
为了追🌸白月光🌸MD硬生生变成了情感专家、聊天达人、朋友圈文案大师📱
无知时尬聊白月光😅🙇‍♂️
成熟时读懂白月光🤔🙇‍♂️
恋爱时融化白月光🥰🙇‍♂️
白月光助我!喝咩!👋青春永驻!
任何尴尬:终将被绝妙话术化解🧙‍♂️!
因此我[FuJr](https://github.com/FUjr)将暂停更新一段时间📵,所有新内容暂时停更,项目进度也会放缓。
等我谈稳定了👫,再回来和大家分享我的舔狗成功学📖!
感谢理解,祝大家都能追到自己的白月光✨!
白月光,启动!
# QModem
[![Auto compile with OpenWrt SDK](https://github.com/FUjr/modem_feeds/actions/workflows/main.yml/badge.svg)](https://github.com/FUjr/modem_feeds/actions/workflows/main.yml)

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,9 +28,7 @@ define Build/Prepare
$(CP) src/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS)"
endef

View File

@ -1,3 +1,10 @@
# huawei
Model | Platform | USB | PCIe
--- | --- | --- | ---
s10 | hisilicon |✔ usb(rndis) | ✘
mt5700m-cn | hisilicon |✔ usb(ecm,ncm) | ✘
mh5000-31 | hisilicon |✔ usb(ecm) | ✘
# quectel
Model | Platform | USB | PCIe
--- | --- | --- | ---
@ -5,13 +12,14 @@ em05 | lte |✔ usb(qmi,ecm,mbim,rndis) | ✘
ep06 | lte |✔ usb(qmi,ecm,mbim,rndis) | ✘
em12 | lte |✔ usb(qmi,ecm,mbim,rndis) | ✘
em120k | lte12 |✔ usb(qmi,ecm,mbim,rndis) | ✘
em160r-gl | lte12 |✔ usb(qmi,ecm,mbim,rndis) | ✘
rg200u-cn | unisoc |✔ usb(ecm,mbim,rndis,ncm) | ✘
rg801 | hisilicon |✔ usb(ecm,rndis,ncm) | ✘
rm500u-cn | unisoc |✔ usb(ecm,mbim,rndis,ncm) | ✘
rm500u-ea | unisoc |✔ usb(ecm,mbim,rndis,ncm) | ✘
rm500s-ce | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm500q-cn | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm510q-gl | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) |
rm510q-gl | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm510q-glha | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
rg500q-ea | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm500q-ae | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
@ -27,18 +35,13 @@ rg501q-eu | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gob
rg520n-eu | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
mh8001-eu | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rg520f-eb | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rg520f-jo | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rg530f-na | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
ec20f | lte |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
ec25 | lte |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
ec21 | lte |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
ec200a | lte |✔ usb(ecm,mbim,rndis,ncm) | ✘
# huawei
Model | Platform | USB | PCIe
--- | --- | --- | ---
mt5700m-cn | hisilicon |✔ usb(ecm,ncm) | ✘
mh5000-31 | hisilicon |✔ usb(ecm) | ✘
# fibocom
Model | Platform | USB | PCIe
--- | --- | --- | ---
@ -67,6 +70,11 @@ Model | Platform | USB | PCIe
--- | --- | --- | ---
em9190 | qualcomm |✔ usb(mbim,rmnet) | ✔ pcie(mbim,rmnet)
# telit
Model | Platform | USB | PCIe
--- | --- | --- | ---
fn990a40 | qualcomm |✔ usb(mbim,rndis,qmi,ecm) | ✔ pcie(mbim,qmi)
# simcom
Model | Platform | USB | PCIe
--- | --- | --- | ---

View File

@ -208,7 +208,7 @@ static void qmap_hex_dump(const char *tag, unsigned char *data, unsigned len) {
#define MBIM_MUX_ID_SDX7X 112 //sdx7x is 112-126, others is 0-14
static uint __read_mostly mhi_mbim_enabled = 1;
static uint __read_mostly mhi_mbim_enabled = 0;
module_param(mhi_mbim_enabled, uint, S_IRUGO);
int mhi_netdev_mbin_enabled(void) { return mhi_mbim_enabled; }

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem
LUCI_TITLE:=LuCI support for QWRT Modem
LUCI_PKGARCH:=all
PKG_VERSION:=2.8.0
PKG_VERSION:=2.8.1
PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
@ -32,9 +32,10 @@ LUCI_DEPENDS:=+luci-compat \
+PACKAGE_luci-app-qmodem_USE_TOM_CUSTOMIZED_QUECTEL_CM:quectel-CM-5G-M \
+PACKAGE_luci-app-qmodem_USING_QWRT_QUECTEL_CM_5G:quectel-CM-5G \
+PACKAGE_luci-app-qmodem_USING_NORMAL_QUECTEL_CM:quectel-cm \
+tom_modem \
+tom_modem +terminfo \
+jq +bc\
+coreutils +coreutils-stat
+coreutils +coreutils-stat \
+ndisc6
define Package/luci-app-qmodem/conffiles
/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.default = "0"
-- 350 v4/v6存活检查
mtk_check = s:taboption("advanced", Flag, "mtk_check", translate("MTK V4/V6 Check"))
mtk_check.description = translate("Only for Fibocom MTK modem.")
mtk_check.default = "0"
-- Connect Check
connect_check = s:taboption("advanced", Flag, "connect_check", translate("V4/V6 Connect Check"))
connect_check.description = translate("Only for AT dial modem.")
connect_check.default = "0"
-- 网络类型
pdp_type= s:taboption("advanced", ListValue, "pdp_type", translate("PDP Type"))

View File

@ -6,7 +6,8 @@ return {
fibocom = "Fibocom",
meig = "Meig",
huawei = "Huawei",
neoway = "Neoway"
neoway = "Neoway",
telit = "Telit"
},
platforms = {
lte = "LTE",

View File

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

View File

@ -628,9 +628,6 @@ msgstr "制造商"
msgid "Quectel"
msgstr "移远"
msgid "Simcom"
msgstr "芯讯通Simcom"
msgid "Sierra Wireless"
msgstr "Sierra无线"
@ -640,6 +637,12 @@ msgstr "广和通"
msgid "Meig"
msgstr "美格"
msgid "Neoway"
msgstr "有方"
msgid "Telit"
msgstr "泰利特"
msgid "Platform"
msgstr "平台"

View File

@ -662,6 +662,9 @@ msgstr "美格"
msgid "Neoway"
msgstr "有方"
msgid "Telit"
msgstr "泰利特"
msgid "Platform"
msgstr "平台"
@ -852,8 +855,8 @@ msgstr "(仍在测试中)"
msgid "beta"
msgstr "(测试)"
msgid "MTK V4/V6 Check"
msgstr "MTK V4/V6 存活检测"
msgid "V4/V6 Connect Check"
msgstr "V4/V6 存活检测"
msgid "Only for Fibocom MTK modem."
msgstr "只适用于广和通MTK模组。"
msgid "Only for AT dial modem."
msgstr "只适用于AT拨号模组。"

View File

@ -646,9 +646,6 @@ msgstr "制造商"
msgid "Quectel"
msgstr "移远"
msgid "Simcom"
msgstr "芯讯通Simcom"
msgid "Sierra Wireless"
msgstr "Sierra无线"
@ -658,6 +655,12 @@ msgstr "广和通"
msgid "Meig"
msgstr "美格"
msgid "Neoway"
msgstr "有方"
msgid "Telit"
msgstr "泰利特"
msgid "Platform"
msgstr "平台"
@ -848,8 +851,8 @@ msgstr "(仍在测试中)"
msgid "beta"
msgstr "(测试)"
msgid "MTK V4/V6 Check"
msgstr "MTK V4/V6 存活检测"
msgid "V4/V6 Connect Check"
msgstr "V4/V6 存活检测"
msgid "Only for Fibocom MTK modem."
msgstr "只适用于广和通MTK模组。"
msgid "Only for AT dial modem."
msgstr "只适用于AT拨号模组。"

View File

@ -92,7 +92,7 @@ get_at_cfg(){
# Determine language and select appropriate AT commands file
lang=$(uci get luci.main.lang 2>/dev/null || echo "en")
case "$lang" in
zh*|cn)
zh*|cn|auto)
at_commands_file="/usr/share/qmodem/at_commands_zh.json"
;;
*)

View File

@ -114,7 +114,7 @@ update_config()
config_get en_bridge $modem_config en_bridge
config_get do_not_add_dns $modem_config do_not_add_dns
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 ethernet_5g u$modem_config ethernet 转往口获取命令更新,待测试
config_foreach get_associate_ethernet_by_path modem-slot
@ -266,7 +266,7 @@ check_ip()
"neoway")
case $platform in
"unisoc")
check_ip_command='AT$MYUSBNETACT?'
check_ip_command="AT+CGPADDR=1"
;;
esac
;;
@ -280,9 +280,6 @@ check_ip()
local config=$(umbim -d $mbim_port config)
ipaddr=$(echo "$config" | grep "ipv4address:" | 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
ipaddr=$(at "$at_port" "$check_ip_command" | grep +CGPADDR:)
fi
@ -315,10 +312,10 @@ check_ip()
fi
}
check_mtk_connection()
check_connection()
{
[ "$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
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
@ -331,18 +328,9 @@ check_mtk_connection()
sleep 1
done
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
for i in 1 2; do
if ping6 -I "$modem_netcard" -w 1 2400:3200::1 >/dev/null 2>&1 ||
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
if [ "$ifup_time" -gt 5 ] && [ "$pdp_type" = "ipv4v6" ]; then
rdisc6 $origin_device &
ndisc6 fe80::1 $origin_device &
fi
fi
return 0
@ -660,14 +648,15 @@ ecm_hang()
at_command="AT^NDISDUP=0,0"
;;
"neoway")
delay=3
at_command='AT$MYUSBNETACT=0,0'
;;
*)
at_command="ATI"
;;
esac
fastat "${at_port}" "${at_command}"
[ -n "$delay" ] && sleep "$delay"
}
hang()
@ -819,7 +808,7 @@ at_dial()
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;;
"mediatek")
mtk=1
delay=3
if [ "$apn" = "auto" ];then
apn="cbnet"
fi
@ -859,8 +848,12 @@ at_dial()
at_command='AT$MYUSBNETACT=0,1'
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;;
"unisoc")
at_command=""
esac
;;
"telit")
case $platform in
"qualcomm")
at_command="AT#ICMAUTOCONN=1,1"
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;;
esac
@ -869,7 +862,7 @@ at_dial()
m_debug "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command ; $at_command"
at "${at_port}" "${cgdcont_command}"
fastat "$at_port" "$at_command"
[ "$mtk" -eq 1 ] && sleep 2
[ -n "$delay" ] && sleep "$delay"
if [ "$driver" = "mtk_pcie" ];then
fastat "$at_port" "AT+CGACT=0,3"
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
@ -1058,7 +1051,7 @@ at_dial_monitor()
ipv4_cache=$ipv4
ipv6_cache=$ipv6
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
check_logfile_line

View File

@ -9,8 +9,6 @@ debug_subject="modem_scan"
source /lib/functions.sh
source /usr/share/qmodem/modem_util.sh
exec_post_init()
{
section_name=$1
@ -295,7 +293,7 @@ scan_usb_slot_interfaces()
;;
qmi_wwan*|\
cdc_mbim|\
cdc_ncm|\
*cdc_ncm|\
cdc_ether|\
rndis_host)
net_path="$slot_path/$interface/net"
@ -318,7 +316,7 @@ validate_at_port()
[ ! -e "$dev_path" ] && continue
res=$(fastat $dev_path "ATI")
[ -z "$res" ] && continue
[[ "$res" != *"OK"* ]] && continue
!(echo "$res" | grep -qE 'OK') && continue
valid_at_port="$at_port"
[ -z "$valid_at_ports" ] && valid_at_ports="$valid_at_port" || valid_at_ports="$valid_at_ports $valid_at_port"
done
@ -384,13 +382,15 @@ get_modem_model()
name_1=$(echo -e "$cgmm" |grep "+CGMM: " | awk -F': ' '{print $2}')
name_2=$(echo -e "$cgmm_1" |grep "+CGMM: " | awk -F'"' '{print $2} '| cut -d ' ' -f 1)
name_3=$(echo -e "$cgmm" | sed -n '2p')
name_4=$(echo -e "$cgmm" |grep "+CGMM: " | awk -F'"' '{print $2} '| cut -d ' ' -f 1)
name_4=$(echo -e "$cgmm" | sed -n '3p')
name_5=$(echo -e "$cgmm" |grep "+CGMM: " | awk -F'"' '{print $2} '| cut -d ' ' -f 1)
modem_name=""
[ -n "$name_1" ] && match_config "$name_1"
[ -n "$name_2" ] && [ -z "$modem_name" ] && match_config "$name_2"
[ -n "$name_3" ] && [ -z "$modem_name" ] && match_config "$name_3"
[ -n "$name_4" ] && [ -z "$modem_name" ] && match_config "$name_4"
[ -n "$name_5" ] && [ -z "$modem_name" ] && match_config "$name_5"
[ -z "$modem_name" ] && return 1
return 0
}

View File

@ -1,6 +1,20 @@
{
"modem_support": {
"usb": {
"s10": {
"manufacturer_id": "12dc",
"manufacturer": "huawei",
"platform": "hisilicon",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/2/4/5/6/8/19",
"lte_band": "1/2/3/4/5/7/8/12/13/14/18/19/20/25/26/28/66/71/38/39/40/41/66/71",
"nsa_band": "0",
"sa_band": "0",
"modes": [
"rndis"
]
},
"em05": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
@ -69,6 +83,23 @@
"rndis"
]
},
"em160r-gl": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
"platform": "lte12",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/2/3/4/5/6/8/19",
"lte_band": "1/2/3/4/5/7/8/12/13/14/17/18/19/20/25/26/28/29/30/32/34/38/39/40/41/42/43/46/48/66",
"nsa_band": "0",
"sa_band": "0",
"modes": [
"qmi",
"ecm",
"mbim",
"rndis"
]
},
"mt5700m-cn": {
"manufacturer_id": "3466",
"manufacturer": "huawei",
@ -503,6 +534,25 @@
"ncm"
]
},
"rg520f-jo": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
"platform": "qualcomm",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "0",
"lte_band": "0",
"nsa_band": "0",
"sa_band": "78",
"modes": [
"qmi",
"gobinet",
"ecm",
"mbim",
"rndis",
"ncm"
]
},
"rg530f-na": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
@ -765,6 +815,19 @@
"rmnet"
]
},
"fn990a40": {
"manufacturer_id": "1bc7",
"manufacturer": "telit",
"platform": "qualcomm",
"data_interface": "usb",
"define_connect": "1",
"modes": [
"mbim",
"rndis",
"qmi",
"ecm"
]
},
"simcom_d8200g": {
"manufacturer_id": "1a0e",
"manufacturer": "simcom",
@ -854,6 +917,21 @@
}
},
"pcie": {
"rm510q-gl": {
"manufacturer": "quectel",
"platform": "qualcomm",
"data_interface": "pcie",
"define_connect": "1",
"wcdma_band": "1/2/3/4/5/6/8/19",
"lte_band": "1/2/3/4/5/7/8/12/13/14/17/18/19/20/25/26/28/29/30/32/34/38/39/40/41/42/43/46/48/66/71",
"nsa_band": "1/2/3/5/7/8/12/20/25/28/38/40/41/48/66/71/77/78/79/257/258/260/261",
"sa_band": "1/2/3/5/7/8/12/20/25/28/38/40/41/48/66/71/77/78/79/257/258/260/261",
"modes": [
"qmi",
"gobinet",
"mbim"
]
},
"rm500s-ce": {
"manufacturer": "quectel",
"platform": "qualcomm",
@ -1097,6 +1175,21 @@
"mbim"
]
},
"rg520f-jo": {
"manufacturer": "quectel",
"platform": "qualcomm",
"data_interface": "pcie",
"define_connect": "1",
"wcdma_band": "0",
"lte_band": "0",
"nsa_band": "0",
"sa_band": "78",
"modes": [
"qmi",
"gobinet",
"mbim"
]
},
"rg530f-na": {
"manufacturer": "quectel",
"platform": "qualcomm",
@ -1167,6 +1260,16 @@
"mbim",
"rmnet"
]
},
"fn990a40": {
"manufacturer": "telit",
"platform": "qualcomm",
"data_interface": "usb",
"define_connect": "1",
"modes": [
"mbim",
"qmi"
]
}
},
"device": {
@ -1354,6 +1457,16 @@
"3c93"
]
}
},
"telit": {
"qualcomm": {
"vendor_id": [
"1bc7"
],
"product_id": [
"1075"
]
}
}
}
}

View File

@ -162,6 +162,23 @@ at_get_slot()
;;
esac
;;
"telit")
at_res=$(at $at_port AT#QSS? | grep "#QSS:" | awk -F',' '{print $3}' | sed 's/\r//g')
case $at_res in
"0")
sim_slot="1"
;;
"1")
sim_slot="2"
;;
*)
sim_slot="1"
;;
*)
sim_slot="1"
;;
esac
;;
*)
at_q_res=$(at $at_port AT+QSIMDET? |grep +QSIMDET: |awk -F: '{print $2}')
at_f_res=$(at $at_port AT+GTDUALSIM? |grep +GTDUALSIM: |awk -F: '{print $2}')

View File

@ -7,5 +7,6 @@
"simcom" : "simcom.sh",
"huawei" : "huawei.sh",
"foxconn" : "foxconn.sh",
"neoway" : "neoway.sh"
"neoway" : "neoway.sh",
"telit" : "telit.sh"
}

View File

@ -1295,9 +1295,9 @@ cell_info()
add_plain_info_entry "DL Bandwidth" "${nr_dl_bandwidth}M" "DL Bandwidth"
fi
add_plain_info_entry "UL Bandwidth" "${nr_ul_bandwidth}M" "UL Bandwidth"
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_bar_info_entry "RxLev" "$nr_rxlev" "Received Signal Level" -140 -20 dBm
add_plain_info_entry "SCS" "$nr_scs" "SCS"
add_plain_info_entry "Srxlev" "$nr_srxlev" "Serving Cell Receive Level"
@ -1316,9 +1316,9 @@ cell_info()
add_plain_info_entry "DL Bandwidth" "$endc_lte_dl_bandwidth" "DL Bandwidth"
add_plain_info_entry "TAC" "$endc_lte_tac" "Tracking area code of cell served by neighbor Enb"
add_bar_info_entry "RSRP" "$endc_lte_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$endc_lte_rsrq" "Reference Signal Received Quality" -20 20 dBm
add_bar_info_entry "RSSI" "$endc_lte_rssi" "Received Signal Strength Indicator" -140 -44 dBm
add_bar_info_entry "SINR" "$endc_lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRQ" "$endc_lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$endc_lte_rssi" "Received Signal Strength Indicator" -120 -20 dBm
add_bar_info_entry "SINR" "$endc_lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "RxLev" "$endc_lte_rxlev" "Received Signal Level"
add_plain_info_entry "RSSNR" "$endc_lte_rssnr" "Radio Signal Strength Noise Ratio"
add_plain_info_entry "CQI" "$endc_lte_cql" "Channel Quality Indicator"
@ -1331,9 +1331,9 @@ cell_info()
add_plain_info_entry "ARFCN" "$endc_nr_arfcn" "Absolute Radio-Frequency Channel Number"
add_plain_info_entry "Band" "$endc_nr_band" "Band"
add_plain_info_entry "DL Bandwidth" "$endc_nr_dl_bandwidth" "DL Bandwidth"
add_bar_info_entry "RSRP" "$endc_nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
add_bar_info_entry "RSRQ" "$endc_nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
add_bar_info_entry "SINR" "$endc_nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRP" "$endc_nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$endc_nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$endc_nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "SCS" "$endc_nr_scs" "SCS"
;;
@ -1350,9 +1350,9 @@ cell_info()
add_plain_info_entry "DL Bandwidth" "$lte_dl_bandwidth" "DL Bandwidth"
add_plain_info_entry "TAC" "$lte_tac" "Tracking area code of cell served by neighbor Enb"
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 "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -140 -44 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -120 -20 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "RxLev" "$lte_rxlev" "Received Signal Level"
add_plain_info_entry "RSSNR" "$lte_rssnr" "Radio Signal Strength Noise Ratio"
add_plain_info_entry "CQI" "$lte_cql" "Channel Quality Indicator"

View File

@ -1,8 +1,10 @@
#!/bin/sh
# Copyright (C) 2025 x-shark
_Vendor="foxconn"
_Author="x-shark"
_Maintainer="x-shark <unknown>"
source /usr/share/qmodem/generic.sh
debug_subject="quectel_ctrl"
debug_subject="foxconn_ctrl"
name=$(uci -q get qmodem.$config_section.name)
case "$name" in
@ -527,6 +529,24 @@ function _band_list_to_mask()
echo "$low,$high"
}
function process_signal_value() {
local value="$1"
local numbers=$(echo "$value" | grep -oE '[-+]?[0-9]+(\.[0-9]+)?')
local count=0
local total=0
for num in $numbers; do
total=$(echo "$total + $num" | bc -l)
count=$((count+1))
done
if [ $count -gt 0 ]; then
echo "scale=2; $total / $count" | bc -l | sed 's/^\./0./' | sed 's/^-\./-0./'
else
echo ""
fi
}
cell_info(){
class="Cell Information"
at_command=$at_pre"debug?"
@ -543,10 +563,12 @@ cell_info(){
lte_cell_id=$(echo "$response"|awk -F'lte_cell_id:' '{print $2}'|xargs)
lte_band=$(echo "$response"|awk -F'lte_band:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
lte_freq_band_ind=$(echo "$response"|awk -F'lte_band_width:' '{print $2}'|xargs)
lte_sinr=$(echo "$response"|awk -F'lte_snr:' '{print $2}'|awk '{print $1}'|sed -n 's/[^0-9.-]*\([+-]*[0-9]*\.[0-9]*\)[^0-9.-]*/\1/p'|xargs)
lte_rsrq=$(echo "$response"|awk -F'rsrq:' '{print $2}'|sed -n 's/[^0-9.-]*\([+-]*[0-9]*\.[0-9]*\)[^0-9.-]*/\1/p'|xargs)
lte_rssi=$(echo "$response"|awk -F'lte_rssi:' '{print $2}'|awk -F',' '{print $1}'|sed -n 's/[^0-9.-]*\([+-]*[0-9]*\.[0-9]*\)[^0-9.-]*/\1/p'|xargs)
#lte_rssnr=$(echo "$response"|
lte_sinr=$(echo "$response"|awk -F'lte_snr:' '{print $2}'|awk '{print $1}'|xargs)
lte_sinr=$(process_signal_value "$lte_sinr")
lte_rsrq=$(echo "$response"|awk -F'rsrq:' '{print $2}'|xargs)
lte_rsrq=$(process_signal_value "$lte_rsrq")
lte_rssi=$(echo "$response"|awk -F'lte_rssi:' '{print $2}'|awk -F',' '{print $1}'|xargs)
lte_rssi=$(process_signal_value "$lte_rssi")
lte_tac=$(echo "$response"|awk -F'lte_tac:' '{print $2}'|xargs)
lte_tx_power=$(echo "$response"|awk -F'lte_tx_pwr:' '{print $2}'|xargs)
@ -561,9 +583,9 @@ cell_info(){
#add_plain_info_entry "UL Bandwidth" "$lte_ul_bandwidth" "UL Bandwidth"
#add_plain_info_entry "DL Bandwidth" "$lte_dl_bandwidth" "DL Bandwidth"
add_plain_info_entry "TAC" "$lte_tac" "Tracking area code of cell served by neighbor Enb"
add_bar_info_entry "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -20 20 dBm
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -120 -44 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -120 -20 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
#add_plain_info_entry "RxLev" "$lte_rxlev" "Received Signal Level"
add_plain_info_entry "RSSNR" "$lte_rssnr" "Radio Signal Strength Noise Ratio"
#add_plain_info_entry "CQI" "$lte_cql" "Channel Quality Indicator"
@ -583,10 +605,15 @@ cell_info(){
nr_band_width=$(echo "$response"|awk -F'nr_band_width:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
nr_freq_band_ind=$(echo "$response"|awk -F'lte_band_width:' '{print $2}'|xargs)
nr_sinr=$(echo "$response"|awk -F'nr_snr:' '{print $2}'|awk '{print $1}'|xargs)
nr_sinr=$(process_signal_value "$nr_sinr")
nr_rsrq=$(echo "$response"|awk -F'rsrq:' '{print $2}'|xargs)
nr_rsrq=$(process_signal_value "$nr_rsrq")
nr_rsrp=$(echo "$response"|awk -F'rsrp:' '{print $2}'|awk '{print $1}'|xargs)
nr_rsrp=$(process_signal_value "$nr_rsrp")
nr_rssi=$(echo "$response"|awk -F'nr_rssi:' '{print $2}'|awk -F',' '{print $1}'|xargs)
nr_rssi=$(process_signal_value "$nr_rssi")
nr_tac=$(echo "$response"|awk -F'nr_tac:' '{print $2}'|xargs)
nr_tx_power=$(echo "$response"|awk -F'nr_tx_pwr:' '{print $2}'|xargs)
if [ "$has_ca" -gt 0 ]; then
nr_display_mode="NR5G_SA-CA"
@ -609,10 +636,9 @@ cell_info(){
add_plain_info_entry "EARFCN" "$nr_earfcn" "E-UTRA Absolute Radio Frequency Channel Number"
add_plain_info_entry "Freq band indicator" "$nr_freq_band_ind" "Freq band indicator"
add_plain_info_entry "TAC" "$nr_tac" "Tracking area code of cell served by neighbor Enb"
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_plain_info_entry "RSSNR" "$nr_rssnr" "Radio Signal Strength Noise Ratio"
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "TX Power" "$nr_tx_power" "TX Power"
;;
esac

View File

@ -24,18 +24,13 @@ function get_mode(){
cfg=$(at $at_port "AT^SETMODE?")
local mode_num=`echo -e "$cfg" | sed -n '2p' | sed 's/\r//g'`
if [ -z "$mode_num" ]; then
echo "unknown"
return
fi
case "$mode_num" in
"0"|"2") mode="ecm" ;;
"1"|"3"|"4"|"5") mode="ncm" ;;
"6") mode="rndis" ;;
"7") mode="mbim" ;;
"8") mode="ppp" ;;
*) mode="$mode_num" ;;
*) mode="rndis" ;;
esac
available_modes=$(uci -q get qmodem.$config_section.modes)
@ -631,30 +626,16 @@ for line in $data;do
continue
;;
*SINR*)
add_bar_info_entry "SINR" "$value" "$key" -23 40 dB
add_bar_info_entry "SINR" "$value" "$key" 0 30 dB
;;
*RSRP*)
case $key in
*NR5G*)
add_bar_info_entry "NR5G RSRP" "$value" "$key" -187 -29 dBm
;;
*)
add_bar_info_entry "RSRP" "$value" "$key" -140 -44 dBm
;;
esac
;;
*RSRQ*)
case $key in
*NR5G*)
add_bar_info_entry "NR5G RSRQ" "$value" "$key" -43 20 dBm
;;
*)
add_bar_info_entry "RSRQ" "$value" "$key" -20 20 dBm
;;
esac
add_bar_info_entry "RSRQ" "$value" "$key" -19.5 -3 dB
;;
*RSSI*)
add_bar_info_entry "RSSI" "$value" "$key" -140 -44 dBm
add_bar_info_entry "RSSI" "$value" "$key" -120 -20 dBm
;;
*)
add_plain_info_entry $key $value $key

View File

@ -567,9 +567,9 @@ cell_info()
add_plain_info_entry "TAC" "$nr_tac" "Tracking area code"
add_plain_info_entry "Band" "$nr_band" "Band"
add_plain_info_entry "DL Bandwidth" "$nr_dl_bandwidth" "DL Bandwidth"
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio" -23 40 dB
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio" 0 30 dB
add_plain_info_entry "SCS" "$nr_scs" "SCS"
;;
"EN-DC Mode")
@ -584,8 +584,8 @@ cell_info()
add_plain_info_entry "UL Bandwidth" "$endc_lte_ul_bandwidth" "UL Bandwidth"
add_plain_info_entry "DL Bandwidth" "$endc_lte_dl_bandwidth" "DL Bandwidth"
add_bar_info_entry "RSRP" "$endc_lte_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$endc_lte_rsrq" "Reference Signal Received Quality" -20 20 dBm
add_bar_info_entry "SINR" "$endc_lte_sinr" "Signal to Interference plus Noise Ratio" -23 40 dB
add_bar_info_entry "RSRQ" "$endc_lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$endc_lte_sinr" "Signal to Interference plus Noise Ratio" 0 30 dB
add_plain_info_entry "TX Power" "$endc_lte_tx_power" "TX Power"
if [ -n "$endc_nr_physical_cell_id" ] || [ -n "$endc_nr_band" ]; then
add_plain_info_entry "NR5G-NSA" "NR5G-NSA" ""
@ -594,9 +594,9 @@ cell_info()
[ -n "$endc_nr_physical_cell_id" ] && add_plain_info_entry "Physical Cell ID" "$endc_nr_physical_cell_id" "Physical Cell ID"
[ -n "$endc_nr_band" ] && add_plain_info_entry "Band" "$endc_nr_band" "Band"
[ -n "$endc_nr_dl_bandwidth" ] && add_plain_info_entry "DL Bandwidth" "$endc_nr_dl_bandwidth" "DL Bandwidth"
[ -n "$endc_nr_rsrp" ] && add_bar_info_entry "RSRP" "$endc_nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
[ -n "$endc_nr_rsrq" ] && add_bar_info_entry "RSRQ" "$endc_nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
[ -n "$endc_nr_sinr" ] && add_bar_info_entry "SINR" "$endc_nr_sinr" "Signal to Interference plus Noise Ratio" -23 40 dB
[ -n "$endc_nr_rsrp" ] && add_bar_info_entry "RSRP" "$endc_nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
[ -n "$endc_nr_rsrq" ] && add_bar_info_entry "RSRQ" "$endc_nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
[ -n "$endc_nr_sinr" ] && add_bar_info_entry "SINR" "$endc_nr_sinr" "Signal to Interference plus Noise Ratio" 0 30 dB
[ -n "$endc_nr_scs" ] && add_plain_info_entry "SCS" "$endc_nr_scs" "SCS"
fi
;;
@ -611,8 +611,8 @@ cell_info()
add_plain_info_entry "UL Bandwidth" "$lte_ul_bandwidth" "UL Bandwidth"
add_plain_info_entry "DL Bandwidth" "$lte_dl_bandwidth" "DL Bandwidth"
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 "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio" -23 40 dB
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" 0 30 dB
[ -n "$lte_tx_power" ] && add_plain_info_entry "TX Power" "$lte_tx_power" "TX Power"
;;
"WCDMA Mode")

View File

@ -1,17 +1,32 @@
#!/bin/sh
# Copyright (C) 2025 Fujr <fjrcn@outlook.com>
# Copyright (C) 2025 sfwtw
_Vendor="neoway"
_Author="Fujr"
_Maintainer="Fujr <fjrcn@outlook.com>"
_Author="sfwtw"
_Maintainer="sfwtw <unknown>"
source /usr/share/qmodem/generic.sh
debug_subject="neoway_ctrl"
vendor_get_disabled_features(){
json_add_string "" "NeighborCell"
json_add_string "" "IMEI"
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串口
get_network_prefer()
@ -218,6 +233,30 @@ sim_info()
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()
{
@ -240,8 +279,8 @@ network_info()
ambr_ul=$(echo "$response" | awk -F',' '{print $8}' | sed 's/\r//g')
# 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_ul" ] && ambr_ul=$(awk "BEGIN { printf \"%.2f\", $ambr_ul/1000 }")
[ -n "$ambr_dl" ] && ambr_dl=$(rate_convert $ambr_dl)
[ -n "$ambr_ul" ] && ambr_ul=$(rate_convert $ambr_ul)
fi
class="Network Information"
@ -527,7 +566,6 @@ cell_info()
response=$(at $at_port $at_command)
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')
network_mode=$(get_network_mode "$net_mode")
@ -536,31 +574,24 @@ cell_info()
mcc=$(echo "$mcc_mnc" | cut -d'+' -f1)
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
"NR to 5GCN"|"NR to EPS"|"NR-LTE ENDC"|"NR-LTE NEDC")
gnbid=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $5}')
pci=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $6}')
ss_rsrp=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $7}')
ss_rsrq=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $8}')
ss_sinr=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $9}')
gnbid=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $5}' | sed 's/\r//g')
pci=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $6}' | sed 's/\r//g')
ss_rsrp=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $7}' | sed 's/\r//g')
ss_rsrq=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $8}' | sed 's/\r//g')
ss_sinr=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $9}' | sed 's/\r//g')
if [ "$(echo "$response" | grep -o ',' | wc -l)" -ge 12 ]; then
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=$(printf "%.1f" $(echo "$ss_rsrp / 10" | bc -l 2>/dev/null))
[ -n "$ss_rsrp" ] && ss_rsrp_actual=$(awk "BEGIN { printf \"%.1f\", $ss_rsrp/10 }")
[ -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 "$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 }")
[ -n "$ss_rsrq" ] && ss_rsrq_actual=$(printf "%.1f" $(echo "$ss_rsrq / 10" | bc -l 2>/dev/null))
[ -n "$ss_sinr" ] && ss_sinr_actual=$(printf "%.1f" $(echo "$ss_sinr / 10" | bc -l 2>/dev/null))
network_mode="NR5G-SA Mode"
nr_mcc="$mcc"
@ -587,9 +618,6 @@ cell_info()
rssi=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $13}')
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}')
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")
fi
[ -n "$rsrp" ] && rsrp_actual=$(awk "BEGIN { printf \"%.1f\", $rsrp/10 }")
[ -n "$rsrq" ] && rsrq_actual=$(awk "BEGIN { printf \"%.1f\", $rsrq/10 }")
[ -n "$sinr" ] && sinr_actual=$(awk "BEGIN { printf \"%.1f\", $sinr/10 }")
[ -n "$rssi" ] && rssi_actual=$(awk "BEGIN { printf \"%.1f\", $rssi/10 }")
[ -n "$rsrp" ] && rsrp_actual=$(printf "%.1f" $(echo "$rsrp / 10" | bc -l 2>/dev/null))
[ -n "$rsrq" ] && rsrq_actual=$(printf "%.1f" $(echo "$rsrq / 10" | bc -l 2>/dev/null))
[ -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"
lte_mcc="$mcc"
@ -647,8 +678,9 @@ cell_info()
slot=$(get_slot "$slot_num")
fi
[ -n "$rscp" ] && rscp_actual=$(awk "BEGIN { printf \"%.1f\", $rscp/10 }")
[ -n "$ecio" ] && ecio_actual=$(awk "BEGIN { printf \"%.1f\", $ecio/10 }")
[ -n "$rscp" ] && rscp_actual=$(printf "%.1f" $(echo "$rscp / 10" | bc -l 2>/dev/null))
[ -n "$ecio" ] && ecio_actual=$(printf "%.1f" $(echo "$ecio / 10" | bc -l 2>/dev/null))
network_mode="WCDMA Mode"
wcdma_mcc="$mcc"
@ -679,23 +711,16 @@ cell_info()
case $network_mode in
"NR5G-SA Mode")
add_plain_info_entry "MCC" "$nr_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$nr_mnc" "Mobile Network Code"
add_plain_info_entry "MCC" "$mcc" "Mobile Country 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 "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 "Band" "$nr_band" "Band"
add_bar_info_entry "SS-RSRP" "$nr_rsrp" "Reference Signal Received Power (SS)" -187 -29 dBm
add_bar_info_entry "SS-RSRQ" "$nr_rsrq" "Reference Signal Received Quality (SS)" -43 20 dBm
add_bar_info_entry "SS-SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio (SS)" -23 40 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
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio" 0 30 dB
;;
"LTE Mode")
add_plain_info_entry "MCC" "$lte_mcc" "Mobile Country 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 "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 "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -20 20 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio" -23 40 dB
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -140 -44 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" 0 30 dB
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -120 -20 dBm
if [ -n "$lte_cql" ]; then
add_plain_info_entry "CQI" "$lte_cql" "Channel Quality Indicator"

View File

@ -1620,9 +1620,9 @@ cell_info()
add_plain_info_entry "ARFCN" "$nr_arfcn" "Absolute Radio-Frequency Channel Number"
add_plain_info_entry "Band" "$nr_band" "Band"
add_plain_info_entry "DL Bandwidth" "$nr_dl_bandwidth" "DL Bandwidth"
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "RxLev" "$nr_rxlev" "Received Signal Level"
add_plain_info_entry "SCS" "$nr_scs" "SCS"
add_plain_info_entry "Srxlev" "$nr_srxlev" "Serving Cell Receive Level"
@ -1642,9 +1642,9 @@ cell_info()
add_plain_info_entry "DL Bandwidth" "$endc_lte_dl_bandwidth" "DL Bandwidth"
add_plain_info_entry "TAC" "$endc_lte_tac" "Tracking area code of cell served by neighbor Enb"
add_bar_info_entry "RSRP" "$endc_lte_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$endc_lte_rsrq" "Reference Signal Received Quality" -20 20 dBm
add_bar_info_entry "RSSI" "$endc_lte_rssi" "Received Signal Strength Indicator" -140 -44 dBm
add_bar_info_entry "SINR" "$endc_lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRQ" "$endc_lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$endc_lte_rssi" "Received Signal Strength Indicator" -120 -20 dBm
add_bar_info_entry "SINR" "$endc_lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "RxLev" "$endc_lte_rxlev" "Received Signal Level"
add_plain_info_entry "RSSNR" "$endc_lte_rssnr" "Radio Signal Strength Noise Ratio"
add_plain_info_entry "CQI" "$endc_lte_cql" "Channel Quality Indicator"
@ -1657,9 +1657,9 @@ cell_info()
add_plain_info_entry "ARFCN" "$endc_nr_arfcn" "Absolute Radio-Frequency Channel Number"
add_plain_info_entry "Band" "$endc_nr_band" "Band"
add_plain_info_entry "DL Bandwidth" "$endc_nr_dl_bandwidth" "DL Bandwidth"
add_bar_info_entry "RSRP" "$endc_nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
add_bar_info_entry "RSRQ" "$endc_nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
add_bar_info_entry "SINR" "$endc_nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRP" "$endc_nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$endc_nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$endc_nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "SCS" "$endc_nr_scs" "SCS"
;;
"LTE Mode")
@ -1674,9 +1674,9 @@ cell_info()
add_plain_info_entry "UL Bandwidth" "$lte_ul_bandwidth" "UL Bandwidth"
add_plain_info_entry "DL Bandwidth" "$lte_dl_bandwidth" "DL Bandwidth"
add_plain_info_entry "TAC" "$lte_tac" "Tracking area code of cell served by neighbor Enb"
add_bar_info_entry "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -20 20 dBm
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -140 -44 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -120 -20 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "RxLev" "$lte_rxlev" "Received Signal Level"
add_plain_info_entry "RSSNR" "$lte_rssnr" "Radio Signal Strength Noise Ratio"
add_plain_info_entry "CQI" "$lte_cql" "Channel Quality Indicator"

View File

@ -433,30 +433,16 @@ for line in $data;do
continue
;;
*SINR*)
add_bar_info_entry "SINR" "$value" "$key" -23 40 dB
add_bar_info_entry "SINR" "$value" "$key" 0 30 dB
;;
*RSRP*)
case $key in
*NR5G*)
add_bar_info_entry "NR5G RSRP" "$value" "$key" -187 -29 dBm
;;
*)
add_bar_info_entry "RSRP" "$value" "$key" -140 -44 dBm
;;
esac
;;
*RSRQ*)
case $key in
*NR5G*)
add_bar_info_entry "NR5G RSRQ" "$value" "$key" -43 20 dBm
;;
*)
add_bar_info_entry "RSRQ" "$value" "$key" -20 20 dBm
;;
esac
add_bar_info_entry "RSRQ" "$value" "$key" -19.5 -3 dB
;;
*RSSI*)
add_bar_info_entry "RSSI" "$value" "$key" -140 -44 dBm
add_bar_info_entry "RSSI" "$value" "$key" -120 -20 dBm
;;
*)
add_plain_info_entry $key $value $key

View File

@ -1,8 +1,8 @@
#!/bin/sh
# Copyright (C) 2025 sfwtw
# Copyright (C) 2025 sfwtw <sfwtw@qq.com>
_Vendor="simcom"
_Author="sfwtw"
_Maintainer="sfwtw <unkown>"
_Maintainer="sfwtw <sfwtw@qq.com>"
source /usr/share/qmodem/generic.sh
debug_subject="quectel_ctrl"
#return raw data
@ -325,11 +325,8 @@ sim_info()
#网络信息
network_info()
{
m_debug "Quectel network info"
m_debug "Simcom network info"
#Connect Status连接状态
#Network Type网络类型
at_command="AT+CPSI?"
network_type=$(at ${at_port} ${at_command} | grep "+CPSI:" | awk -F',' '{print $1}' | sed 's/+CPSI: //g')
@ -339,29 +336,8 @@ network_info()
network_type=$(get_rat ${rat_num})
}
#CSQ信号强度
at_command="AT+CSQ"
response=$(at ${at_port} ${at_command} | grep "+CSQ:" | sed 's/+CSQ: //g' | sed 's/\r//g')
#RSSI信号强度指示
# rssi_num=$(echo $response | awk -F',' '{print $1}')
# rssi=$(get_rssi $rssi_num)
#Ber信道误码率
# ber=$(echo $response | awk -F',' '{print $2}')
#PER信号强度
# if [ -n "$csq" ]; then
# per=$((csq * 100/31))"%"
# fi
class="Network Information"
add_plain_info_entry "Network Type" "$network_type" "Network Type"
add_plain_info_entry "CQI UL" "" "Channel Quality Indicator for Uplink"
add_plain_info_entry "CQI DL" "" "Channel Quality Indicator for Downlink"
add_plain_info_entry "AMBR UL" "" "Access Maximum Bit Rate for Uplink"
add_plain_info_entry "AMBR DL" "" "Access Maximum Bit Rate for Downlink"
add_plain_info_entry "Tx Rate" "" "Transmit Rate"
add_plain_info_entry "Rx Rate" "" "Receive Rate"
}
#获取频段
@ -956,10 +932,10 @@ cell_info()
add_plain_info_entry "CQI" "$nr_cql" "Channel Quality Indicator"
add_plain_info_entry "TX Power" "$nr_tx_power" "TX Power"
add_plain_info_entry "DL/UL MOD" "$nr_dlmod / $nr_ulmod" "DL/UL MOD"
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
add_bar_info_entry "RSSI" "$nr_rssi" "Received Signal Strength Indicator" -140 -44 dBm
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$nr_rssi" "Received Signal Strength Indicator" -120 -20 dBm
add_bar_info_entry "SINR" "$nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "RxLev" "$nr_rxlev" "Received Signal Level"
add_plain_info_entry "SCS" "$nr_scs" "SCS"
add_plain_info_entry "Srxlev" "$nr_srxlev" "Serving Cell Receive Level"
@ -978,9 +954,9 @@ cell_info()
add_plain_info_entry "DL Bandwidth" "$endc_lte_dl_bandwidth" "DL Bandwidth"
add_plain_info_entry "TAC" "$endc_lte_tac" "Tracking area code of cell served by neighbor Enb"
add_bar_info_entry "RSRP" "$endc_lte_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$endc_lte_rsrq" "Reference Signal Received Quality" -20 20 dBm
add_bar_info_entry "RSSI" "$endc_lte_rssi" "Received Signal Strength Indicator" -140 -44 dBm
add_bar_info_entry "SINR" "$endc_lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRQ" "$endc_lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$endc_lte_rssi" "Received Signal Strength Indicator" -120 -20 dBm
add_bar_info_entry "SINR" "$endc_lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "RxLev" "$endc_lte_rxlev" "Received Signal Level"
add_plain_info_entry "RSSNR" "$endc_lte_rssnr" "Radio Signal Strength Noise Ratio"
add_plain_info_entry "CQI" "$endc_lte_cql" "Channel Quality Indicator"
@ -993,9 +969,9 @@ cell_info()
add_plain_info_entry "ARFCN" "$endc_nr_arfcn" "Absolute Radio-Frequency Channel Number"
add_plain_info_entry "Band" "$endc_nr_band" "Band"
add_plain_info_entry "DL Bandwidth" "$endc_nr_dl_bandwidth" "DL Bandwidth"
add_bar_info_entry "RSRP" "$endc_nr_rsrp" "Reference Signal Received Power" -187 -29 dBm
add_bar_info_entry "RSRQ" "$endc_nr_rsrq" "Reference Signal Received Quality" -43 20 dBm
add_bar_info_entry "SINR" "$endc_nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRP" "$endc_nr_rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$endc_nr_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "SINR" "$endc_nr_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "SCS" "$endc_nr_scs" "SCS"
;;
"LTE Mode")
@ -1010,9 +986,9 @@ cell_info()
add_plain_info_entry "DL Bandwidth" "$lte_dl_bandwidth" "DL Bandwidth"
add_plain_info_entry "TAC" "$lte_tac" "Tracking area code of cell served by neighbor Enb"
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 "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -140 -44 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" -23 40 dB
add_bar_info_entry "RSRQ" "$lte_rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$lte_rssi" "Received Signal Strength Indicator" -120 -22 dBm
add_bar_info_entry "SINR" "$lte_sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
add_plain_info_entry "CQI" "$lte_cql" "Channel Quality Indicator"
add_plain_info_entry "TX Power" "$lte_tx_power" "TX Power"
add_plain_info_entry "Srxlev" "$lte_srxlev" "Serving Cell Receive Level"

View File

@ -0,0 +1,771 @@
#!/bin/sh
# Copyright (C) 2025 sfwtw <sfwtw@qq.com>
_Vendor="telit"
_Author="sfwtw"
_Maintainer="sfwtw <sfwtw@qq.com>"
source /usr/share/qmodem/generic.sh
debug_subject="telit_ctrl"
vendor_get_disabled_features()
{
json_add_string "" "IMEI"
json_add_string "" "NeighborCell"
}
get_mode()
{
at_command='AT#USBCFG?'
local mode_num=$(at ${at_port} ${at_command} | grep -o "#USBCFG:" | awk -F': ' '{print $2}')
case "$mode_num" in
"0") mode="rndis" ;;
"1") mode="qmi" ;;
"2") mode="mbim" ;;
"3") mode="ecm" ;;
*) mode="${mode_num}" ;;
esac
available_modes=$(uci -q get qmodem.$config_section.modes)
json_add_object "mode"
for available_mode in $available_modes; do
if [ "$mode" = "$available_mode" ]; then
json_add_string "$available_mode" "1"
else
json_add_string "$available_mode" "0"
fi
done
json_close_object
}
set_mode()
{
local mode=$1
case $mode in
"rndis") mode="0" ;;
"qmi") mode="1" ;;
"mbim") mode="2" ;;
"ecm") mode="3" ;;
*) echo "Invalid mode" && return 1;;
esac
at_command='AT#USBCFG='${mode}
res=$(at "${at_port}" "${at_command}")
json_select "result"
json_add_string "set_mode" "$res"
json_close_object
}
get_network_prefer()
{
at_command='AT+WS46?'
local response=$(at ${at_port} ${at_command} | grep "+WS46:" | awk -F': ' '{print $2}' | sed 's/\r//g')
network_prefer_3g="0";
network_prefer_4g="0";
network_prefer_5g="0";
#匹配不同的网络类型
local auto=$(echo "${response}" | grep "38")
if [ -n "$auto" ]; then
network_prefer_3g="1"
network_prefer_4g="1"
network_prefer_5g="1"
else
local wcdma=$(echo "${response}" | grep "22" || echo "${response}" | grep "31" || echo "${response}" | grep "38" || echo "${response}" | grep "40")
local lte=$(echo "${response}" | grep "28" || echo "${response}" | grep "31" || echo "${response}" | grep "37" || echo "${response}" | grep "38")
local nr=$(echo "${response}" | grep "36" || echo "${response}" | grep "37" || echo "${response}" | grep "38" || echo "${response}" | grep "40")
if [ -n "$wcdma" ]; then
network_prefer_3g="1"
fi
if [ -n "$lte" ]; then
network_prefer_4g="1"
fi
if [ -n "$nr" ]; then
network_prefer_5g="1"
fi
fi
json_add_object network_prefer
json_add_string 3G $network_prefer_3g
json_add_string 4G $network_prefer_4g
json_add_string 5G $network_prefer_5g
json_close_object
}
set_network_prefer()
{
network_prefer_3g=$(echo $1 |jq -r 'contains(["3G"])')
network_prefer_4g=$(echo $1 |jq -r 'contains(["4G"])')
network_prefer_5g=$(echo $1 |jq -r 'contains(["5G"])')
length=$(echo $1 |jq -r 'length')
case "$length" in
"1")
if [ "$network_prefer_3g" = "true" ]; then
network_prefer_config="22"
elif [ "$network_prefer_4g" = "true" ]; then
network_prefer_config="28"
elif [ "$network_prefer_5g" = "true" ]; then
network_prefer_config="36"
fi
;;
"2")
if [ "$network_prefer_3g" = "true" ] && [ "$network_prefer_4g" = "true" ]; then
network_prefer_config="31"
elif [ "$network_prefer_3g" = "true" ] && [ "$network_prefer_5g" = "true" ]; then
network_prefer_config="40"
elif [ "$network_prefer_4g" = "true" ] && [ "$network_prefer_5g" = "true" ]; then
network_prefer_config="37"
fi
;;
"3") network_prefer_config="38" ;;
*) network_prefer_config="38" ;;
esac
at_command='AT+WS46='${network_prefer_config}
at "${at_port}" "${at_command}"
}
get_voltage()
{
at_command="AT#CBC"
local voltage=$(at ${at_port} ${at_command} | grep "#CBC:" | awk -F',' '{print $2}' | sed 's/\r//g')
[ -n "$voltage" ] && {
voltage=$(awk "BEGIN {printf \"%.2f\", $voltage / 100}")
add_plain_info_entry "voltage" "$voltage V" "Voltage"
}
}
get_temperature()
{
at_command="AT#TEMPSENS=2"
local temp
QTEMP=$(at ${at_port} ${at_command} | grep "#TEMPSENS: TSENS,")
temp=$(echo $QTEMP | awk -F',' '{print $2}' | sed 's/\r//g')
if [ -n "$temp" ]; then
temp="${temp}$(printf "\xc2\xb0")C"
fi
add_plain_info_entry "temperature" "$temp" "Temperature"
}
base_info()
{
m_debug "Telit base info"
#Name名称
at_command="AT+CGMM"
name=$(at $at_port $at_command | sed -n '3p' | sed 's/\r//g')
#Manufacturer制造商
at_command="AT+CGMI"
manufacturer=$(at $at_port $at_command | sed -n '3p' | sed 's/\r//g')
#Revision固件版本
at_command="AT+CGMR"
revision=$(at $at_port $at_command | sed -n '3p' | sed 's/\r//g')
class="Base Information"
add_plain_info_entry "manufacturer" "$manufacturer" "Manufacturer"
add_plain_info_entry "revision" "$revision" "Revision"
add_plain_info_entry "at_port" "$at_port" "AT Port"
get_temperature
get_voltage
get_connect_status
}
sim_info()
{
m_debug "Telit sim info"
#SIM SlotSIM卡卡槽
at_command="AT#QSS?"
sim_slot=$(at $at_port $at_command | grep "#QSS:" | awk -F',' '{print $3}' | sed 's/\r//g')
if [ "$sim_slot" = "0" ]; then
sim_slot="1"
elif [ "$sim_slot" = "1" ]; then
sim_slot="2"
fi
#IMEI国际移动设备识别码
at_command="AT+CGSN"
imei=$(at $at_port $at_command | sed -n '3p' | sed 's/\r//g')
#SIM StatusSIM状态
at_command="AT+CPIN?"
sim_status_flag=$(at $at_port $at_command | sed -n '3p')
sim_status=$(get_sim_status "$sim_status_flag")
if [ "$sim_status" != "ready" ]; then
return
fi
#ISP互联网服务提供商
at_command="AT+COPS?"
isp=$(at $at_port $at_command | sed -n '3p' | awk -F'"' '{print $2}')
# if [ "$isp" = "CHN-CMCC" ] || [ "$isp" = "CMCC" ]|| [ "$isp" = "46000" ]; then
# isp="中国移动"
# # elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "UNICOM" ] || [ "$isp" = "46001" ]; then
# elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "CUCC" ] || [ "$isp" = "46001" ]; then
# isp="中国联通"
# # elif [ "$isp" = "CHN-CT" ] || [ "$isp" = "CT" ] || [ "$isp" = "46011" ]; then
# elif [ "$isp" = "CHN-TELECOM" ] || [ "$isp" = "CTCC" ] || [ "$isp" = "46011" ]; then
# isp="中国电信"
# fi
#IMSI国际移动用户识别码
at_command="AT+CIMI"
imsi=$(at $at_port $at_command | sed -n '3p' | sed 's/\r//g')
#ICCID集成电路卡识别码
at_command="AT+ICCID"
iccid=$(at $at_port $at_command | grep -o "+ICCID:[ ]*[-0-9]\+" | grep -o "[-0-9]\{1,4\}")
class="SIM Information"
case "$sim_status" in
"ready")
add_plain_info_entry "SIM Status" "$sim_status" "SIM Status"
add_plain_info_entry "ISP" "$isp" "Internet Service Provider"
add_plain_info_entry "SIM Slot" "$sim_slot" "SIM Slot"
add_plain_info_entry "IMEI" "$imei" "International Mobile Equipment Identity"
add_plain_info_entry "IMSI" "$imsi" "International Mobile Subscriber Identity"
add_plain_info_entry "ICCID" "$iccid" "Integrate Circuit Card Identity"
;;
"miss")
add_plain_info_entry "SIM Status" "$sim_status" "SIM Status"
add_plain_info_entry "IMEI" "$imei" "International Mobile Equipment Identity"
;;
"unknown")
add_plain_info_entry "SIM Status" "$sim_status" "SIM Status"
;;
*)
add_plain_info_entry "SIM Status" "$sim_status" "SIM Status"
add_plain_info_entry "SIM Slot" "$sim_slot" "SIM Slot"
add_plain_info_entry "IMEI" "$imei" "International Mobile Equipment Identity"
add_plain_info_entry "IMSI" "$imsi" "International Mobile Subscriber Identity"
add_plain_info_entry "ICCID" "$iccid" "Integrate Circuit Card Identity"
;;
esac
}
network_info()
{
m_debug "Telit network info"
at_command="AT#CAMETRICS=1;#CAMETRICS?"
network_type=$(at ${at_port} ${at_command} | grep "#CAMETRICS:" | awk -F',' '{print $3}')
at_command="AT#CQI"
response=$(at ${at_port} ${at_command} | grep "#CQI:" | sed 's/#CQI: //g' | sed 's/\r//g')
if [ -n "$response" ]; then
cqi=$(echo "$response" | cut -d',' -f1)
second_value=$(echo "$response" | cut -d',' -f2)
[ "$cqi" = "31" ] && cqi="$second_value"
fi
class="Network Information"
add_plain_info_entry "Network Type" "$network_type" "Network Type"
add_plain_info_entry "CQI DL" "$cqi" "Channel Quality Indicator for Downlink"
}
lte_hex_to_bands() {
local hex_value="$1"
local result=""
hex_value=$(echo "$hex_value" | tr 'a-z' 'A-Z')
local decimal=$(echo "ibase=16; $hex_value" | bc)
local i=1
while [ "$decimal" != "0" ]; do
local bit=$(echo "$decimal % 2" | bc)
if [ "$bit" -eq 1 ]; then
result="$result B$i"
fi
decimal=$(echo "$decimal / 2" | bc)
i=$(expr $i + 1)
done
result=$(echo "$result" | tr -s ' ' | sed -e 's/^ *//' -e 's/ *$//')
echo "$result"
}
lte_bands_to_hex() {
local bands="$1"
local decimal_value=0
for band in $bands; do
local band_num=$(echo "$band" | sed 's/^B//')
local bit_value=$(echo "2^($band_num-1)" | bc)
decimal_value=$(echo "$decimal_value + $bit_value" | bc)
done
local hex_value=$(echo "obase=16; $decimal_value" | bc)
echo "$hex_value"
}
nr_hex_to_bands() {
local hex_value="$1"
local result=""
hex_value=$(echo "$hex_value" | tr 'a-z' 'A-Z')
local decimal=$(echo "ibase=16; $hex_value" | bc)
local j=1
[ "$2" = "65_128" ] && j=65
while [ "$decimal" != "0" ]; do
local bit=$(echo "$decimal % 2" | bc)
if [ "$bit" -eq 1 ]; then
result="$result N$j"
fi
decimal=$(echo "$decimal / 2" | bc)
j=$(expr $j + 1)
done
result=$(echo "$result" | tr -s ' ' | sed -e 's/^ *//' -e 's/ *$//')
echo "$result"
}
nr_bands_to_hex() {
local bands="$1"
local decimal_value=0
local decimal_value_ext=0
for band in $bands; do
local band_num=$(echo "$band" | sed 's/^N//')
if expr "$band_num" : '[0-9][0-9]*$' >/dev/null; then
if [ $band_num -lt 65 ]; then
local bit_value=$(echo "2^($band_num-1)" | bc)
decimal_value=$(echo "$decimal_value + $bit_value" | bc)
else
local bit_value=$(echo "2^($band_num-65)" | bc)
decimal_value_ext=$(echo "$decimal_value_ext + $bit_value" | bc)
fi
fi
done
local hex_value=$(echo "obase=16; $decimal_value" | bc)
if [ "$decimal_value_ext" != "0" ]; then
local hex_value_ext=$(echo "obase=16; $decimal_value_ext" | bc)
echo "${hex_value_ext}"
else
echo "$hex_value"
fi
}
get_lockband()
{
json_add_object "lockband"
m_debug "Telit get lockband info"
get_lockband_config_command="AT#BND?"
get_available_band_command="AT#BND=?"
get_lockband_config_res=$(at $at_port $get_lockband_config_command)
get_available_band_res=$(at $at_port $get_available_band_command)
json_add_object "LTE"
json_add_array "available_band"
json_close_array
json_add_array "lock_band"
json_close_array
json_close_object
json_add_object "NR_NSA"
json_add_array "available_band"
json_close_array
json_add_array "lock_band"
json_close_array
json_close_object
json_add_object "NR"
json_add_array "available_band"
json_close_array
json_add_array "lock_band"
json_close_array
json_close_object
lte_avalible_band=$(echo $get_available_band_res | grep -o "#BND: ([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*)" | sed 's/#BND: (\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\))/\3/')
lte_avalible_band=$(lte_hex_to_bands "$lte_avalible_band")
nsa_nr_avalible_band_1_64=$(echo $get_available_band_res | grep -o "#BND: ([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*)" | sed 's/#BND: (\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\))/\5/')
nsa_nr_avalible_band_65_128=$(echo $get_available_band_res | grep -o "#BND: ([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*)" | sed 's/#BND: (\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\))/\6/')
nsa_nr_avalible_band="$(nr_hex_to_bands "$nsa_nr_avalible_band_1_64" "1_64") $(nr_hex_to_bands "$nsa_nr_avalible_band_65_128" "65_128")"
sa_nr_avalible_band_1_64=$(echo $get_available_band_res | grep -o "#BND: ([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*)" | sed 's/#BND: (\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\))/\7/')
sa_nr_avalible_band_65_128=$(echo $get_available_band_res | grep -o "#BND: ([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*),([^)]*)" | sed 's/#BND: (\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\)),(\([^)]*\))/\8/')
sa_nr_avalible_band="$(nr_hex_to_bands "$sa_nr_avalible_band_1_64" "1_64") $(nr_hex_to_bands "$sa_nr_avalible_band_65_128" "65_128")"
for i in $(echo "$lte_avalible_band" | awk -F" " '{for(j=1; j<=NF; j++) print $j}'); do
json_select "LTE"
json_select "available_band"
add_avalible_band_entry "$i" "$i"
json_select ..
json_select ..
done
for i in $(echo "$nsa_nr_avalible_band" | awk -F" " '{for(j=1; j<=NF; j++) print $j}'); do
json_select "NR_NSA"
json_select "available_band"
add_avalible_band_entry "$i" "$i"
json_select ..
json_select ..
done
for i in $(echo "$sa_nr_avalible_band" | awk -F" " '{for(j=1; j<=NF; j++) print $j}'); do
json_select "NR"
json_select "available_band"
add_avalible_band_entry "$i" "$i"
json_select ..
json_select ..
done
lte_band=$(echo $get_lockband_config_res | awk -F "," '{print $3}')
lte_band=$(lte_hex_to_bands "$lte_band")
nsa_nr_band_1_64=$(echo $get_lockband_config_res | awk -F "," '{print $5}')
nsa_nr_band_65_128=$(echo $get_lockband_config_res | awk -F "," '{print $6}')
nsa_nr_band="$(nr_hex_to_bands "$nsa_nr_band_1_64" "1_64") $(nr_hex_to_bands "$nsa_nr_band_65_128" "65_128")"
sa_nr_band_1_64=$(echo $get_lockband_config_res | awk -F "," '{print $7}')
sa_nr_band_65_128=$(echo $get_lockband_config_res | awk -F "," '{print $8}' | sed 's/\r//g' | sed 's/ OK//g')
sa_nr_band="$(nr_hex_to_bands "$sa_nr_band_1_64" "1_64") $(nr_hex_to_bands "$sa_nr_band_65_128" "65_128")"
for i in $(echo "$lte_band" | cut -d, -f2|tr -d '\r' | awk -F" " '{for(j=1; j<=NF; j++) print $j}'); do
if [ -n "$i" ]; then
json_select "LTE"
json_select "lock_band"
json_add_string "" "$i"
json_select ..
json_select ..
fi
done
for i in $(echo "$nsa_nr_band" | cut -d, -f2|tr -d '\r' | awk -F" " '{for(j=1; j<=NF; j++) print $j}'); do
if [ -n "$i" ]; then
json_select "NR_NSA"
json_select "lock_band"
json_add_string "" "$i"
json_select ..
json_select ..
fi
done
for i in $(echo "$sa_nr_band" | cut -d, -f2|tr -d '\r' | awk -F" " '{for(j=1; j<=NF; j++) print $j}'); do
if [ -n "$i" ]; then
json_select "NR"
json_select "lock_band"
json_add_string "" "$i"
json_select ..
json_select ..
fi
done
json_close_array
json_close_object
}
set_lockband()
{
m_debug "telit set lockband info"
config=$1
#{"band_class":"NR","lock_band":"41,78,79"}
band_class=$(echo $config | jq -r '.band_class')
lock_band=$(echo $config | jq -r '.lock_band')
lock_band=$(echo $lock_band | tr ',' ' ')
case "$band_class" in
"LTE")
lock_band=$(lte_bands_to_hex "$lock_band")
at_command="AT#BND=0,22,$lock_band"
res=$(at $at_port $at_command)
;;
"NR_NSA")
orig=$(at $at_port "AT#BND?")
orig_lte=$(echo $orig | awk -F "," '{print $3}')
orig_lte_ext=$(echo $orig | awk -F "," '{print $4}')
nr_bands_1_64=""
nr_bands_65_128=""
for band in $lock_band; do
band_num=$(echo "$band" | sed 's/^N//')
if [ "$band_num" -lt 65 ]; then
nr_bands_1_64="$nr_bands_1_64 N$band_num"
else
nr_bands_65_128="$nr_bands_65_128 N$band_num"
fi
done
nsa_nr_1_64=$(nr_bands_to_hex "$nr_bands_1_64" | cut -d',' -f1)
nsa_nr_65_128=$(nr_bands_to_hex "$nr_bands_65_128" | cut -d',' -f2)
[ -z "$nsa_nr_1_64" ] && nsa_nr_1_64=$orig_nsa_nr_1_64
[ -z "$nsa_nr_65_128" ] && nsa_nr_65_128=$orig_nsa_nr_65_128
at_command="AT#BND=0,22,$orig_lte,$orig_lte_ext,$nsa_nr_1_64,$nsa_nr_65_128"
res=$(at $at_port $at_command)
;;
"NR")
orig=$(at $at_port "AT#BND?")
orig_lte=$(echo $orig | awk -F "," '{print $3}')
orig_lte_ext=$(echo $orig | awk -F "," '{print $4}')
orig_nsa_nr_1_64=$(echo $orig | awk -F "," '{print $5}')
orig_nsa_nr_65_128=$(echo $orig | awk -F "," '{print $6}')
orig_sa_nr_1_64=$(echo $orig | awk -F "," '{print $7}')
orig_sa_nr_65_128=$(echo $orig | awk -F "," '{print $8}' | sed 's/\r//g' | sed 's/ OK//g')
nr_bands_1_64=""
nr_bands_65_128=""
for band in $lock_band; do
band_num=$(echo "$band" | sed 's/^N//')
if [ "$band_num" -lt 65 ]; then
nr_bands_1_64="$nr_bands_1_64 N$band_num"
else
nr_bands_65_128="$nr_bands_65_128 N$band_num"
fi
done
nr_1_64=$(nr_bands_to_hex "$nr_bands_1_64")
nr_65_128=$(nr_bands_to_hex "$nr_bands_65_128")
[ -z "$nr_1_64" ] && nr_1_64=$orig_sa_nr_1_64
[ -z "$nr_65_128" ] && nr_65_128=$orig_sa_nr_65_128
at_command="AT#BND=0,22,$orig_lte,$orig_lte_ext,$orig_nsa_nr_1_64,$orig_nsa_nr_65_128,$nr_1_64,$nr_65_128"
res=$(at $at_port $at_command)
;;
esac
json_select "result"
json_add_string "set_lockband" "$res"
json_add_string "config" "$config"
json_add_string "band_class" "$band_class"
json_add_string "lock_band" "$lock_band"
json_close_object
}
calc_average() {
local values="$1"
local sum=0
local count=0
for val in $values; do
if [ -n "$val" ] && [ "$val" != "NA" ]; then
sum=$(echo "$sum + $val" | bc -l)
count=$((count + 1))
fi
done
if [ $count -gt 0 ]; then
printf "%.1f" $(echo "$sum / $count" | bc -l)
else
echo "NA"
fi
}
convert_band_number() {
local band_num=$1
case "$band_num" in
120) echo "B1" ;;
121) echo "B2" ;;
122) echo "B3" ;;
123) echo "B4" ;;
124) echo "B5" ;;
125) echo "B6" ;;
126) echo "B7" ;;
127) echo "B8" ;;
128) echo "B9" ;;
129) echo "B10" ;;
130) echo "B11" ;;
131) echo "B12" ;;
132) echo "B13" ;;
133) echo "B14" ;;
134) echo "B17" ;;
135) echo "B33" ;;
136) echo "B34" ;;
137) echo "B35" ;;
138) echo "B36" ;;
139) echo "B37" ;;
140) echo "B38" ;;
141) echo "B39" ;;
142) echo "B40" ;;
143) echo "B18" ;;
144) echo "B19" ;;
145) echo "B20" ;;
146) echo "B21" ;;
147) echo "B24" ;;
148) echo "B25" ;;
149) echo "B41" ;;
150) echo "B42" ;;
151) echo "B43" ;;
152) echo "B23" ;;
153) echo "B26" ;;
154) echo "B32" ;;
155) echo "B125" ;;
156) echo "B126" ;;
157) echo "B127" ;;
158) echo "B28" ;;
159) echo "B29" ;;
160) echo "B30" ;;
161) echo "B66" ;;
162) echo "B250" ;;
163) echo "B46" ;;
166) echo "B71" ;;
167) echo "B47" ;;
168) echo "B48" ;;
250) echo "N1" ;;
251) echo "N2" ;;
252) echo "N3" ;;
253) echo "N5" ;;
254) echo "N7" ;;
255) echo "N8" ;;
256) echo "N20" ;;
257) echo "N28" ;;
258) echo "N38" ;;
259) echo "N41" ;;
260) echo "N50" ;;
261) echo "N51" ;;
262) echo "N66" ;;
263) echo "N70" ;;
264) echo "N71" ;;
265) echo "N74" ;;
266) echo "N75" ;;
267) echo "N76" ;;
268) echo "N77" ;;
269) echo "N78" ;;
270) echo "N79" ;;
271) echo "N80" ;;
272) echo "N81" ;;
273) echo "N82" ;;
274) echo "N83" ;;
275) echo "N84" ;;
276) echo "N85" ;;
277) echo "N257" ;;
278) echo "N258" ;;
279) echo "N259" ;;
280) echo "N260" ;;
281) echo "N261" ;;
282) echo "N12" ;;
283) echo "N25" ;;
284) echo "N34" ;;
285) echo "N39" ;;
286) echo "N40" ;;
287) echo "N65" ;;
288) echo "N86" ;;
289) echo "N48" ;;
290) echo "N14" ;;
291) echo "N13" ;;
292) echo "N18" ;;
293) echo "N26" ;;
294) echo "N30" ;;
295) echo "N29" ;;
296) echo "N53" ;;
*) echo "$band_num" ;;
esac
}
cell_info()
{
m_debug "Telit cell info"
at_command="AT#CAINFOEXT?"
ca_response=$(at ${at_port} ${at_command})
info_line=$(echo "$ca_response" | grep -o "#CAINFOEXT: [^$]*" | head -1)
ca_count=$(echo "$info_line" | awk -F',' '{print $1}' | awk -F': ' '{print $2}')
network_type_raw=$(echo "$info_line" | awk -F',' '{print $2}')
network_mode=$(echo "$network_type_raw" | tr -d ' ')
[ "$ca_count" -gt 1 ] && network_mode="$network_mode with $ca_count CA"
pcc_line=$(echo "$ca_response" | grep "PCC-")
band_number=$(echo "$pcc_line" | grep -o "BandClass: [^,]*" | awk -F': ' '{print $2}')
band=$(convert_band_number "$band_number")
bw=$(echo "$pcc_line" | grep -o "BW: [^,]*" | awk -F': ' '{print $2}')
if [ -z "$bw" ]; then
dl_bw_raw=$(echo "$pcc_line" | grep -o "DL_BW: [^,]*" | awk -F': ' '{print $2}')
case "$dl_bw_raw" in
"0") bw="1.4 MHz" ;;
"1") bw="3 MHz" ;;
"2") bw="5 MHz" ;;
"3") bw="10 MHz" ;;
"4") bw="15 MHz" ;;
"5") bw="20 MHz" ;;
*) bw="$dl_bw_raw" ;;
esac
fi
arfcn=$(echo "$pcc_line" | grep -o "CH: [^,]*" | awk -F': ' '{print $2}')
[ -z "$arfcn" ] && arfcn=$(echo "$pcc_line" | grep -o "RX_CH: [^,]*" | awk -F': ' '{print $2}')
pci=$(echo "$pcc_line" | grep -o "PCI: [^,]*" | awk -F': ' '{print $2}')
rsrp=$(echo "$pcc_line" | grep -o "RSRP: [^,]*" | awk -F': ' '{print $2}')
rsrq=$(echo "$pcc_line" | grep -o "RSRQ: [^,]*" | awk -F': ' '{print $2}')
rssi=$(echo "$pcc_line" | grep -o "RSSI: [^,]*" | awk -F': ' '{print $2}')
sinr_raw=$(echo "$pcc_line" | grep -o "SINR: [^,]*" | awk -F': ' '{print $2}')
sinr=$(printf "%.1f" $(echo "-20 + ($sinr_raw * 0.2)" | bc -l))
tac=$(echo "$pcc_line" | grep -o "TAC: [^,]*" | awk -F': ' '{print $2}')
tx_power=$(echo "$pcc_line" | grep -o "TX_PWR: [^,]*" | awk -F': ' '{print $2}')
[ -n "$tx_power" ] && tx_power=$(printf "%.1f" $(echo "$tx_power / 10" | bc -l))
[ -z "$tx_power" ] && tx_power="0"
ul_mod=$(echo "$pcc_line" | grep -o "UL_MOD: [^,]*" | awk -F': ' '{print $2}')
dl_mod=$(echo "$pcc_line" | grep -o "DL_MOD: [^,]*" | awk -F': ' '{print $2}' | sed 's/[^0-9]//g')
case "$ul_mod" in
"0") ul_mod="BPSK" ;;
"1") ul_mod="QPSK" ;;
"2") ul_mod="16QAM" ;;
"3") ul_mod="64QAM" ;;
"4") ul_mod="256QAM" ;;
*) ul_mod="$ul_mod" ;;
esac
case "$dl_mod" in
"0") dl_mod="BPSK" ;;
"1") dl_mod="QPSK" ;;
"2") dl_mod="16QAM" ;;
"3") dl_mod="64QAM" ;;
"4") dl_mod="256QAM" ;;
*) dl_mod="$dl_mod" ;;
esac
if [ "$ca_count" -gt 1 ]; then
scc_band=""
scc_bw=""
scc_arfcn=""
scc_pci=""
scc_rsrp=""
scc_rssi=""
scc_rsrq=""
scc_sinr=""
for i in $(seq 0 $((ca_count-2))); do
scc_line=$(echo "$ca_response" | grep -A 1 "SCC$i-" | tr '\r\n' ' ')
if [ -n "$scc_line" ]; then
scc_band_number=$(echo "$scc_line" | grep -o "BandClass: [^,]*" | awk -F': ' '{print $2}')
scc_band_new=$(convert_band_number "$scc_band_number")
if [ -z "$scc_band" ]; then
scc_band="$scc_band_new"
else
scc_band="$scc_band / $scc_band_new"
fi
scc_bw_new=$(echo "$scc_line" | grep -o "BW: [^,]*" | awk -F': ' '{print $2}')
if [ -z "$scc_bw_new" ]; then
scc_dl_bw=$(echo "$scc_line" | grep -o "DL_BW: [^,]*" | awk -F': ' '{print $2}')
case "$scc_dl_bw" in
"0") scc_bw_new="1.4 MHz" ;;
"1") scc_bw_new="3 MHz" ;;
"2") scc_bw_new="5 MHz" ;;
"3") scc_bw_new="10 MHz" ;;
"4") scc_bw_new="15 MHz" ;;
"5") scc_bw_new="20 MHz" ;;
*) scc_bw_new="$scc_dl_bw" ;;
esac
fi
if [ -z "$scc_bw" ]; then
scc_bw="$scc_bw_new"
else
scc_bw="$scc_bw / $scc_bw_new"
fi
scc_arfcn_new=$(echo "$scc_line" | grep -o "CH: [^,]*" | awk -F': ' '{print $2}')
[ -z "$scc_arfcn_new" ] && scc_arfcn_new=$(echo "$scc_line" | grep -o "RX_CH: [^,]*" | awk -F': ' '{print $2}')
if [ -z "$scc_arfcn" ]; then
scc_arfcn="$scc_arfcn_new"
else
scc_arfcn="$scc_arfcn / $scc_arfcn_new"
fi
scc_pci_new=$(echo "$scc_line" | grep -o "PCI: [^,]*" | awk -F': ' '{print $2}')
if [ -z "$scc_pci" ]; then
scc_pci="$scc_pci_new"
else
scc_pci="$scc_pci / $scc_pci_new"
fi
scc_rsrp_new=$(echo "$scc_line" | grep -o "RSRP: [^,]*" | awk -F': ' '{print $2}')
scc_rsrp="$scc_rsrp $scc_rsrp_new"
scc_rssi_new=$(echo "$scc_line" | grep -o "RSSI: [^,]*" | awk -F': ' '{print $2}')
scc_rssi="$scc_rssi $scc_rssi_new"
scc_rsrq_new=$(echo "$scc_line" | grep -o "RSRQ: [^,]*" | awk -F': ' '{print $2}')
scc_rsrq="$scc_rsrq $scc_rsrq_new"
scc_sinr_raw=$(echo "$scc_line" | grep -o "SINR: [^,]*" | awk -F': ' '{print $2}')
scc_sinr_new=$(printf "%.1f" $(echo "-20 + ($scc_sinr_raw * 0.2)" | bc -l))
scc_sinr="$scc_sinr $scc_sinr_new"
fi
done
arfcn="$arfcn / $scc_arfcn"
band="$band / $scc_band"
bw="$bw / $scc_bw"
pci="$pci / $scc_pci"
# rsrp=$(calc_average "$rsrp $scc_rsrp")
# rssi=$(calc_average "$rssi $scc_rssi")
# rsrq=$(calc_average "$rsrq $scc_rsrq")
# sinr=$(calc_average "$sinr $scc_sinr")
fi
class="Cell Information"
add_plain_info_entry "network_mode" "$network_mode" "Network Mode"
add_plain_info_entry "Band" "$band" "Band"
add_plain_info_entry "Bandwidth" "$bw" "Bandwidth"
add_plain_info_entry "ARFCN" "$arfcn" "Absolute Radio-Frequency Channel Number"
add_plain_info_entry "Physical Cell ID" "$pci" "Physical Cell ID"
add_plain_info_entry "TAC" "$tac" "Tracking Area Code"
add_plain_info_entry "DL/UL MOD" "$dl_mod / $ul_mod" "DL/UL MOD"
add_plain_info_entry "TX Power" "$tx_power" "TX Power"
add_bar_info_entry "RSRP" "$rsrp" "Reference Signal Received Power" -140 -44 dBm
add_bar_info_entry "RSRQ" "$rsrq" "Reference Signal Received Quality" -19.5 -3 dB
add_bar_info_entry "RSSI" "$rssi" "Received Signal Strength Indicator" -120 -20 dBm
add_bar_info_entry "SINR" "$sinr" "Signal to Interference plus Noise Ratio Bandwidth" 0 30 dB
}