Compare commits

...

108 Commits
v2.7.3 ... 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
coolsnowwolf
f1b495eb1a
workflows: fix typo 2025-06-10 16:58:17 +08:00
coolsnowwolf
37693b95d7
workflows: fix release 2025-06-10 16:56:12 +08:00
coolsnowwolf
7fece11557 luci-app-qmodem: update version to v2.8.0 2025-06-10 16:39:45 +08:00
GitHub Action
ac004985f1 Update support list 2025-06-05 14:52:55 +08:00
sfwtw
6f5eefe240 luci-app-qmodem: add support for srm821 & nu313 2025-06-05 06:52:28 +00:00
sfwtw
70d9b97eed Update modem_support.json 2025-06-05 06:50:17 +00:00
min19235555
0671e79697 Update modem_port_rule.json
修正
2025-06-05 06:50:17 +00:00
min19235555
4f247ef938 Update modem_port_rule.json
更正端口
2025-06-05 06:50:17 +00:00
min19235555
f3966a1009 Update modem_port_rule.json 2025-06-05 06:50:17 +00:00
min19235555
66db34a221 Update at_commands.json 2025-06-05 06:50:17 +00:00
min19235555
15fd93ab85 Update at_commands.json 2025-06-05 06:50:17 +00:00
min19235555
25b038e62a Update at_commands.json
添加美格展锐转网口
2025-06-05 06:50:17 +00:00
min19235555
98a728a497 Update modem_support.json 2025-06-05 06:50:17 +00:00
min19235555
33a2ae011e Update modem_scan.sh 2025-06-05 06:50:17 +00:00
min19235555
4a790110a1 Update modem_dial.sh 2025-06-05 06:50:17 +00:00
min19235555
baaacc863c Update at_commands.json
添加meig_unisoc
2025-06-05 06:50:17 +00:00
min19235555
999ca5dec5 Update meig.sh
添加NU313-M2
2025-06-05 06:50:17 +00:00
Julian Braun
b211a37339
Add Language support for AT commands, add DE/CH/AT APNs (#53)
* Add Language support for AT commands, add DE/CH/AT APNs

Signed-off-by: d3dx9 <julian@coreroute.de>
2025-06-03 12:32:09 +08:00
sfwtw
26f3636a37
quectel_CM_5G_M: Add MBIM Support for FCC unlock.
Add MBIM Support for FCC unlock.
2025-06-02 20:44:31 +08:00
Julian Braun
f20a921dce
Merge branch 'main' into main 2025-06-02 14:29:41 +02:00
d3dx9
da2908b1d1 add qmi over mbim support for unlock
Signed-off-by: d3dx9 <julian@d3dx9.de>
2025-06-02 12:24:33 +00:00
sfwtw
3760807e2f workflows: fix apk compile 2025-06-02 19:44:24 +08:00
Julian Braun
393dd33334
Add Foxconn FCC Unlock mechanism to quectel-5G-M (#51) 2025-06-02 19:00:58 +08:00
d3dx9
653a4ae591 fix fcc unlock 2025-06-02 10:46:32 +00:00
d3dx9
07c40ddaed add foxconn fcc unlock 2025-06-02 10:28:39 +00:00
micc
6fe59c1d2b
添加移远AT+QRSRP指令 (#50) 2025-05-31 23:19:15 +08:00
sfwtw
fb90356b81 luci-app-qmodem: fix: Foxconn set_imei 2025-05-31 15:48:05 +08:00
GitHub Action
31665b7153 Update support list 2025-05-29 23:04:43 +08:00
sfwtw
0384c8faaf luci-app-qmodem: add Foxconn X72 and Neoway N510M support 2025-05-29 23:04:23 +08:00
sfwtw
68cf55631f luci-app-qmodem: perf: auto add option_driver 2025-05-22 17:14:07 +08:00
Fu Jianrong
558918bec8
Update issue templates 2025-05-22 10:56:35 +08:00
GitHub Action
5034d81106 Update support list 2025-05-17 00:08:11 +08:00
coolsnowwolf
2d7acea04d luci-app-qmodem: add Quectel RG801 (Balong 5000) support 2025-05-17 00:07:57 +08:00
GitHub Action
9d650234e5 Update support list 2025-05-16 23:29:54 +08:00
sfwtw
ecf9e25bc4 luci-app-qmodem: add Huawei MH50000-31 support 2025-05-16 23:29:40 +08:00
GitHub Action
530b1e684c Update support list 2025-05-16 14:52:02 +08:00
coolsnowwolf
3be67546b0 luci-app-qmodem: add Quectel RM551E-GL (X75) usb and pcie mode support 2025-05-16 14:51:45 +08:00
MDSDTech
d09fa42c0f
Update arm64_apk.env and x64_apk.env (#43)
* Update arm64_apk.env

* Update x64_apk.env
2025-05-16 14:34:41 +08:00
GitHub Action
ed793f114b Update support list 2025-05-16 13:15:34 +08:00
coolsnowwolf
b25277eae4 luci-app-qmodem: add FM190W-GL (X75) usb and pcie mode support 2025-05-16 13:15:19 +08:00
coolsnowwolf
074dbbb117 luci-app-qmodem: add hang off support for mt5700 2025-05-16 11:13:18 +08:00
sfwtw
e0ce8d9be9 luci-app-qmodem: fix mt5700 set_imei 2025-05-15 23:02:49 +08:00
sfwtw
4664fe87e5 luci-app-qmodem: add mt5700m-cn port rule 2025-05-15 21:38:59 +08:00
coolsnowwolf
fc645a616d luci-app-qmodem: disabled LockBand feature for MT5700M-CN 2025-05-15 20:38:37 +08:00
coolsnowwolf
706c4df157 luci-app-qmodem: add cell info for TD Tech MT5700M-CN 2025-05-15 19:57:24 +08:00
coolsnowwolf
468f3738b6 luci-app-qmodem: update hisilicon AT commands 2025-05-15 18:52:58 +08:00
GitHub Action
b8490111e7 Update support list 2025-05-15 17:58:36 +08:00
coolsnowwolf
1af23d6068 luci-app-qmodem: add Huawei TD Tech MT5700M-CN support 2025-05-15 17:58:21 +08:00
sfwtw
e376cf5e2a feat: fibocom ca info 2025-05-08 18:34:40 +08:00
sfwtw
ef55ccb262 perf: enhance mtk experience 2025-05-01 20:59:59 +08:00
sfwtw
d813c0be80
feat: scan special modem&mtk v4/v6 check support
feat: scan special modem&mtk v4/v6 check support
2025-04-30 18:48:46 +08:00
GitHub Action
b744a28094 Update support list 2025-04-30 17:00:33 +08:00
sfwtw
53c2a439c6 fix: format modem_support.json 2025-04-30 17:00:02 +08:00
sfwtw
b021f6503b feat: scan special modem support 2025-04-30 16:36:45 +08:00
micc
644530969e
Update README.md (#38) 2025-04-30 10:05:21 +08:00
GitHub Action
ca6dd29087 Update support list 2025-04-28 23:06:10 +08:00
sfwtw
3f6eac6826 feat: mtk v4/v6 check 2025-04-28 23:03:32 +08:00
fujr
5c57f59595 fix: update push branches to include all branches in workflow 2025-04-28 22:40:40 +08:00
sfwtw
c8b803c41d fix: dail, rate_convert and uci Entry not found 2025-04-28 15:29:50 +08:00
sfwtw
40b3c450fb feat: modem soft reboot support 2025-04-27 21:12:19 +08:00
sfwtw
f21eb3b3e9 feat: add pcie dial support for rw350r-gl and other mtk_t7xx devices 2025-04-27 15:37:04 +08:00
x-shark
ce8cae0f69
Feature/neighbor cell (#37) 2025-04-27 12:11:33 +08:00
fujr
3d9bca5f12 github_action: fix crash on pr;and update policy to be triggered by all branch 2025-04-26 19:19:11 +08:00
GitHub Action
7d49e14c13 Update support list 2025-04-25 22:41:34 +08:00
Fu Jianrong
1645111df8
Add EP06/EM12 support (#36)
add Quectel EP06 and EM12 support.
Qualcomm module don't have NCM mode, remove that.

Co-authored-by: Jason Huang <akw2312@gmail.com>
2025-04-25 22:41:22 +08:00
fujr
e50047ac9d update workflow 2025-04-24 21:58:10 +08:00
GitHub Action
39d7176f0a Update support list 2025-04-24 21:42:34 +08:00
fujr
ae81355ce0 update update_support_list.py to improve markdown output format and enhance release notes clarity 2025-04-24 21:42:16 +08:00
fujr
6beb96dae1 update workflow 2025-04-24 21:37:32 +08:00
fujr
fca06a247b update readme 2025-04-24 21:35:31 +08:00
fujr
c4ebb71bc7 tom_modem: fix sms_send operation 2025-04-23 16:37:43 +08:00
MDSDTech
d2cbc2c0fd
Update modem_support.json added new vendor and product id of T99W175 (#34) 2025-04-23 12:17:48 +08:00
fujr
fcf044a719 at_command: add simcom AT command references 2025-04-22 22:02:32 +08:00
fujr
39227f66d0 tom_modem: enhance user input parsing and update usage instructions 2025-04-22 17:53:36 +08:00
fujr
31a6343467 modem_info: update 2025-04-22 14:43:02 +08:00
fujr
5db7be6d27 modem_network: set respawn parameters for modem dial instance 2025-04-22 14:04:33 +08:00
fujr
20022805ab tom_modem: add greedy read feature and dynamic at_message mem alloc 2025-04-19 14:01:09 +08:00
LINGJP
c76c791574
add declaration-after-statement warning options 2025-04-19 00:57:12 +08:00
fujr
9b09e14a23 tom_modem: improved stability 2025-04-19 00:08:57 +08:00
coolsnowwolf
e4f867a6d2 luci-app-qmodem: ip6class paramaters not stored consistently in lan network config 2025-04-18 22:20:44 +08:00
GitHub Action
e3e688f613 Update support list 2025-04-18 17:51:32 +08:00
Fu Jianrong
cd9a0e50ab
support list: fix typo 2025-04-18 17:51:22 +08:00
LINGJP
a2b9030c7a
add EM9190 pcie support. 2025-04-18 17:32:40 +08:00
Fu Jianrong
e200477a41
modem_scan: fix typo 2025-04-18 14:54:18 +08:00
x-shark
f8768aca28 sim8380g-m2 modem_scan: fix modem_name get,add pcimode get_mode 2025-04-18 00:06:03 +00:00
fujr
59b28a62fd modem_scan:resolve unexpected exit when associated USB is configured but not present. 2025-04-17 23:07:17 +08:00
GitHub Action
b5943f3bc8 Update support list 2025-04-16 22:08:54 +08:00
x-shark
2712ae6ebf feat: add sim8380g-m2 pcie mode,fix mhi pcie scan 2025-04-16 14:07:50 +00:00
Fu Jianrong
b6209f8768
Update README.md 2025-04-16 17:53:27 +08:00
fujr
8ec555b3a6 Readme: Update readme. 2025-04-16 16:14:42 +08:00
63 changed files with 5656 additions and 989 deletions

View File

@ -7,10 +7,6 @@ assignees: ''
---
以下是问题报告模板,包含中文和英文翻译:
---
**描述问题**
提供模组型号、路由器平台、路由器系统发行版等信息
**Describe the Issue**
@ -40,30 +36,75 @@ Describe what the normal behavior should be.
---
**日志信息**
请在终端执行以下命令并将结果粘贴到此处
请在终端执行以下命令并将结果粘贴到对应的折叠代码块中
**Log Information**
Please execute the following commands in the terminal and paste the results below:
Please execute the following commands in the terminal and paste the results into the corresponding collapsible code blocks below:
<details>
<summary>模组配置 (Module Configuration)</summary>
```bash
uci show qmodem
# 显示模组配置
# Show module configuration
```
粘贴结果到此处
Paste the output here
```
```
</details>
<details>
<summary>网络配置 (Network Configuration)</summary>
```bash
uci show network
# 显示网络配置
# Show network configuration
```
粘贴结果到此处
Paste the output here
```
```
</details>
<details>
<summary>系统日志 (System Logs)</summary>
```bash
logread
# 查看系统日志
# View system logs
```
粘贴结果到此处
Paste the output here
```
```
</details>
<details>
<summary>内核日志 (Kernel Logs)</summary>
```bash
dmesg
# 查看内核日志
# View kernel logs
```
如果是USB模组相关的问题执行以下命令
**If the issue is related to USB modules, execute the following command:**
粘贴结果到此处
Paste the output here
```
```
</details>
如果是USB模组相关的问题执行以下命令并填写结果
**If the issue is related to USB modules, execute the following command and paste the output:**
<details>
<summary>USB设备信息 (USB Devices)</summary>
```bash
lsusb
@ -71,8 +112,17 @@ lsusb
# List USB devices
```
如果是PCIe模组相关的问题执行以下命令
**If the issue is related to PCIe modules, execute the following command:**
粘贴结果到此处
Paste the output here
```
```
</details>
如果是PCIe模组相关的问题执行以下命令并填写结果
**If the issue is related to PCIe modules, execute the following command and paste the output:**
<details>
<summary>PCIe设备信息 (PCIe Devices)</summary>
```bash
lspci
@ -80,8 +130,17 @@ lspci
# List PCIe devices
```
如果模组扫描存在问题,执行以下命令:
**If there is an issue with module scanning, execute the following command:**
粘贴结果到此处
Paste the output here
```
```
</details>
如果模组扫描存在问题,执行以下命令并填写结果:
**If there is an issue with module scanning, execute the following command and paste the output:**
<details>
<summary>模组扫描 (Module Scanning)</summary>
```bash
/usr/share/qmodem/modem_scan.sh scan
@ -89,4 +148,8 @@ lspci
# Scan modules
```
---
粘贴结果到此处
Paste the output here
```
```
</details>

View File

@ -1,4 +1,4 @@
SDK_NAME=openwrt-sdk-mvebu-cortexa53_gcc-13.3.0_musl.Linux-x86_64
SDK_NAME=openwrt-sdk-mvebu-cortexa53_gcc-14.3.0_musl.Linux-x86_64
SDK_EXT=tar.zst
SDK_URL=https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa53/
SDK_ARCH=aarch64_cortex-a53

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

@ -2,8 +2,17 @@ name: "Auto compile with OpenWrt SDK"
on:
workflow_dispatch:
push:
branches:
- '*'
tags:
- 'v*'
paths-ignore:
- "docs/**"
- "README.md"
- "README.en.md"
- ".github/workflows/**"
- ".github/**"
pull_request:
branches:
- main
paths-ignore:
@ -23,6 +32,7 @@ jobs:
branch_name: ${{ env.branch_name }}
tag_name: ${{ env.tag_name }}
push_type: ${{ env.push_type }}
is_pr: ${{ env.is_pr }}
steps:
- name: Determine push type
@ -36,6 +46,8 @@ jobs:
echo "branch_name=${{ github.ref_name }}" >> $GITHUB_ENV
echo "push_type=branch" >> $GITHUB_ENV
fi
is_pr=$([[ "${{ github.event_name }}" == "pull_request" ]] && echo 1 || echo 0)
echo "is_pr=${is_pr}" >> $GITHUB_ENV
- name: Checkout
if:
@ -43,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_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
@ -163,6 +165,7 @@ jobs:
name: Release Artifacts
needs: [job_build_qmodem, job_prepare]
runs-on: ubuntu-latest
if: ${{ needs.job_prepare.outputs.push_type == 'tag' }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
@ -188,7 +191,7 @@ jobs:
done
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@v2.2.2
if: ${{ needs.job_prepare.outputs.push_type == 'tag' }}
with:
body_path: release_note/release_note.md

View File

@ -1,9 +1,6 @@
CONFIG_PACKAGE_luci-app-qmodem=m
CONFIG_PACKAGE_luci-app-qmodem_USE_TOM_CUSTOMIZED_QUECTEL_CM=m
CONFIG_PACKAGE_luci-app-qmodem-mwan=m
CONFIG_PACKAGE_luci-app-qmodem-sms=m
CONFIG_PACKAGE_luci-app-qmodem-ttl=m
CONFIG_PACKAGE_luci-i18n-qmodem-mwan-zh-cn=m
CONFIG_PACKAGE_luci-i18n-qmodem-ru=m
CONFIG_PACKAGE_luci-i18n-qmodem-sms-zh-cn=m
CONFIG_PACKAGE_luci-i18n-qmodem-zh-cn=m

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,4 +1,2 @@
luci-app-qmodem
luci-app-qmodem-sms
luci-app-qmodem-mwan
luci-app-qmodem-ttl

View File

@ -1,4 +1,4 @@
SDK_NAME=openwrt-sdk-x86-64_gcc-13.3.0_musl.Linux-x86_64
SDK_NAME=openwrt-sdk-x86-64_gcc-14.3.0_musl.Linux-x86_64
SDK_URL=https://downloads.openwrt.org/snapshots/targets/x86/64/
SDK_ARCH=x86_64
SDK_EXT=tar.zst

View File

@ -1,10 +1,14 @@
# 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)
QModem is a module management plugin compatible with OpenWRT version 21 and later. Developed in Lua, it is compatible with QWRT/LEDE/Immortalwrt/OpenWRT.
(For js luci, please add the luci-compat package.)
[TOC]
[Support List](./docs/support_list.md)
[toc]
# Quick Start
@ -14,15 +18,15 @@ To use QModem, you first need to add a feed source in OpenWRT:
```shell
echo >> feeds.conf.default
echo 'src-git modem https://github.com/FUjr/modem_feeds.git;main' >> feeds.conf.default
./scripts/feeds update modem
./scripts/feeds install -a -p modem
echo 'src-git modem https://github.com/FUjr/QModem.git;main' >> feeds.conf.default
./scripts/feeds update qmodem
./scripts/feeds install -a -p qmodem
```
Force update library drivers (use this library drivers):
Force update library drivers (use this library's drivers):
```shell
./scripts/feeds install -a -f -p modem
./scripts/feeds install -a -f -p qmodem
```
## Integrate Packages
@ -37,18 +41,19 @@ make menuconfig
In the configuration menu, you can select the following packages (all under Luci/Application):
| Package Name | Functionality |
| ------------------------------------- | :---------------------------------------: |
| **luci-app-qmodem** | Provides module info, dialing settings, and advanced settings. Other features depend on this main program (backend included here). |
| **Add Lua Luci Homepage** | Adds Lua Luci homepage. If using luci2 (Js Luci) and selected, there will be two homepages. |
| **QMI Driver Selection** | Choose between Generic QMI driver or Vendor QMI driver. |
| Package Name | Functionality |
| ------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| **luci-app-qmodem** | Provides module info, dialing settings, and advanced settings. Other features depend on this main program (backend included here). |
| **Add Lua Luci Homepage** | Adds Lua Luci homepage. If using luci2 (Js Luci) and selected, there will be two homepages. |
| **QMI Driver Selection** | Choose between Generic QMI driver or Vendor QMI driver. |
| **Quectel Connect Manager Selection** | Choose one of:<br>- Tom customized Quectel CM: With options to block default route addition and resolv.conf modification<br>- QWRT quectel-CM-5G: Uses QWRT's quectel-CM-5G<br>- NORMAL quectel-cm: Uses the standard quectel-cm |
| **Add PCIe Modem SUPPORT** | Select PCIe driver, requires kmod_mhi in feeds. |
| **Add Qfirehose SUPPORT** | Add Qfirehose support for Qualcomm chip module firmware upgrade. |
| **luci-app-qmodem-hc** | Supports hc-g80 SIM card switching, exclusive to specific devices. |
| **luci-app-qmodem-mwan** | Supports multi-WAN settings. |
| **luci-app-qmodem-sms** | SMS sending feature. |
| **luci-app-qmodem-ttl** | TTL rewrite functionality. |
| **Add PCIe Modem SUPPORT** | Select PCIe driver, requires kmod_mhi in feeds. |
| **Add Qfirehose SUPPORT** | Add Qfirehose support for Qualcomm chip module firmware upgrade. |
| **luci-app-qmodem-hc** | Supports hc-g80 SIM card switching, exclusive to specific devices. |
| **luci-app-qmodem-mwan** | Supports multi-WAN settings. |
| **luci-app-qmodem-sms** | SMS sending feature. |
| **luci-app-qmodem-ttl** | TTL rewrite functionality. |
# Project Introduction
@ -103,51 +108,67 @@ Provides global configuration options for unified module settings.
This page is the **MWAN Configuration** interface, helping users manage multiple WAN connections by monitoring specific IPs to ensure network stability and reliability. Users can customize connection priorities and interfaces for load balancing or failover.
| Feature | Description |
|---------------------|--------------------------------------------------------------------|
| **Enable MWAN** | |
| Same Source Address | Ensures traffic from the same source uses the same WAN port for a set time. |
| **IPv4 Configuration** | |
| Interface | Select WAN interfaces (e.g., `wan`, `usb0`) for different network connections. |
| Tracking IP | Enter specific IP addresses or domain names to monitor. |
| Priority | Set connection priority (1 to 255); lower values mean higher priority. |
| Feature | Description |
| ---------------------- | ----------------------------------------------------------------------------- |
| **Enable MWAN** | |
| Same Source Address | Ensures traffic from the same source uses the same WAN port for a set time. |
| **IPv4 Configuration** | |
| Interface | Select WAN interfaces (e.g.,`wan`, `usb0`) for different network connections. |
| Tracking IP | Enter specific IP addresses or domain names to monitor. |
| Priority | Set connection priority (1 to 255); lower values mean higher priority. |
## QModem Settings
| Configuration | Description |
|------------------------------|--------------------------------------------------------------------|
| **Disable Auto-Load/Remove** | Disables all features below. |
| **Enable PCIe Module Scan** | Scans PCIe interfaces at startup (time-consuming). |
| **Enable USB Module Scan** | Scans USB interfaces at startup (time-consuming). |
| **Monitor Configured USB Ports** | Monitors USB hot-plug events for configured slots. |
| **Monitor Configured PCIe Ports** | Scans PCIe ports at startup for configured slots. |
| Configuration | Description |
| --------------------------------- | -------------------------------------------------- |
| **Disable Auto-Load/Remove** | Disables all features below. |
| **Enable PCIe Module Scan** | Scans PCIe interfaces at startup (time-consuming). |
| **Enable USB Module Scan** | Scans USB interfaces at startup (time-consuming). |
| **Monitor Configured USB Ports** | Monitors USB hot-plug events for configured slots. |
| **Monitor Configured PCIe Ports** | Scans PCIe ports at startup for configured slots. |
### Slot Configuration
This page allows users to configure each slot.
| Configuration | Description |
|-------------------------------|--------------------------------------------------------------------|
| **Slot Type** | Choose the slot type (PCIe/USB) for device identification. |
| **Slot ID** | Enter the device's unique identifier (e.g., `0001:11:00.0[pcie]`). |
| **SIM Card Indicator** | Bind slot to corresponding indicator light for SIM card status. |
| **Network Indicator** | Bind slot to network status indicator for monitoring connection status. |
| **Enable 5G to Ethernet** | Enables communication via network interface for supported modules. |
| **Associated USB** | Associates USB ports with PCIe ports for better AT communication compatibility. |
| Configuration | Description |
| ------------------------- | ------------------------------------------------------------------------------- |
| **Slot Type** | Choose the slot type (PCIe/USB) for device identification. |
| **Slot ID** | Enter the device's unique identifier (e.g.,`0001:11:00.0[pcie]`). |
| **SIM Card Indicator** | Bind slot to corresponding indicator light for SIM card status. |
| **Network Indicator** | Bind slot to network status indicator for monitoring connection status. |
| **Enable 5G to Ethernet** | Enables communication via network interface for supported modules. |
| **Associated USB** | Associates USB ports with PCIe ports for better AT communication compatibility. |
### Module Configuration
This page allows users to modify module configurations. It is an advanced feature, and incorrect usage may cause the device to malfunction. The primary purpose is to manually add modules not in the compatibility list.
The configuration introduces `post_init` and `pre_dial` options, allowing users to set custom delays and send custom AT commands after module initialization or before dialing. Other options are self-explanatory.
## Development Plan
| Plan | Progress |
|-------------------------------------------|----------------------|
| Separate backend from luci-app completely | 0% |
| Switch to js luci | 5% |
| Plan | Progress |
| ------------------------------------------- | -------- |
| Separate backend from luci-app completely | 0% |
| Switch to js luci | 5% |
| Support more modules | 0% |
| Use at_daemon to monitor module AT events | 5% |
| Add phone functionality | 0% |
| Improve documentation | 0% |
| Add diagnostic features for user debugging | 0% |
| Add contributor and maintainer info in code | 0% |
# Acknowledgments
During the development of the module management plugin, the following repositories were referenced:
| Project | Reference Content |
|--------------------------------------------|-----------------------------------------|
| Project | Reference Content |
| -------------------------------------------- | --------------------------------------- |
| https://github.com/Siriling/5G-Modem-Support | Module list and some AT implementations |
| https://github.com/fujr/luci-app-4gmodem | Adopted many ideas from this project |
| https://github.com/obsy/sms_tool | AT command sending tool |

View File

@ -1,4 +1,24 @@
# 舔狗计划
最近刚追到高中时期的白月光✨,脑子里全是和妹妹聊天的剧本📖。
工作基本停摆了,游戏也卸了,连熬夜刷剧都不敢了,怕眼圈太黑影响形象👀。
等我谈稳定了👫,再说要不要恢复正常更新!
为了追🌸白月光🌸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)
以前我在github上抄代码作者跟我说点个star我都会说好好好但是编译完了刷机后也没想起来点star其实这样挺不好的。
现在作者跟我说点个star除非代码真的很好到我想打好评的程度否则我就会在issue直接说抱歉我不想star然后直接抄。作为一个有讨好倾向的人这就是我锻炼真诚和勇气的方式
@ -21,15 +41,15 @@
```shell
echo >> feeds.conf.default
echo 'src-git modem https://github.com/FUjr/modem_feeds.git;main' >> feeds.conf.default
./scripts/feeds update modem
./scripts/feeds install -a -p modem
echo 'src-git qmodem https://github.com/FUjr/QModem.git;main' >> feeds.conf.default
./scripts/feeds update qmodem
./scripts/feeds install -a -p qmodem
```
强制更新库驱动 (使用本库驱动):
```shell
./scripts/feeds install -a -f -p modem
./scripts/feeds install -a -f -p qmodem
```
## 集成软件包
@ -153,11 +173,17 @@ make menuconfig
## 开发计划
欢迎大家参与贡献,目前计划如下:
| 计划 | 进度 |
| ---------------------------- | ---- |
| 将后端程序与luci-app完全分离 | 0 |
| 切换js luci | 5% |
| 支持更多模组 | 0 |
| 使用at_daemon 用于监听模组主动发送的at事件 | 5% |
| 电话功能 | 0 |
| 完善(开发和使用)文档 | 0 |
| 增加诊断功能,便于用户复制信息 | 0 |
|在代码中添加贡献者和维护者信息 | 0 |
# 鸣谢

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

@ -314,6 +314,11 @@ typedef struct _QMI_TLV
#define QMUX_CTL_FLAG_TYPE_IND 0x04
#define QMUX_CTL_FLAG_MASK_COMPOUND 0x01
#define QMUX_CTL_FLAG_MASK_TYPE 0x06 // 00-cmd, 01-rsp, 10-ind
// Add these definitions to the DMS message types section
#define QMIDMS_FOXCONN_SET_FCC_AUTH_REQ 0x555C
#define QMIDMS_FOXCONN_SET_FCC_AUTH_RESP 0x555C
#define QMIDMS_FOXCONN_SET_FCC_AUTH_V2_REQ 0x555D
#define QMIDMS_FOXCONN_SET_FCC_AUTH_V2_RESP 0x555D
#pragma pack(pop)

View File

@ -399,25 +399,25 @@ typedef struct _QCTLV_PKT_STATISTICS
//#ifdef QC_IP_MODE
/*
â?Bit 0 â?Profile identifier
â?Bit 1 â?Profile name
â?Bit 2 â?PDP type
â?Bit 3 â?APN name
â?Bit 4 â?DNS address
â?Bit 5 â?UMTS/GPRS granted QoS
â?Bit 6 â?Username
â?Bit 7 â?Authentication Protocol
â?Bit 8 â?IP address
â?Bit 9 â?Gateway information (address and subnet mask)
â?Bit 10 â?PCSCF address using a PCO flag
â?Bit 11 â?PCSCF server address list
â?Bit 12 â?PCSCF domain name list
â?Bit 13 â?MTU
â?Bit 14 â?Domain name list
â?Bit 15 â?IP family
â?Bit 16 â?IM_CM flag
â?Bit 17 â?Technology name
â?Bit 18 â?Operator reserved PCO
<EFBFBD>?Bit 0 <EFBFBD>?Profile identifier
<EFBFBD>?Bit 1 <EFBFBD>?Profile name
<EFBFBD>?Bit 2 <EFBFBD>?PDP type
<EFBFBD>?Bit 3 <EFBFBD>?APN name
<EFBFBD>?Bit 4 <EFBFBD>?DNS address
<EFBFBD>?Bit 5 <EFBFBD>?UMTS/GPRS granted QoS
<EFBFBD>?Bit 6 <EFBFBD>?Username
<EFBFBD>?Bit 7 <EFBFBD>?Authentication Protocol
<EFBFBD>?Bit 8 <EFBFBD>?IP address
<EFBFBD>?Bit 9 <EFBFBD>?Gateway information (address and subnet mask)
<EFBFBD>?Bit 10 <EFBFBD>?PCSCF address using a PCO flag
<EFBFBD>?Bit 11 <EFBFBD>?PCSCF server address list
<EFBFBD>?Bit 12 <EFBFBD>?PCSCF domain name list
<EFBFBD>?Bit 13 <EFBFBD>?MTU
<EFBFBD>?Bit 14 <EFBFBD>?Domain name list
<EFBFBD>?Bit 15 <EFBFBD>?IP family
<EFBFBD>?Bit 16 <EFBFBD>?IM_CM flag
<EFBFBD>?Bit 17 <EFBFBD>?Technology name
<EFBFBD>?Bit 18 <EFBFBD>?Operator reserved PCO
*/
#define QMIWDS_GET_RUNTIME_SETTINGS_MASK_IPV4DNS_ADDR (1 << 4)
#define QMIWDS_GET_RUNTIME_SETTINGS_MASK_IPV4_ADDR (1 << 8)
@ -4067,6 +4067,25 @@ typedef struct _QMIUIM_SET_CARD_SLOT_REQ_MSG
#define QMI_COEX_GET_WWAN_STATE_REQ 0x22
#define QMI_COEX_GET_WWAN_STATE_RESP 0x22
// Add these structure definitions after existing message structures
#ifdef CONFIG_FOXCONN_FCC_AUTH
typedef struct _QMIDMS_FOXCONN_SET_FCC_AUTH_REQ_MSG
{
USHORT Type;
USHORT Length;
UCHAR TLVType;
USHORT TLVLength;
UCHAR magic_value;
} __attribute__ ((packed)) QMIDMS_FOXCONN_SET_FCC_AUTH_REQ_MSG, *PQMIDMS_FOXCONN_SET_FCC_AUTH_REQ_MSG;
typedef struct _QMIDMS_FOXCONN_SET_FCC_AUTH_V2_REQ_MSG
{
USHORT Type;
USHORT Length;
} __attribute__ ((packed)) QMIDMS_FOXCONN_SET_FCC_AUTH_V2_REQ_MSG, *PQMIDMS_FOXCONN_SET_FCC_AUTH_V2_REQ_MSG;
#endif
typedef struct {
uint32_t freq;
@ -4293,6 +4312,10 @@ typedef struct _QMUX_MSG
QMIWDS_ADMIN_SET_DATA_FORMAT_REQ_MSG SetDataFormatReq;
QMI_WDA_SET_LOOPBACK_CONFIG_REQ_MSG SetLoopBackReq;
QMI_WDA_SET_LOOPBACK_CONFIG_IND_MSG SetLoopBackInd;
#ifdef CONFIG_FOXCONN_FCC_AUTH
QMIDMS_FOXCONN_SET_FCC_AUTH_REQ_MSG FoxconnSetFccAuthReq;
QMIDMS_FOXCONN_SET_FCC_AUTH_V2_REQ_MSG FoxconnSetFccAuthV2Req;
#endif
};
} __attribute__ ((packed)) QMUX_MSG, *PQMUX_MSG;

View File

@ -1832,6 +1832,88 @@ static int requestQueryDataCall(UCHAR *pConnectionStatus, int curIpFamily) {
return 0;
}
// Add these implementations after existing function implementations
#ifdef CONFIG_FOXCONN_FCC_AUTH
// Make sure these functions are static to avoid symbol conflicts
static USHORT DmsFoxconnSetFccAuthenticationReq(PQMUX_MSG pMUXMsg, void *arg) {
UCHAR magic_value = *((UCHAR *)arg);
pMUXMsg->FoxconnSetFccAuthReq.TLVType = 0x01;
pMUXMsg->FoxconnSetFccAuthReq.TLVLength = cpu_to_le16(1);
pMUXMsg->FoxconnSetFccAuthReq.magic_value = magic_value;
return sizeof(QMIDMS_FOXCONN_SET_FCC_AUTH_REQ_MSG);
}
static USHORT DmsFoxconnSetFccAuthenticationV2Req(PQMUX_MSG pMUXMsg, void *arg) {
FOXCONN_FCC_AUTH_V2_T *fcc_auth = (FOXCONN_FCC_AUTH_V2_T *)arg;
USHORT TLVLength = 0;
UCHAR *pTLV;
pTLV = (UCHAR *)(&pMUXMsg->FoxconnSetFccAuthV2Req + 1);
// Magic string TLV (0x01)
*pTLV++ = 0x01; // TLV Type
*(USHORT *)pTLV = cpu_to_le16(strlen(fcc_auth->magic_string));
pTLV += 2;
memcpy(pTLV, fcc_auth->magic_string, strlen(fcc_auth->magic_string));
pTLV += strlen(fcc_auth->magic_string);
TLVLength += 3 + strlen(fcc_auth->magic_string);
// Magic number TLV (0x02)
*pTLV++ = 0x02; // TLV Type
*(USHORT *)pTLV = cpu_to_le16(1);
pTLV += 2;
*pTLV++ = fcc_auth->magic_number;
TLVLength += 4;
return sizeof(QMIDMS_FOXCONN_SET_FCC_AUTH_V2_REQ_MSG) + TLVLength;
}
// These functions should NOT be static since they're used externally
int requestFoxconnSetFccAuthentication(UCHAR magic_value) {
PQCQMIMSG pRequest;
PQCQMIMSG pResponse;
PQMUX_MSG pMUXMsg;
int err;
dbg_time("%s(magic_value=0x%02x)", __func__, magic_value);
pRequest = ComposeQMUXMsg(QMUX_TYPE_DMS, QMIDMS_FOXCONN_SET_FCC_AUTH_REQ, DmsFoxconnSetFccAuthenticationReq, &magic_value);
err = QmiThreadSendQMI(pRequest, &pResponse);
qmi_rsp_check_and_return();
free(pResponse);
return 0;
}
int requestFoxconnSetFccAuthenticationV2(const char *magic_string, UCHAR magic_number) {
PQCQMIMSG pRequest;
PQCQMIMSG pResponse;
PQMUX_MSG pMUXMsg;
int err;
FOXCONN_FCC_AUTH_V2_T fcc_auth;
dbg_time("%s(magic_string='%s', magic_number=0x%02x)", __func__, magic_string, magic_number);
if (!magic_string || strlen(magic_string) >= sizeof(fcc_auth.magic_string)) {
dbg_time("%s: Invalid magic_string", __func__);
return -1;
}
strcpy(fcc_auth.magic_string, magic_string);
fcc_auth.magic_number = magic_number;
pRequest = ComposeQMUXMsg(QMUX_TYPE_DMS, QMIDMS_FOXCONN_SET_FCC_AUTH_V2_REQ, DmsFoxconnSetFccAuthenticationV2Req, &fcc_auth);
err = QmiThreadSendQMI(pRequest, &pResponse);
qmi_rsp_check_and_return();
free(pResponse);
return 0;
}
#endif
static int requestSetupDataCall(PROFILE_T *profile, int curIpFamily) {
PQCQMIMSG pRequest;
PQCQMIMSG pResponse;
@ -2271,6 +2353,17 @@ static int requestBaseBandVersion(PROFILE_T *profile) {
{
uchar2char(profile->BaseBandVersion, sizeof(profile->BaseBandVersion), &revId->RevisionID, le16_to_cpu(revId->TLVLength));
dbg_time("%s %s", __func__, profile->BaseBandVersion);
#ifdef CONFIG_FOXCONN_FCC_AUTH
// Check if this modem model needs FCC authentication
if (strstr(profile->BaseBandVersion, "T99W175")) {
profile->needs_fcc_auth = 1;
dbg_time("Modem model %s requires FCC authentication", profile->BaseBandVersion);
} else {
profile->needs_fcc_auth = 0;
dbg_time("Modem model %s does not require FCC authentication", profile->BaseBandVersion);
}
#endif
}
free(pResponse);
@ -2555,6 +2648,10 @@ const struct request_ops qmi_request_ops = {
#ifdef CONFIG_COEX_WWAN_STATE
.requestGetCoexWWANState = requestGetCoexWWANState,
#endif
#ifdef CONFIG_FOXCONN_FCC_AUTH
.requestFoxconnSetFccAuthentication = requestFoxconnSetFccAuthentication,
.requestFoxconnSetFccAuthenticationV2 = requestFoxconnSetFccAuthenticationV2,
#endif
};
#ifdef CONFIG_CELLINFO

View File

@ -20,6 +20,7 @@
//#define CONFIG_REG_QOS_IND
//#define CONFIG_GET_QOS_INFO
//#define CONFIG_GET_QOS_DATA_RATE
#define CONFIG_FOXCONN_FCC_AUTH
#if (defined(CONFIG_REG_QOS_IND) || defined(CONFIG_GET_QOS_INFO) || defined(CONFIG_GET_QOS_DATA_RATE))
#ifndef CONFIG_REG_QOS_IND
@ -249,7 +250,9 @@ typedef struct __PROFILE {
char old_password[64];
int old_auth;
int old_iptype;
#ifdef CONFIG_FOXCONN_FCC_AUTH
int needs_fcc_auth; // Add this field for FCC authentication flag
#endif
const struct qmi_device_ops *qmi_ops;
const struct request_ops *request_ops;
RMNET_INFO rmnet_info;
@ -344,7 +347,20 @@ struct request_ops {
int (*requestRegisterQos)(PROFILE_T *profile);
int (*requestGetQosInfo)(PROFILE_T *profile);
int (*requestGetCoexWWANState)(void);
#ifdef CONFIG_FOXCONN_FCC_AUTH
int (*requestFoxconnSetFccAuthentication)(UCHAR magic_value);
int (*requestFoxconnSetFccAuthenticationV2)(const char *magic_string, UCHAR magic_number);
#endif
};
// Add structure for V2 parameters
#ifdef CONFIG_FOXCONN_FCC_AUTH
typedef struct {
char magic_string[256];
UCHAR magic_number;
} FOXCONN_FCC_AUTH_V2_T;
#endif
extern const struct request_ops qmi_request_ops;
extern const struct request_ops mbim_request_ops;
extern const struct request_ops atc_request_ops;

View File

@ -325,6 +325,38 @@ static int qmi_main(PROFILE_T *profile)
if (request_ops->requestSetEthMode)
request_ops->requestSetEthMode(profile);
#ifdef CONFIG_FOXCONN_FCC_AUTH
// Only execute FCC authentication if the modem model requires it
if (profile->needs_fcc_auth) {
dbg_time("Executing FCC authentication for modem model: %s", profile->BaseBandVersion);
// Check if the fcc auth was successful
char fcc_auth_success = 0;
if (request_ops->requestFoxconnSetFccAuthentication) {
// Use magic value 0x01 as seen in libqmi
qmierr = request_ops->requestFoxconnSetFccAuthentication(0x01);
if (!qmierr) {
dbg_time("Foxconn FCC Authentication successful");
fcc_auth_success = 1;
}
}
if(fcc_auth_success != 1) {
if (request_ops->requestFoxconnSetFccAuthenticationV2) {
// Based on libqmi, use "FOXCONN" as magic string for Foxconn modems
const char *magic_string = "FOXCONN"; // Correct magic string for Foxconn
UCHAR magic_number = 0x01; // Standard magic number from libqmi
qmierr = request_ops->requestFoxconnSetFccAuthenticationV2(magic_string, magic_number);
if (!qmierr) {
dbg_time("Foxconn FCC Authentication V2 successful");
}
}
}
} else {
dbg_time("Skipping FCC authentication - not required for this modem model");
}
#endif
if (request_ops->requestSetLoopBackState && profile->loopback_state) {
qmierr = request_ops->requestSetLoopBackState(profile->loopback_state, profile->replication_factor);
if (qmierr != QMI_ERR_INVALID_QMI_CMD) //X20 return this error

View File

@ -841,6 +841,8 @@ static pthread_mutex_t mbim_command_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t mbim_command_cond = PTHREAD_COND_INITIALIZER;
static int mbim_ms_version = 1;
static uint8_t qmi_over_mbim_nas = 0;
static uint8_t qmi_over_mbim_dms = 0; // Add DMS client ID
int qmi_over_mbim_qmidev_send(PQCQMIMSG pQMI);
static const UUID_T * str2uuid(const char *str) {
@ -1801,6 +1803,16 @@ static int mbim_device_caps_query(PROFILE_T *profile) {
wchar2char((const char *)pInfo + le32toh(pInfo->FirmwareInfoOffset), le32toh(pInfo->FirmwareInfoSize), tmp, sizeof(tmp));
strncpy(profile->BaseBandVersion, tmp, sizeof(profile->BaseBandVersion));
mbim_debug("FirmwareInfo: %s", tmp);
#ifdef CONFIG_FOXCONN_FCC_AUTH
// Check if this modem model needs FCC authentication
if (strstr(profile->BaseBandVersion, "T99W175")) {
profile->needs_fcc_auth = 1;
mbim_debug("Modem model %s requires FCC authentication", profile->BaseBandVersion);
} else {
profile->needs_fcc_auth = 0;
mbim_debug("Modem model %s does not require FCC authentication", profile->BaseBandVersion);
}
#endif
}
if (le32toh(pInfo->HardwareInfoOffset) && le32toh(pInfo->HardwareInfoSize)) {
wchar2char((const char *)pInfo + le32toh(pInfo->HardwareInfoOffset), le32toh(pInfo->HardwareInfoSize), tmp, sizeof(tmp));
@ -2186,6 +2198,11 @@ static int mbim_init(PROFILE_T *profile) {
qmidev_send = qmi_over_mbim_qmidev_send;
#ifdef CONFIG_CELLINFO //by now, only this function need QMI OVER MBIM
qmi_over_mbim_nas = qmi_over_mbim_get_client_id(QMUX_TYPE_NAS);
#endif
#ifdef CONFIG_FOXCONN_FCC_AUTH
// Get DMS client ID for FCC authentication
qmi_over_mbim_dms = qmi_over_mbim_get_client_id(QMUX_TYPE_DMS);
mbim_debug("Got DMS client ID: %d for FCC authentication", qmi_over_mbim_dms);
#endif
}
}
@ -2201,7 +2218,12 @@ static int mbim_deinit(void) {
qmi_over_mbim_release_client_id(QMUX_TYPE_NAS, qmi_over_mbim_nas);
qmi_over_mbim_nas = 0;
}
#ifdef CONFIG_FOXCONN_FCC_AUTH
if (qmi_over_mbim_dms) {
qmi_over_mbim_release_client_id(QMUX_TYPE_DMS, qmi_over_mbim_dms);
qmi_over_mbim_dms = 0;
}
#endif
mbim_close_device();
if (qmi_over_mbim_sk[0] != -1) {
@ -2380,6 +2402,29 @@ static int requestGetCellInfoList(void) {
}
#endif
#ifdef CONFIG_FOXCONN_FCC_AUTH
// Use QMI over MBIM for Foxconn FCC authentication
static int requestFoxconnSetFccAuthentication(UCHAR magic_value) {
if (qmi_over_mbim_support && qmi_request_ops.requestFoxconnSetFccAuthentication) {
mbim_debug("%s(magic_value=0x%02x) via QMI over MBIM", __func__, magic_value);
return qmi_request_ops.requestFoxconnSetFccAuthentication(magic_value);
}
mbim_debug("%s: QMI over MBIM not available for FCC auth", __func__);
return -ENOTSUP;
}
static int requestFoxconnSetFccAuthenticationV2(const char *magic_string, UCHAR magic_number) {
if (qmi_over_mbim_support && qmi_request_ops.requestFoxconnSetFccAuthenticationV2) {
mbim_debug("%s(magic_string='%s', magic_number=0x%02x) via QMI over MBIM", __func__, magic_string, magic_number);
return qmi_request_ops.requestFoxconnSetFccAuthenticationV2(magic_string, magic_number);
}
mbim_debug("%s: QMI over MBIM not available for FCC auth", __func__);
return -ENOTSUP;
}
#endif
const struct request_ops mbim_request_ops = {
.requestBaseBandVersion = requestBaseBandVersion,
.requestGetSIMStatus = requestGetSIMStatus,
@ -2391,6 +2436,10 @@ const struct request_ops mbim_request_ops = {
#ifdef CONFIG_CELLINFO
.requestGetCellInfoList = requestGetCellInfoList,
#endif
#ifdef CONFIG_FOXCONN_FCC_AUTH
.requestFoxconnSetFccAuthentication = requestFoxconnSetFccAuthentication,
.requestFoxconnSetFccAuthenticationV2 = requestFoxconnSetFccAuthenticationV2,
#endif
};
int qmi_over_mbim_qmidev_send(PQCQMIMSG pQMI) {
@ -2402,6 +2451,9 @@ int qmi_over_mbim_qmidev_send(PQCQMIMSG pQMI) {
if (pQMI->QMIHdr.QMIType != QMUX_TYPE_CTL) {
if (pQMI->QMIHdr.QMIType == QMUX_TYPE_NAS)
pQMI->QMIHdr.ClientId = qmi_over_mbim_nas;
else if (pQMI->QMIHdr.QMIType == QMUX_TYPE_DMS)
pQMI->QMIHdr.ClientId = qmi_over_mbim_dms;
if (pQMI->QMIHdr.ClientId == 0) {
dbg_time("QMIType %d has no clientID", pQMI->QMIHdr.QMIType);

View File

@ -3,7 +3,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:= tom_modem
PKG_RELEASE:=1
PKG_VERSION:=1.0.0
PKG_VERSION:=1.0.2
include $(INCLUDE_DIR)/package.mk
@ -28,15 +28,13 @@ define Build/Prepare
$(CP) src/* $(PKG_BUILD_DIR)/
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS)"
endef
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/
endef

View File

@ -1,4 +1,3 @@
#include "main.h"
FDS_T s_fds;
@ -7,11 +6,28 @@ PROFILE_T s_profile; // global profile
int parse_user_input(int argc, char *argv[], PROFILE_T *profile)
{
int opt = 1;
int anonymous_arg = 0;
int option;
profile->sms_index = -1;
#define has_more_argv() (opt < argc ? 1 : 0)
while (opt < argc)
{
if (argv[opt][0] != '-') {
if (anonymous_arg == 0) {
profile->tty_dev = argv[opt];
}
if (anonymous_arg == 1){
profile->at_cmd = argv[opt];
}
if (anonymous_arg >= 2) {
err_msg("Too many anonymous arguments");
return INVALID_PARAM;
}
anonymous_arg++;
opt++;
continue;
}
option = match_option(argv[opt]);
if (option == -1)
{
@ -112,12 +128,21 @@ int parse_user_input(int argc, char *argv[], PROFILE_T *profile)
}
profile->sms_index = atoi(argv[opt++]);
break;
case GREEDY_READ:
profile->greedy_read = 1;
break;
default:
err_msg("Invalid option: %s", argv[opt]);
break;
}
}
// default settings:
if (profile->tty_dev == NULL)
{
usage(argv[0]);
return INVALID_PARAM;
}
if (profile->baud_rate == 0 )
{
profile->baud_rate = 115200;

View File

@ -17,6 +17,7 @@
#define DEBUG_S 'D'
#define SMS_PDU_S 'p'
#define SMS_INDEX_S 'i'
#define GREEDY_READ_S 'g'
#define AT_CMD_L "at_cmd"
#define TTY_DEV_L "tty_dev"
@ -30,6 +31,7 @@
#define DEBUG_L "debug"
#define SMS_PDU_L "sms_pdu"
#define SMS_INDEX_L "sms_index"
#define GREEDY_READ_L "greedy_read"
//operations
#define AT_OP_S 'a'
@ -55,7 +57,7 @@
#define SMS_BUF_SIZE 65536
#define LINE_BUF 1024
#define SMS_LIST_SIZE 128
#define COMMON_BUF_SIZE 16384
#define COMMON_BUF_SIZE 65536
#define PHONE_NUMBER_SIZE 64
#define SMS_TEXT_SIZE 256
#define SMS_PDU_STR_SIZE 512
@ -85,6 +87,7 @@ typedef struct _PROFILE {
int debug;
char *sms_pdu;
int sms_index;
int greedy_read;
} PROFILE_T;
@ -108,6 +111,11 @@ typedef struct _SMS {
char *sms_pdu;
} SMS_T;
typedef struct _AT_MESSAGE {
char *message;
int len;
} AT_MESSAGE_T;
enum ERROR_CODES {
COMM_ERROR = -1,
SUCCESS = 0,
@ -116,6 +124,7 @@ enum ERROR_CODES {
INVALID_PARAM,
INVALID_HEX,
UNKNOWN_ERROR,
BUFFER_OVERFLOW,
};
enum SMS_CHARSET {
@ -135,7 +144,8 @@ enum OPTIONS {
OPERATION,
DEBUG,
SMS_PDU,
SMS_INDEX
SMS_INDEX,
GREEDY_READ
};
enum OPERATIONS {

View File

@ -3,7 +3,7 @@
int at(PROFILE_T *profile,FDS_T *fds)
{
int w_ret,r_ret;
char output[COMMON_BUF_SIZE] = {0};
AT_MESSAGE_T message = {0};
if (profile->at_cmd == NULL)
{
err_msg("AT command is empty");
@ -15,23 +15,26 @@ int at(PROFILE_T *profile,FDS_T *fds)
return w_ret;
}
r_ret = tty_read(fds->fdi, output, COMMON_BUF_SIZE,profile->timeout);
r_ret = tty_read(fds->fdi, &message, profile);
if (r_ret)
{
dbg_msg("Error sending AT command, error code: %d", r_ret);
if (r_ret == COMM_ERROR)
return r_ret;
}
user_msg("%s", output);
if (message.message)
{
user_msg("%s", message.message);
free(message.message);
}
return SUCCESS;
}
int binary_at(PROFILE_T *profile,FDS_T *fds)
{
int w_ret,r_ret,hex_convert_ret;
int binary_at_cmd_len;
char *binary_at_cmd;
char output[COMMON_BUF_SIZE] = {0};
AT_MESSAGE_T message = {0};
if (profile->at_cmd == NULL)
{
err_msg("AT command is empty");
@ -52,18 +55,23 @@ int binary_at(PROFILE_T *profile,FDS_T *fds)
}
w_ret = tty_write_raw(fds->fdo, binary_at_cmd);
free(binary_at_cmd);
if (w_ret)
{
return w_ret;
}
r_ret = tty_read_keyword(fds->fdi, output, COMMON_BUF_SIZE, "OK",profile->timeout);
r_ret = tty_read_keyword(fds->fdi, &message, "OK", profile);
if (r_ret)
{
dbg_msg("Error sending AT command, error code: %d", r_ret);
if (r_ret == COMM_ERROR)
return r_ret;
}
user_msg("%s", output);
if (message.message)
{
user_msg("%s", message.message);
free(message.message);
}
return SUCCESS;
}
@ -83,7 +91,7 @@ int sms_delete(PROFILE_T *profile,FDS_T *fds)
{
return w_ret;
}
r_ret = tty_read_keyword(fds->fdi, NULL, COMMON_BUF_SIZE, "OK",profile->timeout);
r_ret = tty_read_keyword(fds->fdi, NULL, "OK", profile);
if (r_ret)
{
dbg_msg("Error deleting SMS, error code: %d", r_ret);
@ -97,137 +105,143 @@ int sms_read(PROFILE_T *profile,FDS_T *fds)
SMS_T *sms_list[SMS_LIST_SIZE];
SMS_T *sms;
int w_ret,r_ret;
char sms_pdu[SMS_BUF_SIZE] = {0};
AT_MESSAGE_T message = {0};
w_ret = tty_write(fds->fdo, SET_PDU_FORMAT);
if (w_ret)
{
return w_ret;
}
r_ret = tty_read_keyword(fds->fdi, NULL, COMMON_BUF_SIZE, "OK",profile->timeout);
r_ret = tty_read_keyword(fds->fdi, NULL, "OK", profile);
if (r_ret)
{
dbg_msg("Error setting PDU format , error code: %d", r_ret);
dbg_msg("Error setting PDU format, error code: %d", r_ret);
if (r_ret == COMM_ERROR)
{
return r_ret;
}
}
dbg_msg("Set PDU format success");
w_ret = tty_write(fds->fdo, READ_ALL_SMS);
if (w_ret)
{
return w_ret;
}
r_ret = tty_read_keyword(fds->fdi, sms_pdu, SMS_BUF_SIZE, "OK",profile->timeout);
r_ret = tty_read_keyword(fds->fdi, &message, "OK", profile);
if (r_ret)
{
dbg_msg("Error reading SMS , error code: %d", r_ret);
dbg_msg("Error reading SMS, error code: %d", r_ret);
if (r_ret == COMM_ERROR)
return r_ret;
}
//遍历 sms_pdu 的每一行
char *line = strtok(sms_pdu, "\n");
int sms_count = 0;
while (line != NULL)
{
if (strncmp(line, "+CMGL:", 6) == 0)
{
sms = (SMS_T *)malloc(sizeof(SMS_T));
memset(sms, 0, sizeof(SMS_T));
char *pdu = strtok(NULL, "\n");
sms->sms_pdu = (char *)malloc(strlen(pdu));
sms->sender = (char *)malloc(PHONE_NUMBER_SIZE);
sms->sms_text = (char *)malloc(SMS_TEXT_SIZE);
sms->sms_index = get_sms_index(line);
memcpy(sms->sms_pdu, pdu, strlen(pdu));
int sms_len = decode_pdu(sms);
if (sms_len > 0)
{
sms_list[sms_count] = sms;
sms_count++;
}
else
{
dbg_msg("Error decoding sms in line: %s", line);
destroy_sms(sms);
}
return r_ret;
}
line = strtok(NULL, "\n");
}
display_sms_in_json(sms_list,sms_count);
// for (int i = 1; i <= sms_count; i++)
// {
// dump_sms(sms_list[i]);
// destroy_sms(sms_list[i]);
// }
if (message.message)
{
char *line = strtok(message.message, "\n");
int sms_count = 0;
while (line != NULL)
{
if (strncmp(line, "+CMGL:", 6) == 0)
{
sms = (SMS_T *)malloc(sizeof(SMS_T));
memset(sms, 0, sizeof(SMS_T));
char *pdu = strtok(NULL, "\n");
sms->sms_pdu = (char *)malloc(strlen(pdu));
sms->sender = (char *)malloc(PHONE_NUMBER_SIZE);
sms->sms_text = (char *)malloc(SMS_TEXT_SIZE);
sms->sms_index = get_sms_index(line);
memcpy(sms->sms_pdu, pdu, strlen(pdu));
int sms_len = decode_pdu(sms);
if (sms_len > 0)
{
sms_list[sms_count] = sms;
sms_count++;
}
else
{
dbg_msg("Error decoding SMS in line: %s", line);
destroy_sms(sms);
}
}
line = strtok(NULL, "\n");
}
display_sms_in_json(sms_list, sms_count);
free(message.message);
}
dbg_msg("Read SMS success");
dbg_msg("%s", sms_pdu);
return SUCCESS;
}
int sms_send(PROFILE_T *profile,FDS_T *fds)
{
int w_ret,r_ret;
if (profile->sms_pdu == NULL)
{
int sms_send(PROFILE_T *profile, FDS_T *fds) {
int w_ret, r_ret;
AT_MESSAGE_T message = {0};
if (profile->sms_pdu == NULL) {
err_msg("SMS PDU is empty");
return INVALID_PARAM;
}
int pdu_len = strlen(profile->sms_pdu);
int pdu_expected_len = (pdu_len) / 2 - 1;
char *send_sms_cmd;
char *write_pdu_cmd;
char *send_sms_cmd = (char *)malloc(32);
char *write_pdu_cmd = (char *)malloc(256);
w_ret = tty_write(fds->fdo, SET_PDU_FORMAT);
if (w_ret)
{
if (w_ret) {
free(send_sms_cmd);
free(write_pdu_cmd);
return w_ret;
}
r_ret = tty_read_keyword(fds->fdi, NULL, COMMON_BUF_SIZE, "OK",profile->timeout);
if (r_ret)
{
dbg_msg("Error setting PDU format , error code: %d", r_ret);
if (r_ret == COMM_ERROR)
return r_ret;
// Set PDU format response
r_ret = tty_read_keyword(fds->fdi, NULL, "OK", profile);
if (r_ret) {
dbg_msg("Error setting PDU format, error code: %d", r_ret);
free(send_sms_cmd);
free(write_pdu_cmd);
return r_ret;
}
dbg_msg("Set PDU format success");
send_sms_cmd = (char *)malloc(32);
write_pdu_cmd = (char *)malloc(256);
snprintf(send_sms_cmd, 32, SEND_SMS, pdu_expected_len);
dbg_msg("Send SMS command: %s", send_sms_cmd);
snprintf(write_pdu_cmd, 256, "%s%c", profile->sms_pdu, 0x1A);
dbg_msg("Send SMS command: %s", send_sms_cmd);
dbg_msg("Write PDU command: %s", write_pdu_cmd);
w_ret = tty_write(fds->fdo, send_sms_cmd);
if (w_ret)
{
if (w_ret) {
free(send_sms_cmd);
free(write_pdu_cmd);
return w_ret;
}
r_ret = tty_read_keyword(fds->fdi, NULL, COMMON_BUF_SIZE, ">",profile->timeout);
if (r_ret)
{
r_ret = tty_read_keyword(fds->fdi, NULL, ">", profile);
//waiting for > prompt
if (r_ret) {
dbg_msg("Error sending SMS STEP 1, error code: %d", r_ret);
if (r_ret == COMM_ERROR)
return COMM_ERROR;
}
usleep(10000);
w_ret = tty_write(fds->fdo, write_pdu_cmd);
if (w_ret)
{
if (w_ret) {
free(send_sms_cmd);
free(write_pdu_cmd);
return w_ret;
}
r_ret = tty_read_keyword(fds->fdi, NULL, COMMON_BUF_SIZE, "+CMGS:",profile->timeout);
if (r_ret)
{
dbg_msg("Error sending SMS STEP 2, error code: %d", r_ret);
if (r_ret == COMM_ERROR)
return COMM_ERROR;
}
free(send_sms_cmd);
free(write_pdu_cmd);
return 0;
r_ret = tty_read_keyword(fds->fdi, NULL, "+CMGS:", profile);
if (r_ret) {
dbg_msg("Error sending SMS STEP 2, error code: %d", r_ret);
return r_ret;
}
return SUCCESS;
}

View File

@ -5,8 +5,8 @@
#include "utils.h"
int str_to_hex(char *str, char *hex);
int tty_open_device(PROFILE_T *profile, FDS_T *fds);
int tty_read(FILE *fdi, char *output, int len, int soft_timeout);
int tty_read_keyword(FILE *fdi, char *output, int len, char *key_word, int soft_timeout);
int tty_read(FILE *fdi, AT_MESSAGE_T *message, PROFILE_T *profile);
int tty_read_keyword(FILE *fdi, AT_MESSAGE_T *message, char *key_word, PROFILE_T *profile);
int tty_write_raw(FILE *fdo, char *input);
int tty_write(FILE *fdo, char *input);
#endif

View File

@ -91,6 +91,15 @@ int tty_open_device(PROFILE_T *profile,FDS_T *fds)
err_msg("Error setting tty device");
return COMM_ERROR;
}
fds->tty_fd = open(profile->tty_dev, O_RDWR | O_NOCTTY | O_NONBLOCK);
fds->fdi = fdopen(fds->tty_fd, "r");
if (setvbuf(fds->fdi , NULL, _IOFBF, 0))
{
err_msg("Error setting buffer for fdi");
return COMM_ERROR;
}
usleep(10000);
tcflush(fds->tty_fd, TCIOFLUSH);
if (fds->tty_fd >= 0)
close(fds->tty_fd);
@ -119,70 +128,84 @@ int tty_open_device(PROFILE_T *profile,FDS_T *fds)
return SUCCESS;
}
int tty_read(FILE *fdi, char *output, int len, int soft_timeout)
{
return tty_read_keyword(fdi, output, len, NULL, soft_timeout);
int tty_read(FILE *fdi, AT_MESSAGE_T *message, PROFILE_T *profile) {
return tty_read_keyword(fdi, message, NULL, profile);
}
int tty_read_keyword(FILE *fdi, char *output, int len, char *key_word, int soft_timeout)
{
int tty_read_keyword(FILE *fdi, AT_MESSAGE_T *message, char *key_word, PROFILE_T *profile) {
char tmp[LINE_BUF] = {0};
int msg_len = 0;
char *dynamic_buffer = NULL;
int buffer_size = 0;
int read_flag = 0;
time_t start_time = time(NULL);
int exitcode = TIMEOUT_WAITING_NEWLINE;
while (difftime(time(NULL), start_time) < soft_timeout)
{
while (difftime(time(NULL), start_time) < profile->timeout) {
memset(tmp, 0, LINE_BUF);
if (fgets(tmp, LINE_BUF, fdi))
{
if (fgets(tmp, LINE_BUF, fdi)) {
read_flag = 1;
dbg_msg("%s", tmp);
if (output != NULL)
msg_len += snprintf(output + msg_len, len - msg_len, "%s", tmp);
if (profile->greedy_read && strlen(tmp) > 0) {
start_time = time(NULL);
}
if (message != NULL) {
int tmp_len = strlen(tmp);
char *new_buffer = realloc(dynamic_buffer, buffer_size + tmp_len + 1);
if (!new_buffer) {
free(dynamic_buffer);
err_msg("Error: memory allocation failed");
exitcode = BUFFER_OVERFLOW;
break;
}
dynamic_buffer = new_buffer;
memcpy(dynamic_buffer + buffer_size, tmp, tmp_len);
buffer_size += tmp_len;
dynamic_buffer[buffer_size] = '\0';
}
if (strncmp(tmp, "OK", 2) == 0 ||
strncmp(tmp, "ERROR", 5) == 0 ||
strncmp(tmp, "+CMS ERROR:", 11) == 0 ||
strncmp(tmp, "+CME ERROR:", 11) == 0 ||
strncmp(tmp, "NO CARRIER", 10) == 0 ||
(key_word != NULL && strncmp(tmp, key_word, strlen(key_word)) == 0))
{
if (key_word != NULL && strncmp(tmp, key_word, strlen(key_word)) == 0)
{
dbg_msg("keyword found");
exitcode = SUCCESS;
}
else if (key_word == NULL)
{
exitcode = SUCCESS;
}
else
{
exitcode = KEYWORD_NOT_MATCH;
}
break;
(key_word != NULL && strncmp(tmp, key_word, strlen(key_word)) == 0)) {
if (key_word != NULL && strncmp(tmp, key_word, strlen(key_word)) == 0) {
dbg_msg("keyword found");
exitcode = SUCCESS;
} else if (key_word == NULL) {
exitcode = SUCCESS;
} else {
exitcode = KEYWORD_NOT_MATCH;
}
break;
}
}
#ifdef EARLY_RETURN
else
{
if (read_flag > 500){
else {
if (read_flag > 500) {
dbg_msg("early return");
exitcode = TIMEOUT_WAITING_NEWLINE;
break;
}
if (read_flag){
if (read_flag) {
read_flag++;
}
}
#endif
usleep(10000);
usleep(5000);
}
if (read_flag == 0)
{
if (read_flag == 0) {
exitcode = COMM_ERROR;
}
if (message != NULL) {
message->message = dynamic_buffer;
message->len = buffer_size;
} else {
free(dynamic_buffer);
}
return exitcode;
}

View File

@ -204,6 +204,8 @@ int match_option(char *option_name)
return SMS_PDU;
case SMS_INDEX_S:
return SMS_INDEX;
case GREEDY_READ_S:
return GREEDY_READ;
default:
return -1;
}
@ -259,6 +261,10 @@ int match_option(char *option_name)
{
return SMS_INDEX;
}
else if (strcmp(long_option, GREEDY_READ_L) == 0)
{
return GREEDY_READ;
}
else
{
return -1;
@ -384,16 +390,19 @@ void escape_json(char *input, char *output)
int usage(char* name)
{
err_msg("Usage: %s [options]", name);
err_msg("Or %s [device_path] [AT command]", name);
err_msg("Or %s [device_path] [operation]", name);
err_msg("Options:");
err_msg(" -c, --at_cmd <AT command> AT command");
err_msg(" -d, --tty_dev <TTY device> TTY device **REQUIRED**");
err_msg(" -b, --baud_rate <baud rate> Baud rate Default: 115200 Supported: 4800,9600,19200,38400,57600,115200");
err_msg(" -B, --data_bits <data bits> Data bits Default: 8 Supported: 5,6,7,8");
err_msg(" -t, --timeout <timeout> Timeout Default: 3");
err_msg(" -t, --timeout <timeout> Default: 3 Timeout in seconds, if output is more than timeout, it will be ignored unless -g option is set");
err_msg(" -o, --operation <operation> Operation(at[a:defualt],binary_at[b], sms_read[r], sms_send[s], sms_delete[d])");
err_msg(" -D, --debug Debug mode Default: off");
err_msg(" -p, --sms_pdu <sms pdu> SMS PDU");
err_msg(" -i, --sms_index <sms index> SMS index");
err_msg(" -g, --greedy_read Default: off, Greedy read mode, if set, each round it get new data from tty device, it will reset the timeout");
#ifdef USE_SEMAPHORE
err_msg(" -C, --cleanup Semaphore cleanup");
#endif
@ -440,6 +449,7 @@ void dump_profile()
dbg_msg("Debug: %d", s_profile.debug);
dbg_msg("SMS PDU: %s", s_profile.sms_pdu);
dbg_msg("SMS index: %d", s_profile.sms_index);
dbg_msg("Greedy read: %d", s_profile.greedy_read);
}
int display_sms_in_json(SMS_T **sms,int num)
{

View File

@ -75,9 +75,9 @@ int match_operation(char *operation_name);
int decode_pdu(SMS_T *sms);
int tty_read_keyword(FILE *fdi, char *output, int len, char *key_word, int soft_timeout);
int tty_read(FILE *fdi, AT_MESSAGE_T *message, PROFILE_T *profile);
int tty_read(FILE *fdi, char *output, int len, int soft_timeout);
int tty_read_keyword(FILE *fdi, AT_MESSAGE_T *message, char *key_word, PROFILE_T *profile);
int dump_sms(SMS_T *sms);

View File

@ -1,69 +1,95 @@
# huawei
Model | Platform | USB | PCIe
--- | --- | --- | ---
s10 | hisilicon |✔ usb(rndis) | ✘
mt5700m-cn | hisilicon |✔ usb(ecm,ncm) | ✘
mh5000-31 | hisilicon |✔ usb(ecm) | ✘
# quectel
型号 | USB 支持 | PCIe 支持
--- | --- | ---
em05 | ✔ usb(qmi,ecm,mbim,rndis,ncm) | ✘
em120k | ✔ usb(qmi,ecm,mbim,rndis,ncm) | ✘
rg200u-cn | ✔ usb(ecm,mbim,rndis,ncm) | ✘
rm500u-cn | ✔ usb(ecm,mbim,rndis,ncm) | ✘
rm500u-ea | ✔ usb(ecm,mbim,rndis,ncm) | ✘
rm500s-ce | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm500q-cn | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm510q-gl | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
rm510q-glha | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
rg500q-ea | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm500q-ae | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm500q-gl | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm502q-ae | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm502q-gl | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm505q-ae | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
rm520n-cn | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
rm520n-eu | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm520n-gl | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rg501q-eu | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rg520n-eu | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
mh8001-eu | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rg520f-eb | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rg530f-na | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
ec20f | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
ec25 | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
ec21 | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
ec200a | ✔ usb(ecm,mbim,rndis,ncm) | ✘
Model | Platform | USB | PCIe
--- | --- | --- | ---
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) | ✔ 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)
rm500q-gl | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm502q-ae | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm502q-gl | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm505q-ae | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
rm520n-cn | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
rm520n-eu | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm520n-gl | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rm551e-gl | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
rg501q-eu | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,gobinet,mbim)
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) | ✘
# fibocom
型号 | USB 支持 | PCIe 支持
--- | --- | ---
fm650-cn | ✔ usb(ecm,mbim,rndis,ncm) | ✘
fm350-gl | ✔ usb(rndis) | ✔ pcie(mbim)
fm350-gl-00 | ✔ usb(rndis) | ✘
fm350r-gl | ✔ usb(rndis) | ✔ pcie(mbim)
rw350r-gl | ✔ usb(rndis) | ✘
fm150-ae | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,mbim)
fm160-cn | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
fm160-na | ✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
nl668 | ✔ usb(ecm,rndis,ncm) | ✘
nl678 | ✔ usb(qmi,ecm,rndis,ncm) | ✘
Model | Platform | USB | PCIe
--- | --- | --- | ---
fm650-cn | unisoc |✔ usb(ecm,mbim,rndis,ncm) | ✘
fm350-gl | mediatek |✔ usb(rndis) | ✔ pcie(mbim)
fm350-gl-00 | mediatek |✔ usb(rndis) | ✘
fm350r-gl | mediatek |✔ usb(rndis) | ✔ pcie(mbim)
rw350r-gl | mediatek |✔ usb(rndis) | ✔ pcie(mbim)
fm150-ae | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi,mbim)
fm160-cn | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
fm160-na | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✘
fm190w-gl | qualcomm |✔ usb(qmi,gobinet,ecm,mbim,rndis,ncm) | ✔ pcie(qmi)
nl668 | lte |✔ usb(ecm,rndis,ncm) | ✘
nl678 | lte |✔ usb(qmi,ecm,rndis,ncm) | ✘
# meig
型号 | USB 支持 | PCIe 支持
--- | --- | ---
srm815 | ✔ usb(ecm,rndis,ncm) | ✘
srm825 | ✔ usb(ecm,rndis,ncm) | ✘
srm825n | ✔ usb(ecm,rndis,ncm) | ✘
Model | Platform | USB | PCIe
--- | --- | --- | ---
srm815 | qualcomm |✔ usb(ecm,rndis,ncm) | ✘
srm825 | qualcomm |✔ usb(ecm,rndis,ncm) | ✘
srm825n | qualcomm |✔ usb(ecm,rndis,ncm) | ✘
srm821 | unisoc |✔ usb(ecm,rndis,ncm) | ✘
# sierra
型号 | USB 支持 | PCIe 支持
--- | --- | ---
em9190 | ✔ usb(mbim,rmnet) | ✘
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
型号 | USB 支持 | PCIe 支持
--- | --- | ---
simcom_d8200g | ✔ usb(qmi,rndis) | ✘
simcom_sim8200ea-m2 | ✔ usb(qmi,rndis) | ✘
simcom_sim8380g-m2 | ✔ usb(qmi,rndis) | ✘
Model | Platform | USB | PCIe
--- | --- | --- | ---
simcom_d8200g | qualcomm |✔ usb(qmi,rndis) | ✘
simcom_sim8200ea-m2 | qualcomm |✔ usb(qmi,rndis) | ✘
simcom_sim8380g-m2 | qualcomm |✔ usb(qmi,rndis) | ✔ pcie(qmi)
# foxconn
型号 | USB 支持 | PCIe 支持
--- | --- | ---
t99w175 | ✔ usb(mbim,rmnet) | ✔ pcie(mbim)
t99w373 | ✔ usb(mbim,rmnet) | ✔ pcie(mbim)
Model | Platform | USB | PCIe
--- | --- | --- | ---
t99w175 | qualcomm |✔ usb(mbim,rmnet) | ✔ pcie(mbim)
t99w373 | qualcomm |✔ usb(mbim,rmnet) | ✔ pcie(mbim)
t99w640 | qualcomm |✘ | ✔ pcie(mbim)
# neoway
Model | Platform | USB | PCIe
--- | --- | --- | ---
n510m | unisoc |✔ usb(ecm) | ✘

View File

@ -1,4 +1,4 @@
#ccflags-y += -g
ccflags-y += -Wno-error=declaration-after-statement
obj-m += pcie_mhi.o
pcie_mhi-objs := core/mhi_init.o core/mhi_main.o core/mhi_pm.o core/mhi_boot.o core/mhi_dtr.o controllers/mhi_qti.o
pcie_mhi-objs += devices/mhi_uci.o

View File

@ -1070,6 +1070,7 @@ static struct pci_device_id mhi_pcie_device_id[] = {
{PCI_DEVICE(MHI_PCIE_VENDOR_ID, 0x0308)}, //SDX62
{PCI_DEVICE(MHI_PCIE_VENDOR_ID, 0x011a)}, //SDX35
{PCI_DEVICE(MHI_PCIE_VENDOR_ID, 0x0309)}, //SDX7X
{PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0f5)}, //FOXCONN SDX6X
{PCI_DEVICE(0x1eac, 0x1001)}, //EM120
{PCI_DEVICE(0x1eac, 0x1002)}, //EM160
{PCI_DEVICE(0x1eac, 0x1004)}, //RM520

View File

@ -12,6 +12,7 @@
#define MHI_SMMU_FORCE_COHERENT BIT(4)
#define MHI_PCIE_VENDOR_ID (0x17cb)
#define PCI_VENDOR_ID_FOXCONN (0x105b)
#define MHI_PCIE_DEBUG_ID (0xffff)
/* runtime suspend timer */

View File

@ -712,13 +712,20 @@ static struct sk_buff * add_mbim_hdr(struct sk_buff *skb, u8 mux_id) {
static struct sk_buff * add_qhdr(struct sk_buff *skb, u8 mux_id) {
struct qmap_hdr *qhdr;
int pad = 0;
struct sk_buff *new_skb = NULL;
pad = skb->len%4;
if (pad) {
pad = 4 - pad;
if (skb_tailroom(skb) < pad) {
printk("skb_tailroom small!\n");
pad = 0;
new_skb = skb_copy_expand(skb, skb_headroom(skb) + sizeof(struct qmap_hdr),
pad, GFP_ATOMIC);
if (!new_skb) {
printk("Failed to expand skb for padding\n");
return NULL;
}
dev_kfree_skb_any(skb);
skb = new_skb;
}
if (pad)
__skb_put(skb, pad);
@ -736,14 +743,23 @@ static struct sk_buff * add_qhdr_v5(struct sk_buff *skb, u8 mux_id) {
struct rmnet_map_header *map_header;
struct rmnet_map_v5_csum_header *ul_header;
u32 padding, map_datalen;
struct sk_buff *new_skb = NULL;
map_datalen = skb->len;
padding = map_datalen%4;
if (padding) {
padding = 4 - padding;
if (skb_tailroom(skb) < padding) {
printk("skb_tailroom small!\n");
padding = 0;
new_skb = skb_copy_expand(skb, skb_headroom(skb) +
sizeof(struct rmnet_map_header) +
sizeof(struct rmnet_map_v5_csum_header),
padding, GFP_ATOMIC);
if (!new_skb) {
printk("Failed to expand skb for padding\n");
return NULL;
}
dev_kfree_skb_any(skb);
skb = new_skb;
}
if (padding)
__skb_put(skb, padding);
@ -1708,7 +1724,7 @@ static struct net_device * rmnet_vnd_register_device(struct mhi_netdev *pQmapDev
out_free_newdev:
free_netdev(qmap_net);
return qmap_net;
return NULL;
}
static void rmnet_vnd_unregister_device(struct net_device *qmap_net) {
@ -3286,6 +3302,7 @@ static int mhi_netdev_probe(struct mhi_device *mhi_dev,
|| (mhi_dev->vendor == 0x17cb && mhi_dev->dev_id == 0x011a)
|| (mhi_dev->vendor == 0x1eac && mhi_dev->dev_id == 0x100b)
|| (mhi_dev->vendor == 0x17cb && mhi_dev->dev_id == 0x0309)
|| (mhi_dev->vendor == 0x105b && mhi_dev->dev_id == 0xe0f5)
) {
mhi_netdev->qmap_version = 9;
}

View File

@ -6,13 +6,13 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem
LUCI_TITLE:=LuCI support for QWRT Modem
LUCI_PKGARCH:=all
PKG_VERSION:=2.7.0
PKG_VERSION:=2.8.1
PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com>
LUCI_DEPENDS:=+luci-compat \
+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-wdm \
+kmod-usb-net-cdc-ether \
@ -26,14 +26,16 @@ LUCI_DEPENDS:=+luci-compat \
+usbutils \
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_PCI_SUPPORT:kmod-pcie_mhi \
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_PCI_SUPPORT:pciutils \
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_MTK_T7XX_SUPPORT:umbim \
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_MTK_T7XX_SUPPORT:kmod-mtk-t7xx \
+PACKAGE_luci-app-qmodem_INCLUDE_ADD_QFIREHOSE_SUPPORT:qfirehose \
+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
@ -69,6 +71,10 @@ endchoice
bool "Add PCIe Modem SUPPORT"
default n
config PACKAGE_luci-app-qmodem_INCLUDE_ADD_MTK_T7XX_SUPPORT
bool "Add MTK-T7XX Modem PCI SUPPORT"
default n
config PACKAGE_luci-app-qmodem_INCLUDE_ADD_QFIREHOSE_SUPPORT
bool "Add Qfirehose SUPPORT"
default n

View File

@ -73,6 +73,16 @@ extend_prefix = s:taboption("advanced", Flag, "extend_prefix", translate("Extend
extend_prefix.description = translate("Once checking, the prefix will be apply to lan zone")
extend_prefix.default = "0"
-- 软重启
soft_reboot = s:taboption("advanced", Flag, "soft_reboot", translate("Soft Reboot"))
soft_reboot.description = translate("enable modem soft reboot")
soft_reboot.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"))
pdp_type.default = "ipv4v6"
@ -87,11 +97,25 @@ apn = s:taboption("advanced", Value, "apn", translate("APN"))
apn.default = ""
apn.rmempty = true
apn:value("", translate("Auto Choose"))
apn:value("cmnet", translate("China Mobile"))
apn:value("3gnet", translate("China Unicom"))
apn:value("ctnet", translate("China Telecom"))
apn:value("cbnet", translate("China Broadcast"))
apn:value("5gscuiot", translate("Skytone"))
apn:value("cmnet", translate("China Mobile (CN)"))
apn:value("3gnet", translate("China Unicom (CN)"))
apn:value("ctnet", translate("China Telecom (CN)"))
apn:value("cbnet", translate("China Broadcast (CN)"))
apn:value("5gscuiot", translate("Skytone (CN)"))
-- Switzerland (CH)
apn:value("gprs.swisscom.ch", translate("Swisscom (CH)"))
apn:value("internet", "Salt (CH), Sunrise (CH), O2 (DE), 1&1 (DE)")
-- Germany (DE)
apn:value("web.vodafone.de", translate("Vodafone (DE)"))
apn:value("internet.telekom", translate("Telekom (DE)"))
apn:value("internet.eplus.de", translate("E-Plus (DE)"))
-- Austria (AT)
apn:value("A1.net", translate("A1 (AT)"))
apn:value("drei.at", translate("Drei (AT)"))
apn:value("internet.t-mobile.at", translate("Magenta (AT)"))
auth = s:taboption("advanced", ListValue, "auth", translate("Authentication Type"))
auth.default = "none"
@ -119,39 +143,30 @@ pincode.description = translate("If the PIN code is not set, leave it blank.")
--卡2
apn = s:taboption("advanced", Value, "apn2", translate("APN").." 2")
apn.description = translate("If solt 2 config is not set,will use slot 1 config.")
apn.description = translate("If slot 2 config is not set,will use slot 1 config.")
apn.default = ""
apn.rmempty = true
apn:value("", translate("Auto Choose"))
apn:value("cmnet", translate("China Mobile"))
apn:value("3gnet", translate("China Unicom"))
apn:value("ctnet", translate("China Telecom"))
apn:value("cbnet", translate("China Broadcast"))
apn:value("5gscuiot", translate("Skytone"))
apn:value("cmnet", translate("China Mobile (CN)"))
apn:value("3gnet", translate("China Unicom (CN)"))
apn:value("ctnet", translate("China Telecom (CN)"))
apn:value("cbnet", translate("China Broadcast (CN)"))
apn:value("5gscuiot", translate("Skytone (CN)"))
auth = s:taboption("advanced", ListValue, "auth2", translate("Authentication Type").. " 2")
auth.default = "none"
auth.rmempty = false
auth:value("none", translate("NONE"))
auth:value("both", translate("PAP/CHAP (both)"))
auth:value("pap", "PAP")
auth:value("chap", "CHAP")
-- Switzerland (CH)
apn:value("gprs.swisscom.ch", translate("Swisscom (CH)"))
apn:value("internet", "Salt (CH), Sunrise (CH), O2 (DE), 1&1 (DE)")
username = s:taboption("advanced", Value, "username2", translate("PAP/CHAP Username").. " 2")
username.rmempty = true
username:depends("auth2", "both")
username:depends("auth2", "pap")
username:depends("auth2", "chap")
-- Germany (DE)
apn:value("web.vodafone.de", translate("Vodafone (DE)"))
apn:value("internet.telekom", translate("Telekom (DE)"))
apn:value("internet.eplus.de", translate("E-Plus (DE)"))
password = s:taboption("advanced", Value, "password2", translate("PAP/CHAP Password").. " 2")
password.rmempty = true
password.password = true
password:depends("auth2", "both")
password:depends("auth2", "pap")
password:depends("auth2", "chap")
-- Austria (AT)
apn:value("A1.net", translate("A1 (AT)"))
apn:value("drei.at", translate("Drei (AT)"))
apn:value("internet.t-mobile.at", translate("Magenta (AT)"))
pincode = s:taboption("advanced", Value, "pincode2", translate("PIN Code").. " 2")
pincode.description = translate("If the PIN code is not set, leave it blank.")
metric = s:taboption("advanced", Value, "metric", translate("Metric"))
metric.description = translate("The metric value is used to determine the priority of the route. The smaller the value, the higher the priority. Cannot duplicate.")

View File

@ -4,7 +4,10 @@ return {
simcom = "Simcom",
sierra = "Sierra Wireless",
fibocom = "Fibocom",
meig = "Meig"
meig = "Meig",
huawei = "Huawei",
neoway = "Neoway",
telit = "Telit"
},
platforms = {
lte = "LTE",

View File

@ -69,6 +69,15 @@ name.cfgvalue = function(t, n)
return Value.cfgvalue(t, n) or "-"
end
-- Soft Reboot
soft_reboot = s:option(Flag, "soft_reboot", translate("Soft Reboot"))
soft_reboot.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"))
define_connect.default = "1"

View File

@ -735,7 +735,7 @@
}
}
update(){
this.get_config();
}
@ -748,31 +748,36 @@
this.get_action = "get_neighborcell";
this.set_action = "set_neighborcell";
this.task = null;
this.init_nc_table();
}
pause(){
if (this.task != null) {
clearInterval(this.task);
}
this.init_nc_table();
}
update(){
this.task = setInterval(() => {
this.get_config();
},10000);
scan_neighborcell(){
this.get_config();
}
// pause(){
// if (this.task != null) {
// clearInterval(this.task);
// }
// }
// update(){
// this.task = setInterval(() => {
// this.get_config();
// },10000);
// }
nr_options(){
if (this.rat_input.selectedIndex == 0) {
this.band_tr.style.display = "none";
this.scs_tr.style.display = "none";
}
else{
this.band_tr.style.display = "";
this.scs_tr.style.display = "";
}
if (this.rat_input.selectedIndex == 0) {
this.band_tr.style.display = "none";
this.scs_tr.style.display = "none";
}
else{
this.band_tr.style.display = "";
this.scs_tr.style.display = "";
}
}
init_nc_table(){
var neighborcell_table,setting_table,status_table ;
@ -835,7 +840,6 @@
scs_tr.appendChild(td);
scs_tr.appendChild(td1);
status_th = this.createTH("<%:Status%>");
status_trh = this.createTRHeader();
status_trh.appendChild(status_th);
@ -865,12 +869,18 @@
this.set_config(JSON.stringify(config));
});
//add scan button
var scan_btn = this.createBTN("<%:Scan%>",() => {
this.scan_neighborcell();
});
this.setting_table.appendChild(header);
this.setting_table.appendChild(rat_tr);
this.setting_table.appendChild(pci_tr);
this.setting_table.appendChild(arfcn_tr);
this.setting_table.appendChild(band_tr);
this.setting_table.appendChild(scs_tr);
this.setting_table.appendChild(scan_btn);
this.setting_table.appendChild(submit_btn);
}
@ -884,7 +894,7 @@
nr = this.config.NR;
lte = this.config.LTE;
for (let cell_info of nr) {
this.create_nc_tr(1,cell_info);
this.create_nc_tr(1,cell_info);
}
for (let cell_info of lte) {
this.create_nc_tr(0,cell_info);
@ -925,17 +935,18 @@
}
}
let tr_left = this.createTD(text);
let tr_right = this.create_copy_btn_td(rat,cell_info.pci,cell_info.arfcn);
let tr_right = this.create_copy_btn_td(rat,cell_info);
let tr = this.createTR();
tr.appendChild(tr_left);
tr.appendChild(tr_right);
this.neighborcell_table.appendChild(tr);
}
create_copy_btn_td(rat,pci,arfcn){
create_copy_btn_td(rat,cell_info){
var copy_btn = this.createBTN("<%:Copy%>",() => {
this.pci_input.value = pci;
this.arfcn_input.value = arfcn;
this.pci_input.value = cell_info.pci;
this.arfcn_input.value = cell_info.arfcn;
this.band_input.value = cell_info.band;
this.rat_input.selectedIndex = rat;
this.nr_options()
});

View File

@ -54,20 +54,54 @@ msgstr "Тип PDP"
msgid "Auto Choose"
msgstr "Авто выбор"
msgid "China Mobile"
msgstr "Китайский мобильный"
msgid "China Mobile (CN)"
msgstr "Китайский мобильный (CN)"
msgid "China Unicom"
msgstr "Китайский Юником"
msgid "China Unicom (CN)"
msgstr "Китайский Юником (CN)"
msgid "China Telecom"
msgstr "Китайский Телеком"
msgid "China Telecom (CN)"
msgstr "Китайский Телеком (CN)"
msgid "China Broadcast"
msgstr "Китайское вещание"
msgid "China Broadcast (CN)"
msgstr "Китайское вещание (CN)"
msgid "Skytone"
msgstr "Скайтон"
msgid "Skytone (CN)"
msgstr "Скайтон (CN)"
msgid "Swisscom (CH)"
msgstr "Swisscom (CH)"
msgid "Sunrise (CH)"
msgstr "Sunrise (CH)"
msgid "Salt (CH)"
msgstr "Salt (CH)"
msgid "Vodafone (DE)"
msgstr "Vodafone (DE)"
msgid "Telekom (DE)"
msgstr "Telekom (DE)"
msgid "O2 (DE)"
msgstr "O2 (DE)"
msgid "E-Plus (DE)"
msgstr "E-Plus (DE)"
msgid "1&1 (DE)"
msgstr "1&1 (DE)"
msgid "A1 (AT)"
msgstr "A1 (AT)"
msgid "Drei (AT)"
msgstr "Drei (AT)"
msgid "Magenta (AT)"
msgstr "Magenta (AT)"
msgid "Authentication Type"
msgstr "Тип аутентификации"

View File

@ -48,25 +48,65 @@ msgstr ""
msgid "Once checking, the prefix will be apply to lan zone"
msgstr ""
msgid "enable modem soft reboot"
msgstr ""
msgid "PDP Type"
msgstr ""
msgid "Auto Choose"
msgstr ""
msgid "China Mobile"
msgid "China Mobile (CN)"
msgstr ""
msgid "China Unicom"
msgid "China Unicom (CN)"
msgstr ""
msgid "China Telecom"
msgid "China Telecom (CN)"
msgstr ""
msgid "China Broadcast"
msgid "China Broadcast (CN)"
msgstr ""
msgid "Skytone"
msgid "Skytone (CN)"
msgstr ""
msgid "Sunrise (CH)"
msgstr ""
msgid "Swisscom (CH)"
msgstr ""
msgid "Salt (CH)"
msgstr "Salt (CH)"
msgid "Vodafone (DE)"
msgstr ""
msgid "Telekom (DE)"
msgstr ""
msgid "O2 (DE)"
msgstr ""
msgid "E-Plus (DE)"
msgstr ""
msgid "1&1 (DE)"
msgstr ""
msgid "A1 (AT)"
msgstr ""
msgid "Drei (AT)"
msgstr ""
msgid "Magenta (AT)"
msgstr ""
msgid "T-Mobile (AT)"
msgstr ""
msgid "Authentication Type"
@ -588,9 +628,6 @@ msgstr "制造商"
msgid "Quectel"
msgstr "移远"
msgid "Simcom"
msgstr "芯讯通Simcom"
msgid "Sierra Wireless"
msgstr "Sierra无线"
@ -600,6 +637,12 @@ msgstr "广和通"
msgid "Meig"
msgstr "美格"
msgid "Neoway"
msgstr "有方"
msgid "Telit"
msgstr "泰利特"
msgid "Platform"
msgstr "平台"

View File

@ -64,26 +64,63 @@ msgstr "扩展前缀"
msgid "Once checking, the prefix will be apply to lan zone"
msgstr "启用后该接口的前缀会被通告至Lan区域"
msgid "enable modem soft reboot"
msgstr "启用模组软重启"
msgid "PDP Type"
msgstr "PDP类型"
msgid "Auto Choose"
msgstr "自动选择"
msgid "China Mobile"
msgstr "中国移动"
msgid "China Mobile (CN)"
msgstr "中国移动 (CN)"
msgid "China Unicom"
msgstr "中国联通"
msgid "China Unicom (CN)"
msgstr "中国联通 (CN)"
msgid "China Telecom"
msgstr "中国电信"
msgid "China Telecom (CN)"
msgstr "中国电信 (CN)"
msgid "China Broadcast"
msgstr "中国广电"
msgid "China Broadcast (CN)"
msgstr "中国广电 (CN)"
msgid "Skytone"
msgstr "天际通"
msgid "Skytone (CN)"
msgstr "天际通 (CN)"
msgid "Sunrise (CH)"
msgstr "Sunrise (CH)"
msgid "Swisscom(CH)"
msgstr "Swisscom (CH)"
msgid "Salt (CH)"
msgstr "Salt (CH)"
msgid "Vodafone (DE)"
msgstr "Vodafone (DE)"
msgid "Telekom (DE)"
msgstr "Telekom (DE)"
msgid "O2 (DE)"
msgstr "O2 (DE)"
msgid "E-Plus (DE)"
msgstr "E-Plus (DE)"
msgid "1&1 (DE)"
msgstr "1&1 (DE)"
msgid "A1 (AT)"
msgstr "A1 (AT)"
msgid "Drei (AT)"
msgstr "Drei (AT)"
msgid "Magenta (AT)"
msgstr "Magenta (AT)"
msgid "Authentication Type"
msgstr "认证类型"
@ -622,6 +659,12 @@ msgstr "广和通"
msgid "Meig"
msgstr "美格"
msgid "Neoway"
msgstr "有方"
msgid "Telit"
msgstr "泰利特"
msgid "Platform"
msgstr "平台"
@ -809,5 +852,11 @@ msgstr "拨号前执行的AT命令。"
msgid "(still in beta)"
msgstr "(仍在测试中)"
msgid beta"
msgid "beta"
msgstr "(测试)"
msgid "V4/V6 Connect Check"
msgstr "V4/V6 存活检测"
msgid "Only for AT dial modem."
msgstr "只适用于AT拨号模组。"

View File

@ -64,26 +64,62 @@ msgstr "扩展前缀"
msgid "Once checking, the prefix will be apply to lan zone"
msgstr "启用后该接口的前缀会被通告至Lan区域"
msgid "enable modem soft reboot"
msgstr "启用模组软重启"
msgid "PDP Type"
msgstr "PDP类型"
msgid "Auto Choose"
msgstr "自动选择"
msgid "China Mobile"
msgstr "中国移动"
msgid "China Mobile (CN)"
msgstr "中国移动 (CN)"
msgid "China Unicom"
msgstr "中国联通"
msgid "China Unicom (CN)"
msgstr "中国联通 (CN)"
msgid "China Telecom"
msgstr "中国电信"
msgid "China Telecom (CN)"
msgstr "中国电信 (CN)"
msgid "China Broadcast"
msgstr "中国广电"
msgid "China Broadcast (CN)"
msgstr "中国广电 (CN)"
msgid "Skytone"
msgstr "天际通"
msgid "Skytone (CN)"
msgstr "天际通 (CN)"
msgid "Sunrise (CH)"
msgstr "Sunrise (CH)"
msgid "Swisscom(CH)"
msgstr "Swisscom (CH)"
msgid "Salt (CH)"
msgstr "Salt (CH)"
msgid "Vodafone (DE)"
msgstr "Vodafone (DE)"
msgid "Telekom (DE)"
msgstr "Telekom (DE)"
msgid "O2 (DE)"
msgstr "O2 (DE)"
msgid "E-Plus (DE)"
msgstr "E-Plus (DE)"
msgid "1&1 (DE)"
msgstr "1&1 (DE)"
msgid "A1 (AT)"
msgstr "A1 (AT)"
msgid "Drei (AT)"
msgstr "Drei (AT)"
msgid "Magenta (AT)"
msgstr "Magenta (AT)"
msgid "Authentication Type"
msgstr "认证类型"
@ -610,9 +646,6 @@ msgstr "制造商"
msgid "Quectel"
msgstr "移远"
msgid "Simcom"
msgstr "芯讯通Simcom"
msgid "Sierra Wireless"
msgstr "Sierra无线"
@ -622,6 +655,12 @@ msgstr "广和通"
msgid "Meig"
msgstr "美格"
msgid "Neoway"
msgstr "有方"
msgid "Telit"
msgstr "泰利特"
msgid "Platform"
msgstr "平台"
@ -809,5 +848,11 @@ msgstr "拨号前执行的AT命令。"
msgid "(still in beta)"
msgstr "(仍在测试中)"
msgid beta"
msgid "beta"
msgstr "(测试)"
msgid "V4/V6 Connect Check"
msgstr "V4/V6 存活检测"
msgid "Only for AT dial modem."
msgstr "只适用于AT拨号模组。"

View File

@ -6,7 +6,6 @@ USE_PROCD=1
. /lib/functions.sh
start_service() {
config_load qmodem
config_foreach _mk_rundir modem-device
config_get block_auto_probe main block_auto_probe 0
@ -16,7 +15,10 @@ start_service() {
config_get try_preset_pcie main try_preset_pcie 1
#once enabled, skip all check or scan
[ "$block_auto_probe" -eq 1 ] && return
#auto add option driver for usb device
config_foreach _usb_option_driver modem-device
#enabled by default
if [ "$try_preset_pcie" -eq 1 ];then
_try_vendor_preset_pcie
@ -131,3 +133,22 @@ _try_device()
/usr/share/qmodem/modem_scan.sh disable "$1"
fi
}
_usb_option_driver()
{
[ "$(config_get "$1" data_interface)" = "usb" ] && [ "$(config_get "$1" option_driver)" = "1" ] || return
local path=$(config_get "$1" path)
local slot_vid=$(cat "${path}/idVendor" 2>/dev/null)
local slot_pid=$(cat "${path}/idProduct" 2>/dev/null)
if [ -n "$slot_vid" ] && [ -n "$slot_pid" ]; then
if echo "$slot_vid $slot_pid" > /sys/bus/usb-serial/drivers/option1/new_id 2>/dev/null; then
logger -t modem_init "Set option driver for $1 (VID:$slot_vid PID:$slot_pid)"
else
logger -t modem_init "Failed to set option driver for $1 (VID:$slot_vid PID:$slot_pid)"
fi
else
logger -t modem_init "Unable to get VID/PID for device $1"
fi
}

View File

@ -91,7 +91,7 @@ _dial()
{
procd_open_instance "modem_$1"
procd_set_param command "/usr/share/qmodem/modem_dial.sh" "$1" dial
procd_set_param respawn
procd_set_param respawn 120 15 10
procd_close_instance
logger -t qmodem_network "Modem $1 Start Dial Now"
}

50
luci/luci-app-qmodem/root/etc/init.d/qmodem_reboot Normal file → Executable file
View File

@ -1,9 +1,7 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
USE_PROCD=1
START=95
STOP=0
USE_PROCD=1
start_service() {
:
@ -12,28 +10,30 @@ start_service() {
stop_service() {
procd_set_param timeout 30
config_load qmodem
config_foreach _reboot_usb modem-device
config_foreach _soft_reboot modem-device
}
_reboot_usb() {
config_get data_interface $1 data_interface
if [ "$data_interface" == "usb" ]; then
config_get name $1 name
if [ "$name" == "fm350-gl" ]; then
config_get at_port $1 at_port
response=$(tom_modem -d "$at_port" -o a -c "AT+CFUN=1,1")
retries=3
while ! echo "$response" | grep -qi "ok" && [ $retries -gt 0 ]; do
sleep 1
response=$(tom_modem -d "$at_port" -o a -c "AT+CFUN=1,1")
retries=$((retries - 1))
done
max_retries=15
while [ -e "/dev/$at_port" ] && [ $max_retries -gt 0 ]; do
sleep 1
max_retries=$((max_retries - 1))
done
fi
fi
_soft_reboot() {
config_get soft_reboot $1 soft_reboot
[ "$soft_reboot" != "1" ] && return 0
config_get at_port $1 at_port
[ -z "$at_port" ] && return 0
for i in $(seq 1 3); do
response=$(tom_modem -d "$at_port" -o a -c "AT+CFUN=1,1")
echo "$response" | grep -qi "ok" && break
sleep 1
done
for i in $(seq 1 15); do
[ ! -e "$at_port" ] && {
echo "Device disconnected after $i seconds"
return 0
}
sleep 1
done
echo "Device did not disconnect within timeout period"
return 0
}

View File

@ -1,8 +1,7 @@
#!/bin/sh
# Copyright (C) 2024 Tom <fjrcn@outlook.com>
/etc/init.d/modeminit enable
/etc/init.d/modem enable
/etc/init.d/qmodem_reboot enable
uci -q batch <<-EOF >/dev/null
delete ucitrack.@qmodem[-1]

View File

@ -0,0 +1,672 @@
{
"general": [
{
"Module Information > ATI": "ATI"
},
{
"Query SIM Card Status > AT+CPIN?": "AT+CPIN?"
},
{
"Query Network Signal Quality (4G) > AT+CSQ": "AT+CSQ"
},
{
"Query Network Signal Quality (5G) > AT+CESQ": "AT+CESQ"
},
{
"Query Network Information > AT+COPS?": "AT+COPS?"
},
{
"Query PDP Information > AT+CGDCONT?": "AT+CGDCONT?"
},
{
"Query PDP Address > AT+CGPADDR": "AT+CGPADDR"
},
{
"Query Module IMEI > AT+CGSN": "AT+CGSN"
},
{
"Query Module IMEI > AT+GSN": "AT+GSN"
},
{
"Check Current Voltage > AT+CBC": "AT+CBC"
},
{
"Minimum Function Mode > AT+CFUN=0": "AT+CFUN=0"
},
{
"Full Function Mode > AT+CFUN=1": "AT+CFUN=1"
},
{
"Restart Module > AT+CFUN=1,1": "AT+CFUN=1,1"
}
],
"quectel": {
"qualcomm": [
{
"SIM Card Status Report > AT+QSIMSTAT?": "AT+QSIMSTAT?"
},
{
"Set Current SIM to Slot 1 > AT+QUIMSLOT=1": "AT+QUIMSLOT=1"
},
{
"Set Current SIM to Slot 2 > AT+QUIMSLOT=2": "AT+QUIMSLOT=2"
},
{
"Query Network Information > AT+QNWINFO": "AT+QNWINFO"
},
{
"Query Carrier Aggregation Parameters > AT+QCAINFO": "AT+QCAINFO"
},
{
"Query 5G Signal Strength (RSRP) > AT+QRSRP": "AT+QRSRP"
},
{
"Query Current Dial Mode > AT+QCFG=\"usbnet\"": "AT+QCFG=\"usbnet\""
},
{
"QMI/GobiNet Dial Mode > AT+QCFG=\"usbnet\",0": "AT+QCFG=\"usbnet\",0"
},
{
"ECM Dial Mode > AT+QCFG=\"usbnet\",1": "AT+QCFG=\"usbnet\",1"
},
{
"MBIM Dial Mode > AT+QCFG=\"usbnet\",2": "AT+QCFG=\"usbnet\",2"
},
{
"RNDIS Dial Mode > AT+QCFG=\"usbnet\",3": "AT+QCFG=\"usbnet\",3"
},
{
"NCM Dial Mode > AT+QCFG=\"usbnet\",5": "AT+QCFG=\"usbnet\",5"
},
{
"Lock to 4G > AT+QNWPREFCFG=\"mode_pref\",LTE": "AT+QNWPREFCFG=\"mode_pref\",LTE"
},
{
"Lock to 5G > AT+QNWPREFCFG=\"mode_pref\",NR5G": "AT+QNWPREFCFG=\"mode_pref\",NR5G"
},
{
"Lock to 5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA": "AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"
},
{
"Lock to 5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA": "AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"
},
{
"Restore Automatic Network Search > AT+QNWPREFCFG=\"mode_pref\",AUTO": "AT+QNWPREFCFG=\"mode_pref\",AUTO"
},
{
"Query Module IMEI > AT+EGMR=0,7": "AT+EGMR=0,7"
},
{
"Change Module IMEI > AT+EGMR=1,7,\"IMEI\"": "AT+EGMR=1,7,\"Set IMEI here\""
},
{
"Get Module Temperature > AT+QTEMP": "AT+QTEMP"
},
{
"Switch to USB Communication Port > AT+QCFG=\"data_interface\",0,0": "AT+QCFG=\"data_interface\",0,0"
},
{
"Switch to PCIE Communication Port > AT+QCFG=\"data_interface\",1,0": "AT+QCFG=\"data_interface\",1,0"
},
{
"Check Current USB Speed > AT+QCFG=\"usbspeed\"": "AT+QCFG=\"usbspeed\""
},
{
"Switch to USB2.0 > AT+QCFG=\"usbspeed\",\"20\"": "AT+QCFG=\"usbspeed\",\"20\""
},
{
"Switch to USB3.1 Gen1 (5Gbps) > AT+QCFG=\"usbspeed\",\"311\"": "AT+QCFG=\"usbspeed\",\"311\""
},
{
"Switch to USB3.1 Gen1 (10Gbps) > AT+QCFG=\"usbspeed\",\"312\"": "AT+QCFG=\"usbspeed\",\"312\""
},
{
"Reset Module > AT+QCFG=\"ResetFactory\"": "AT+QCFG=\"ResetFactory\""
}
],
"unisoc": [
{
"SIM Card Status Report > AT+QSIMSTAT?": "AT+QSIMSTAT?"
},
{
"Set Current SIM to Slot 1 > AT+QUIMSLOT=1": "AT+QUIMSLOT=1"
},
{
"Set Current SIM to Slot 2 > AT+QUIMSLOT=2": "AT+QUIMSLOT=2"
},
{
"Query Network Information > AT+QNWINFO": "AT+QNWINFO"
},
{
"Query Carrier Aggregation Parameters > AT+QCAINFO": "AT+QCAINFO"
},
{
"Query Current Dial Mode > AT+QCFG=\"usbnet\"": "AT+QCFG=\"usbnet\""
},
{
"ECM Dial Mode > AT+QCFG=\"usbnet\",1": "AT+QCFG=\"usbnet\",1"
},
{
"MBIM Dial Mode > AT+QCFG=\"usbnet\",2": "AT+QCFG=\"usbnet\",2"
},
{
"RNDIS Dial Mode > AT+QCFG=\"usbnet\",3": "AT+QCFG=\"usbnet\",3"
},
{
"NCM Dial Mode > AT+QCFG=\"usbnet\",5": "AT+QCFG=\"usbnet\",5"
},
{
"Lock to 4G > AT+QNWPREFCFG=\"mode_pref\",LTE": "AT+QNWPREFCFG=\"mode_pref\",LTE"
},
{
"Lock to 5G > AT+QNWPREFCFG=\"mode_pref\",NR5G": "AT+QNWPREFCFG=\"mode_pref\",NR5G"
},
{
"Lock to 5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA": "AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"
},
{
"Lock to 5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA": "AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"
},
{
"Restore Automatic Network Search > AT+QNWPREFCFG=\"mode_pref\",AUTO": "AT+QNWPREFCFG=\"mode_pref\",AUTO"
},
{
"Query Module IMEI > AT+EGMR=0,7": "AT+EGMR=0,7"
},
{
"Change Module IMEI > AT+EGMR=1,7,\"IMEI\"": "AT+EGMR=1,7,\"Set IMEI here\""
},
{
"Get Module Temperature > AT+QTEMP": "AT+QTEMP"
},
{
"Switch to USB Communication Port > AT+QCFG=\"data_interface\",0,0": "AT+QCFG=\"data_interface\",0,0"
},
{
"Switch to PCIE Communication Port > AT+QCFG=\"data_interface\",1,0": "AT+QCFG=\"data_interface\",1,0"
},
{
"Check Current USB Speed > AT+QCFG=\"usbspeed\"": "AT+QCFG=\"usbspeed\""
},
{
"Switch to USB2.0 > AT+QCFG=\"usbspeed\",\"20\"": "AT+QCFG=\"usbspeed\",\"20\""
},
{
"Switch to USB3.1 Gen1 (5Gbps) > AT+QCFG=\"usbspeed\",\"311\"": "AT+QCFG=\"usbspeed\",\"311\""
},
{
"Switch to USB3.1 Gen1 (10Gbps) > AT+QCFG=\"usbspeed\",\"312\"": "AT+QCFG=\"usbspeed\",\"312\""
},
{
"Reset Module > AT+QCFG=\"ResetFactory\"": "AT+QCFG=\"ResetFactory\""
}
],
"general": [
{
"SIM Card Status Report > AT+QSIMSTAT?": "AT+QSIMSTAT?"
},
{
"Set Current SIM to Slot 1 > AT+QUIMSLOT=1": "AT+QUIMSLOT=1"
},
{
"Set Current SIM to Slot 2 > AT+QUIMSLOT=2": "AT+QUIMSLOT=2"
},
{
"Query Network Information > AT+QNWINFO": "AT+QNWINFO"
},
{
"Query Carrier Aggregation Parameters > AT+QCAINFO": "AT+QCAINFO"
},
{
"Query Current Dial Mode > AT+QCFG=\"usbnet\"": "AT+QCFG=\"usbnet\""
},
{
"QMI/GobiNet Dial Mode > AT+QCFG=\"usbnet\",0": "AT+QCFG=\"usbnet\",0"
},
{
"ECM Dial Mode > AT+QCFG=\"usbnet\",1": "AT+QCFG=\"usbnet\",1"
},
{
"MBIM Dial Mode > AT+QCFG=\"usbnet\",2": "AT+QCFG=\"usbnet\",2"
},
{
"RNDIS Dial Mode > AT+QCFG=\"usbnet\",3": "AT+QCFG=\"usbnet\",3"
},
{
"NCM Dial Mode > AT+QCFG=\"usbnet\",5": "AT+QCFG=\"usbnet\",5"
},
{
"Lock to 4G > AT+QNWPREFCFG=\"mode_pref\",LTE": "AT+QNWPREFCFG=\"mode_pref\",LTE"
},
{
"Lock to 5G > AT+QNWPREFCFG=\"mode_pref\",NR5G": "AT+QNWPREFCFG=\"mode_pref\",NR5G"
},
{
"Lock to 5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA": "AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"
},
{
"Lock to 5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA": "AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"
},
{
"Restore Automatic Network Search > AT+QNWPREFCFG=\"mode_pref\",AUTO": "AT+QNWPREFCFG=\"mode_pref\",AUTO"
},
{
"Query Module IMEI > AT+EGMR=0,7": "AT+EGMR=0,7"
},
{
"Change Module IMEI > AT+EGMR=1,7,\"IMEI\"": "AT+EGMR=1,7,\"Set IMEI here\""
},
{
"Get Module Temperature > AT+QTEMP": "AT+QTEMP"
},
{
"Switch to USB Communication Port > AT+QCFG=\"data_interface\",0,0": "AT+QCFG=\"data_interface\",0,0"
},
{
"Switch to PCIE Communication Port > AT+QCFG=\"data_interface\",1,0": "AT+QCFG=\"data_interface\",1,0"
},
{
"Check Current USB Speed > AT+QCFG=\"usbspeed\"": "AT+QCFG=\"usbspeed\""
},
{
"Switch to USB2.0 > AT+QCFG=\"usbspeed\",\"20\"": "AT+QCFG=\"usbspeed\",\"20\""
},
{
"Switch to USB3.1 Gen1 (5Gbps) > AT+QCFG=\"usbspeed\",\"311\"": "AT+QCFG=\"usbspeed\",\"311\""
},
{
"Switch to USB3.1 Gen1 (10Gbps) > AT+QCFG=\"usbspeed\",\"312\"": "AT+QCFG=\"usbspeed\",\"312\""
},
{
"Reset Module > AT+QCFG=\"ResetFactory\"": "AT+QCFG=\"ResetFactory\""
}
]
},
"fibocom": {
"qualcomm": [
{
"Set Current SIM to Slot 1 > AT+GTDUALSIM=0": "AT+GTDUALSIM=0"
},
{
"Set Current SIM to Slot 2 > AT+GTDUALSIM=1": "AT+GTDUALSIM=1"
},
{
"ECM Manual Dial > AT+GTRNDIS=1,1": "AT+GTRNDIS=1,1"
},
{
"ECM Dial Disconnect > AT+GTRNDIS=0,1": "AT+GTRNDIS=0,1"
},
{
"Query Current Port Mode > AT+GTUSBMODE?": "AT+GTUSBMODE?"
},
{
"QMI/GobiNet Dial Mode > AT+GTUSBMODE=32": "AT+GTUSBMODE=32"
},
{
"ECM Dial Mode > AT+GTUSBMODE=18": "AT+GTUSBMODE=18"
},
{
"MBIM Dial Mode > AT+GTUSBMODE=30": "AT+GTUSBMODE=30"
},
{
"RNDIS Dial Mode > AT+GTUSBMODE=24": "AT+GTUSBMODE=24"
},
{
"NCM Dial Mode > AT+GTUSBMODE=18": "AT+GTUSBMODE=18"
},
{
"Lock to 4G > AT+GTACT=2": "AT+GTACT=2"
},
{
"Lock to 5G > AT+GTACT=14": "AT+GTACT=14"
},
{
"Restore Automatic Network Search > AT+GTACT=20": "AT+GTACT=20"
},
{
"Query Current Connected Network Type > AT+PSRAT?": "AT+PSRAT?"
},
{
"Query Module IMEI > AT+GTSN=0,7": "AT+GTSN=0,7"
},
{
"Change Module IMEI > AT+GTSN=1,7,\"IMEI\"": "AT+GTSN=1,7,\"Set IMEI here\""
},
{
"Report Current BBIC Temperature > AT+MTSM=1,6": "AT+MTSM=1,6"
},
{
"Report Current RF Temperature > AT+MTSM=1,7": "AT+MTSM=1,7"
},
{
"Restart Module > AT+CFUN=15": "AT+CFUN=15"
}
],
"unisoc": [
{
"Set Current SIM to Slot 1 > AT+GTDUALSIM=0": "AT+GTDUALSIM=0"
},
{
"Set Current SIM to Slot 2 > AT+GTDUALSIM=1": "AT+GTDUALSIM=1"
},
{
"ECM Manual Dial > AT+GTRNDIS=1,1": "AT+GTRNDIS=1,1"
},
{
"ECM Dial Disconnect > AT+GTRNDIS=0,1": "AT+GTRNDIS=0,1"
},
{
"Query Current Port Mode > AT+GTUSBMODE?": "AT+GTUSBMODE?"
},
{
"ECM Dial Mode > AT+GTUSBMODE=18": "AT+GTUSBMODE=18"
},
{
"MBIM Dial Mode > AT+GTUSBMODE=30": "AT+GTUSBMODE=30"
},
{
"RNDIS Dial Mode > AT+GTUSBMODE=24": "AT+GTUSBMODE=24"
},
{
"NCM Dial Mode > AT+GTUSBMODE=18": "AT+GTUSBMODE=18"
},
{
"Lock to 4G > AT+GTACT=2": "AT+GTACT=2"
},
{
"Lock to 5G > AT+GTACT=14": "AT+GTACT=14"
},
{
"Restore Automatic Network Search > AT+GTACT=20": "AT+GTACT=20"
},
{
"Query Current Connected Network Type > AT+PSRAT?": "AT+PSRAT?"
},
{
"Query Module IMEI > AT+GTSN=0,7": "AT+GTSN=0,7"
},
{
"Change Module IMEI > AT+GTSN=1,7,\"IMEI\"": "AT+GTSN=1,7,\"Set IMEI here\""
},
{
"Report Current BBIC Temperature > AT+MTSM=1,6": "AT+MTSM=1,6"
},
{
"Report Current RF Temperature > AT+MTSM=1,7": "AT+MTSM=1,7"
},
{
"Restart Module > AT+CFUN=15": "AT+CFUN=15"
}
],
"mediatek": [
{
"Set Current SIM to Slot 1 > AT+GTDUALSIM=0": "AT+GTDUALSIM=0"
},
{
"Set Current SIM to Slot 2 > AT+GTDUALSIM=1": "AT+GTDUALSIM=1"
},
{
"Manual Set Access Point > AT+CGDCONT=3,\"IPV4V6\",\"APN\"": "AT+CGDCONT=3,\"IPV4V6\",\"Set APN here\""
},
{
"Manual Dial > AT+CGACT=1,3": "AT+CGACT=1,3"
},
{
"Stop Dialing > AT+CGACT=0,3": "AT+CGACT=0,3"
},
{
"Query Current Port Mode > AT+GTUSBMODE?": "AT+GTUSBMODE?"
},
{
"RNDIS Dial Mode (40) > AT+GTUSBMODE=40": "AT+GTUSBMODE=40"
},
{
"RNDIS Dial Mode (41) > AT+GTUSBMODE=41": "AT+GTUSBMODE=41"
},
{
"Lock to 4G > AT+GTACT=2": "AT+GTACT=2"
},
{
"Lock to 5G > AT+GTACT=14": "AT+GTACT=14"
},
{
"Restore Automatic Network Search > AT+GTACT=20": "AT+GTACT=20"
},
{
"Query Current Connected Network Type > AT+PSRAT?": "AT+PSRAT?"
},
{
"Query Carrier Aggregation Cell Information > AT+GTCAINFO?": "AT+GTCAINFO?"
},
{
"Query Module IMEI > AT+GTSN=0,7": "AT+GTSN=0,7"
},
{
"Change Module IMEI > AT+GTSN=1,7,\"IMEI\"": "AT+GTSN=1,7,\"Set IMEI here\""
},
{
"Unlock FCC > AT+GTFCCLOCKMODE=0": "AT+GTFCCLOCKMODE=0"
},
{
"Unlock ESIM > AT+GTESIMCFG=0,0,0": "AT+GTESIMCFG=0,0,0"
},
{
"Disable Thermal Control > AT+GTTHERMAL=0": "AT+GTTHERMAL=0"
},
{
"Get Current Temperature > AT+GTSENRDTEMP=0": "AT+GTSENRDTEMP=0"
},
{
"Restart Module > AT+CFUN=15": "AT+CFUN=15"
}
]
},
"meig": {
"qualcomm": [
{
"SIM Card Status Report > AT^SIMSLOTURC=1": "AT^SIMSLOTURC=1"
},
{
"Get SIM Card Slot Status > AT^SIMSLOT?": "AT^SIMSLOT?"
},
{
"Set Current SIM to Slot 1 > AT^SIMSLOT=1": "AT^SIMSLOT=1"
},
{
"Set Current SIM to Slot 2 > AT^SIMSLOT=2": "AT^SIMSLOT=2"
},
{
"Query Network Information > AT^SYSINFOEX": "AT^SYSINFOEX"
},
{
"Query Carrier Aggregation Cell Information > AT^CELLINFO=1": "AT^CELLINFO=1"
},
{
"Query Current Dial Mode > AT+SER?": "AT+SER?"
},
{
"QMI/GobiNet Dial Mode > AT+SER=1,1": "AT+SER=1,1"
},
{
"ECM Dial Mode > AT+SER=2,1": "AT+SER=2,1"
},
{
"MBIM Dial Mode > AT+SER=3,1": "AT+SER=3,1"
},
{
"RNDIS Dial Mode > AT+SER=3,1": "AT+SER=3,1"
},
{
"NCM Dial Mode > AT+SER=2,1": "AT+SER=2,1"
},
{
"Lock to 4G > AT^SYSCFGEX=\"03\",all,0,2,all,all,all,all,1": "AT^SYSCFGEX=\"03\",all,0,2,all,all,all,all,1"
},
{
"Lock to 5G > AT^SYSCFGEX=\"04\",all,0,2,all,all,all,all,1": "AT^SYSCFGEX=\"04\",all,0,2,all,all,all,all,1"
},
{
"Restore Automatic Network Search > AT^SYSCFGEX=\"00\",all,0,2,all,all,all,all,1": "AT^SYSCFGEX=\"00\",all,0,2,all,all,all,all,1"
},
{
"Query Module IMEI > AT+LCTSN=0,7": "AT+LCTSN=0,7"
},
{
"Change Module IMEI > AT+LCTSN=1,7,\"IMEI\"": "AT+LCTSN=1,7,\"Set IMEI here\""
},
{
"Get Module Temperature > AT+TEMP": "AT+TEMP"
},
{
"Restart Module > AT+RESET": "AT+RESET"
}
]
},
"foxconn": {
"qualcomm": [
{
"SIM Card Status Report > AT^SIMSLOTURC=1": "AT^SIMSLOTURC=1"
},
{
"Get SIM Card Slot Status > AT^SWITCH_SLOT?": "AT^SWITCH_SLOT?"
},
{
"Set Current SIM to Slot 1 > at^switch_slot=0": "at^switch_slot=0"
},
{
"Set Current SIM to ESIM > at^switch_slot=1": "at^switch_slot=1"
},
{
"Query Network and Carrier Information > AT^DEBUG?": "AT^DEBUG?"
},
{
"Get Module Temperature > AT^TEMP?": "AT^TEMP?"
},
{
"Restart Module > AT+RESET": "AT+RESET"
}
]
},
"huawei": {
"hisilicon": [
{
"Set Current SIM to Slot 1 > AT^SIMSWITCH=1": "AT^SIMSWITCH=1"
},
{
"Set Current SIM to Slot 2 > AT^SIMSWITCH=0": "AT^SIMSWITCH=0"
},
{
"Query Network Information > AT^SYSINFOEX": "AT^SYSINFOEX"
},
{
"Query Current Dial Mode > AT^SETMODE?": "AT^SETMODE?"
},
{
"ECM Dial Mode (Linux) > AT^SETMODE=0": "AT^SETMODE=0"
},
{
"NCM Dial Mode (Windows) > AT^SETMODE=1": "AT^SETMODE=1"
},
{
"ECM Dial Mode (Linux, Debug) > AT^SETMODE=2": "AT^SETMODE=2"
},
{
"NCM Dial Mode (Windows, Debug) > AT^SETMODE=3": "AT^SETMODE=3"
},
{
"Lock to 4G > AT^SYSCFGEX=\"03\",40000000,1,2,7FFFFFFFFFFFFFFF,,": "AT^SYSCFGEX=\"03\",40000000,1,2,7FFFFFFFFFFFFFFF,,"
},
{
"Lock to 5G > AT^SYSCFGEX=\"08\",40000000,1,2,7FFFFFFFFFFFFFFF,,": "AT^SYSCFGEX=\"08\",40000000,1,2,7FFFFFFFFFFFFFFF,,"
},
{
"Restore Automatic Network Search > AT^SYSCFGEX=\"00\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,,": "AT^SYSCFGEX=\"00\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,,"
},
{
"Get Module Temperature > AT^CHIPTEMP?": "AT^CHIPTEMP?"
},
{
"Restart Module > AT^RESET": "AT^RESET"
}
]
},
"simcom": {
"qualcomm": [
{
"Query Band Lock Mode > ": "AT+CNMP?"
},
{
"Set Band Lock Mode > Automatic": "AT+CNMP=2"
},
{
"Set Band Lock Mode > WCDMA Only": "AT+CNMP=14"
},
{
"Set Band Lock Mode > LTE Only": "AT+CNMP=38"
},
{
"Set Band Lock Mode > NR5G": "AT+CNMP=71"
},
{
"Set Band Lock Mode > WCDMA+LTE Only": "AT+CNMP=54"
},
{
"Set Band Lock Mode > WCDMA+LTE+NR5G": "AT+CNMP=55"
},
{
"Set Band Lock Mode > LTE+NR5G": "AT+CNMP=109"
},
{
"Reset Module > AT+CRESET": "AT+CRESET"
},
{
"Reset Module > AT+CFUN=6": "AT+CFUN=6"
},
{
"Reset Module > ATZ": "ATZ"
},
{
"Enable Uplink/Downlink Display Mode > AT+CNWINFO=1": "AT+CNWINFO=1"
},
{
"Disable Uplink/Downlink Display Mode > AT+CNWINFO=0": "AT+CNWINFO=0"
},
{
"Switch to PCIE Mode > AT+CPCIEMODE=EP": "AT+CPCIEMODE=EP"
},
{
"Switch to USB Mode > AT+CPCIEMODE=HOST": "AT+CPCIEMODE=HOST"
},
{
"Enable SIM Hot Swap > AT+UIMHOTSWAPON=1": "AT+UIMHOTSWAPON=1"
},
{
"Disable SIM Hot Swap > AT+UIMHOTSWAPON=0": "AT+UIMHOTSWAPON=0"
},
{
"Unlock LTE Cell Lock > AT+CCELLCFG=0": "AT+CCELLCFG=0"
},
{
"Unlock 5G Cell Lock > AT+C5GCELLCFG=\"unlock\"": "AT+C5GCELLCFG=\"unlock\""
},
{
"Change IMEI > AT+SIMEI=imei": "AT+SIMEI=imei"
},
{
"Switch SIM Card Slot > Slot 1": "AT+SMSIMCFG=0,1"
},
{
"Switch SIM Card Slot > Slot 2": "AT+SMSIMCFG=0,2"
},
{
"Set Module Function > Minimum Function": "AT+CFUN=0"
},
{
"Set Module Function > Maximum Function": "AT+CFUN=1"
},
{
"Set Module Function > Offline Mode": "AT+CFUN=7"
}
]
}
}

View File

@ -57,6 +57,9 @@
{
"查询载波聚合参数 > AT+QCAINFO": "AT+QCAINFO"
},
{
"查询5G信号强度RSRP > AT+QRSRP": "AT+QRSRP"
},
{
"查询当前拨号模式 > AT+QCFG=\"usbnet\"": "AT+QCFG=\"usbnet\""
},
@ -517,6 +520,62 @@
{
"重启模组 > AT+RESET": "AT+RESET"
}
],
"unisoc": [
{
"获取SIM卡卡槽状态 > AT^SIMSLOT?": "AT^SIMSLOT?"
},
{
"设置当前使用的为卡1 > AT^SIMSLOT=1": "AT^SIMSLOT=1"
},
{
"设置当前使用的为卡2 > AT^SIMSLOT=2": "AT^SIMSLOT=2"
},
{
"查询网络信息 > AT^SYSINFOEX": "AT^SYSINFOEX"
},
{
"查询载波聚合小区信息 > AT^CELLINFO=1": "AT^CELLINFO=1"
},
{
"查询当前拨号模式 > AT+SER?": "AT+SER?"
},
{
"ECM拨号模式 > AT+SER=2,1": "AT+SER=2,1"
},
{
"MBIM拨号模式 > AT+SER=3,1": "AT+SER=3,1"
},
{
"RNDIS拨号模式 > AT+SER=3,1": "AT+SER=3,1"
},
{
"NCM拨号模式 > AT+SER=1,1": "AT+SER=1,1"
},
{
"锁4G > AT^SYSCFGEX=\"03\",all,0,2,all,all,all,all,1": "AT^SYSCFGEX=\"03\",all,0,2,all,all,all,all,1"
},
{
"锁5G > AT^SYSCFGEX=\"04\",all,0,2,all,all,all,all,1": "AT^SYSCFGEX=\"04\",all,0,2,all,all,all,all,1"
},
{
"恢复自动搜索网络 > AT^SYSCFGEX=\"00\",all,0,2,all,all,all,all,1": "AT^SYSCFGEX=\"00\",all,0,2,all,all,all,all,1"
},
{
"查询模组IMEI > AT+LCTSN=0,7": "AT+LCTSN=0,7"
},
{
"更改模组IMEI > AT+LCTSN=1,7,\"IMEI\"": "AT+LCTSN=1,7,\"在此设置IMEI\""
},
{
"开启转网口 > AT+MGCFGEX=\"ETH_SWITCH\",1": "AT+MGCFGEX=\"ETH_SWITCH\",1"
},
{
"获取模组温度 > AT+TEMP": "AT+TEMP"
},
{
"重启模组 > AT+RESET": "AT+RESET"
}
]
},
"foxconn": {
@ -543,6 +602,127 @@
"重启模组 > AT+RESET": "AT+RESET"
}
]
},
"huawei": {
"hisilicon": [
{
"设置当前使用的为卡1 > AT^SIMSWITCH=1": "AT^SIMSWITCH=1"
},
{
"设置当前使用的为卡2 > AT^SIMSWITCH=0": "AT^SIMSWITCH=0"
},
{
"查询网络信息 > AT^SYSINFOEX": "AT^SYSINFOEX"
},
{
"查询当前拨号模式 > AT^SETMODE?": "AT^SETMODE?"
},
{
"ECM拨号模式Linux > AT^SETMODE=0": "AT^SETMODE=0"
},
{
"NCM拨号模式Windows > AT^SETMODE=1": "AT^SETMODE=1"
},
{
"ECM拨号模式LinuxDebug > AT^SETMODE=2": "AT^SETMODE=2"
},
{
"NCM拨号模式Windows,Debug > AT^SETMODE=3": "AT^SETMODE=3"
},
{
"锁4G > AT^SYSCFGEX=\"03\",40000000,1,2,7FFFFFFFFFFFFFFF,,": "AT^SYSCFGEX=\"03\",40000000,1,2,7FFFFFFFFFFFFFFF,,"
},
{
"锁5G > AT^SYSCFGEX=\"08\",40000000,1,2,7FFFFFFFFFFFFFFF,,": "AT^SYSCFGEX=\"08\",40000000,1,2,7FFFFFFFFFFFFFFF,,"
},
{
"恢复自动搜索网络 > AT^SYSCFGEX=\"00\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,,": "AT^SYSCFGEX=\"00\",3FFFFFFF,1,2,7FFFFFFFFFFFFFFF,,"
},
{
"获取模组温度 > AT^CHIPTEMP?": "AT^CHIPTEMP?"
},
{
"重启模组 > AT^RESET": "AT^RESET"
}
]
},
"simcom": {
"qualcomm": [
{
"查询锁频模式 > ": "AT+CNMP?"
},
{
"设置锁频模式 > 自动": "AT+CNMP=2"
},
{
"设置锁频模式 > 仅限 WCDMA": "AT+CNMP=14"
},
{
"设置锁频模式 > 仅限 LTE": "AT+CNMP=38"
},
{
"设置锁频模式 > NR5G": "AT+CNMP=71"
},
{
"设置锁频模式 > WCDMA+LTE Only": "AT+CNMP=54"
},
{
"设置锁频模式 > WCDMA+LTE+NR5G": "AT+CNMP=55"
},
{
"设置锁频模式 > LTE+NR5G": "AT+CNMP=109"
},
{
"重置模组 > AT+CRESET": "AT+CRESET"
},
{
"重置模组 > AT+CFUN=6": "AT+CFUN=6"
},
{
"重置模组 > ATZ": "ATZ"
},
{
"开启显示上下行模式 > AT+CNWINFO=1": "AT+CNWINFO=1"
},
{
"关闭显示上下行模式 > AT+CNWINFO=0": "AT+CNWINFO=0"
},
{
"切换PCIE模式 > AT+CPCIEMODE=EP": "AT+CPCIEMODE=EP"
},
{
"切换USB模式 > AT+CPCIEMODE=HOST": "AT+CPCIEMODE=HOST"
},
{
"开启sim热插拔 > AT+UIMHOTSWAPON=1": "AT+UIMHOTSWAPON=1"
},
{
"关闭sim热插拔 > AT+UIMHOTSWAPON=0": "AT+UIMHOTSWAPON=0"
},
{
"解除LTE小区锁定 > AT+CCELLCFG=0": "AT+CCELLCFG=0"
},
{
"解除5G小区锁定 > AT+C5GCELLCFG=\"unlock\"": "AT+C5GCELLCFG=\"unlock\""
},
{
"更改imei > AT+SIMEI=imei": "AT+SIMEI=imei"
},
{
"切换sim卡槽 > 卡槽1": "AT+SMSIMCFG=0,1"
},
{
"切换sim卡槽 > 卡槽2": "AT+SMSIMCFG=0,2"
},
{
"设置模块功能 > 最小功能": "AT+CFUN=0"
},
{
"设置模块功能 > 最大功能": "AT+CFUN=1"
},
{
"设置模块功能 > 离线模式": "AT+CFUN=7"
}
]
}
}

View File

@ -69,6 +69,28 @@ add_bar_info_entry()
json_close_object
}
add_speed_entry()
{
rate=$1
type=$2
if [ -z "$rate" ]; then
return
fi
rate=`rate_convert $rate`
case $type in
"rx")
add_plain_info_entry "Rx Rate" "$rate" "Transmit Rate"
;;
"tx")
add_plain_info_entry "Tx Rate" "$rate" "Receive Rate"
;;
*)
return
;;
esac
}
add_avalible_band_entry()
{
band_id=$1
@ -80,6 +102,52 @@ add_avalible_band_entry()
json_close_object
}
get_driver()
{
for i in $(find $modem_path -name driver);do
lsfile=$(ls -l $i)
type=${lsfile:0:1}
if [ "$type" == "l" ];then
link=$(basename $(ls -l $i | awk '{print $11}'))
case $link in
"mtk_t7xx")
mode="mtk_pcie"
break
;;
"qmi_wwan"*)
mode="qmi"
break
;;
"cdc_mbim")
mode="mbim"
break
;;
"cdc_ncm")
mode="ncm"
break
;;
"cdc_ether")
mode="ecm"
break
;;
"rndis_host")
mode="rndis"
break
;;
"mhi_netdev")
mode="mhi"
break
;;
*)
if [ -z "$mode" ]; then
mode="unknown"
fi
;;
esac
fi
done
echo $mode
}
get_dns()
{
@ -238,32 +306,45 @@ get_rat()
#return raw data
get_connect_status()
{
#get active pdp context
at_cmd="AT+CGACT?"
expect="+CGACT:"
result=`at $at_port $at_cmd | grep $expect|tr '\r' '\n'`
connect_status="No"
for pdp_index in `echo "$result" | tr -d "\r" | awk -F'[,:]' '$3 == 1 {print $2}'`; do
at_cmd="AT+CGPADDR=%s"
at_cmd=$(printf "$at_cmd" "$pdp_index")
expect="+CGPADDR:"
result=$(at $at_port $at_cmd | grep $expect)
if [ -n "$result" ];then
ipv6=$(echo $result | grep -oE "\b([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}\b")
ipv4=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
disallow_ipv4="0.0.0.0"
#remove the disallow ip
if [ "$ipv4" == "$disallow_ipv4" ];then
ipv4=""
fi
fi
if [ -n "$ipv4" ] || [ -n "$ipv6" ];then
driver=$(get_driver)
if [ "$driver" = "mtk_pcie" ]; then
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
local config=$(umbim -d $mbim_port config)
local ipv4=$(echo "$config" | grep "ipv4address:" | awk '{print $2}' | cut -d'/' -f1)
local ipv6=$(echo "$config" | grep "ipv6address:" | awk '{print $2}' | cut -d'/' -f1)
disallow_ipv4="0.0.0.0"
if [ -n "$ipv4" ] && [ "$ipv4" != "$disallow_ipv4" ] || [ -n "$ipv6" ] && [ "$ipv6" != "::" ]; then
connect_status="Yes"
break
else
connect_status="No"
fi
done
else
at_cmd="AT+CGACT?"
expect="+CGACT:"
result=`at $at_port $at_cmd | grep $expect|tr '\r' '\n'`
for pdp_index in `echo "$result" | tr -d "\r" | awk -F'[,:]' '$3 == 1 {print $2}'`; do
at_cmd="AT+CGPADDR=%s"
at_cmd=$(printf "$at_cmd" "$pdp_index")
expect="+CGPADDR:"
result=$(at $at_port $at_cmd | grep $expect)
if [ -n "$result" ];then
ipv6=$(echo $result | grep -oE "\b([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}\b")
ipv4=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
disallow_ipv4="0.0.0.0"
#remove the disallow ip
if [ "$ipv4" == "$disallow_ipv4" ];then
ipv4=""
fi
fi
if [ -n "$ipv4" ] || [ -n "$ipv6" ];then
connect_status="Yes"
break
else
connect_status="No"
fi
done
fi
add_plain_info_entry "connect_status" "$connect_status" "Connect Status"
}

View File

@ -3,7 +3,7 @@ source /usr/share/libubox/jshn.sh
method=$1
config_section=$2
at_port=$(uci get qmodem.$config_section.at_port)
sms_at_port=$(uci get qmodem.$config_section.sms_at_port)
uci -q get qmodem.$config_section.sms_at_port >/dev/null && sms_at_port=$(uci get qmodem.$config_section.sms_at_port)
vendor=$(uci get qmodem.$config_section.manufacturer)
platform=$(uci get qmodem.$config_section.platform)
define_connect=$(uci get qmodem.$config_section.define_connect)
@ -88,9 +88,24 @@ get_at_cfg(){
json_close_array
json_add_string using_port $(uci get qmodem.$config_section.at_port)
json_add_array cmds
general_cmd=$(jq -rc '.general[]|to_entries| .[] | @sh "key=\(.key) value=\(.value)"' /usr/share/qmodem/at_commands.json)
platform_cmd=$(jq -rc ".${vendor}.${platform}[]|to_entries| .[] | @sh \"key=\(.key) value=\(.value)\"" /usr/share/qmodem/at_commands.json)
[ -z "$platform_cmd" ] && platform_cmd=$(jq -rc ".$vendor.general[]|to_entries| .[] | @sh \"key=\(.key) value=\(.value)\"" /usr/share/qmodem/at_commands.json)
# Determine language and select appropriate AT commands file
lang=$(uci get luci.main.lang 2>/dev/null || echo "en")
case "$lang" in
zh*|cn|auto)
at_commands_file="/usr/share/qmodem/at_commands_zh.json"
;;
*)
at_commands_file="/usr/share/qmodem/at_commands_en.json"
;;
esac
# Fallback to default file if language-specific file doesn't exist
[ ! -f "$at_commands_file" ] && at_commands_file="/usr/share/qmodem/at_commands.json"
general_cmd=$(jq -rc '.general[]|to_entries| .[] | @sh "key=\(.key) value=\(.value)"' "$at_commands_file")
platform_cmd=$(jq -rc ".${vendor}.${platform}[]|to_entries| .[] | @sh \"key=\(.key) value=\(.value)\"" "$at_commands_file")
[ -z "$platform_cmd" ] && platform_cmd=$(jq -rc ".$vendor.general[]|to_entries| .[] | @sh \"key=\(.key) value=\(.value)\"" "$at_commands_file")
cmds=$(echo -e "$general_cmd\n$platform_cmd")
IFS=$'\n'
for cmd in $cmds; do

View File

@ -71,53 +71,6 @@ EOF
esac
}
get_driver()
{
for i in $(find $modem_path -name driver);do
lsfile=$(ls -l $i)
type=${lsfile:0:1}
if [ "$type" == "l" ];then
link=$(basename $(ls -l $i | awk '{print $11}'))
case $link in
"mtk_t7xx")
mode="mtk_pcie"
break
;;
"qmi_wwan"*)
mode="qmi"
break
;;
"cdc_mbim")
mode="mbim"
break
;;
"cdc_ncm")
mode="ncm"
break
;;
"cdc_ether")
mode="ecm"
break
;;
"rndis_host")
mode="rndis"
break
;;
"mhi_netdev")
mode="mhi"
break
;;
*)
if [ -z "$mode" ]; then
mode="unknown"
fi
;;
esac
fi
done
echo $mode
}
unlock_sim()
{
pin=$1
@ -161,6 +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
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
@ -170,7 +124,7 @@ update_config()
update_sim_slot
case $sim_slot in
1)
config_get apn $modem_config apn
config_get apn $modem_config apn "auto"
config_get username $modem_config username
config_get password $modem_config password
config_get auth $modem_config auth
@ -182,7 +136,7 @@ update_config()
config_get password $modem_config password2
config_get auth $modem_config auth2
config_get pincode $modem_config pincode2
[ -z "$apn" ] && config_get apn $modem_config apn
[ -z "$apn" ] && config_get apn $modem_config apn "auto"
[ -z "$username" ] && config_get username $modem_config username
[ -z "$password" ] && config_get password $modem_config password
[ -z "$auth" ] && config_get auth $modem_config auth
@ -207,6 +161,15 @@ check_dial_prepare()
{
cpin=$(at "$at_port" "AT+CPIN?")
get_sim_status "$cpin"
[ "$manufacturer" = "neoway" ] && {
local res
res=$(at $at_port 'AT+SIMCROSS=1,1;$MYCCID' | grep -q "ERROR")
if [ $? -ne 0 ]; then
sim_state_code="1"
else
sim_state_code="0"
fi
}
case $sim_state_code in
"0")
m_debug "info sim card is miss"
@ -280,7 +243,6 @@ check_ip()
;;
"mediatek")
check_ip_command="AT+CGPADDR=3"
stric=1
;;
esac
;;
@ -296,24 +258,37 @@ check_ip()
"qualcomm")
check_ip_command="AT+CGPADDR=1"
;;
"unisoc")
check_ip_command="AT+CGPADDR=1"
;;
esac
;;
"neoway")
case $platform in
"unisoc")
check_ip_command="AT+CGPADDR=1"
;;
esac
;;
*)
check_ip_command="AT+CGPADDR=1"
;;
esac
ipaddr=$(at "$at_port" "$check_ip_command" | grep +CGPADDR:)
if [ "$driver" = "mtk_pcie" ]; then
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
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)"
else
ipaddr=$(at "$at_port" "$check_ip_command" | grep +CGPADDR:)
fi
if [ -n "$ipaddr" ];then
if [ $mtk -eq 1 ] && echo "$ipv4_config" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
if [ "$pdp_type" = "ipv4v6" ];then
if ! ping -c 2 -w 5 2400:3200::1 > /dev/null 2>&1; then
m_debug "ipv6 is down,try to restart"
ifdown "$interface6_name" && sleep 2 && ifup "$interface6_name"
fi
fi
fi
ipv6=$(echo $ipaddr | grep -oE "\b([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}\b")
ipv4=$(echo $ipaddr | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
if [ "$manufacturer" = "simcom" ];then
ipv4=$(echo $ipaddr | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | grep -v "0\.0\.0\.0" | head -n 1)
ipaddr=$(echo $ipaddr | sed 's/\./:/g' | sed 's/+CGPADDR: //g' | sed 's/'$ipv4',//g')
ipv6=$(echo $ipaddr | grep -oE "\b([0-9a-fA-F]{0,4}.){2,7}[0-9a-fA-F]{0,4}\b")
fi
disallow_ipv4="0.0.0.0"
@ -337,6 +312,30 @@ check_ip()
fi
}
check_connection()
{
[ "$connection_status" = "0" ] || [ "$connection_status" = "-1" ] && return 0
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
break
fi
if [ $i -eq 2 ]; then
m_debug "IPv4 connection test failed, will redial"
return 1
fi
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 [ "$ifup_time" -gt 5 ] && [ "$pdp_type" = "ipv4v6" ]; then
rdisc6 $origin_device &
ndisc6 fe80::1 $origin_device &
fi
fi
return 0
}
append_to_fw_zone()
{
local fw_zone=$1
@ -444,7 +443,6 @@ set_if()
if [ -z "$interfacev6" ];then
uci set network.lan.ipv6='1'
uci set network.lan.ip6assign='64'
uci set network.lan.ip6class="${interface6_name}"
uci set network.${interface6_name}='interface'
uci set network.${interface6_name}.modem_config="${modem_config}"
uci set network.${interface6_name}.proto="${protov6}"
@ -629,25 +627,38 @@ wwan_hang()
ecm_hang()
{
if [ "$manufacturer" = "quectel" ]; then
at_command="AT+QNETDEVCTL=1,2,1"
elif [ "$manufacturer" = "fibocom" ]; then
#联发科平台广和通FM350-GL
if [ "$platform" = "mediatek" ]; then
at_command="AT+CGACT=0,3"
else
at_command="AT+GTRNDIS=0,1"
fi
elif [ "$manufacturer" = "meig" ]; then
at_command="AT$QCRMCALL=0,1,1,2,1"
else
at_command='ATI'
fi
tmp=$(at "${at_port}" "${at_command}")
case "$manufacturer" in
"quectel")
at_command="AT+QNETDEVCTL=1,2,1"
;;
"fibocom")
case "$platform" in
"mediatek")
at_command="AT+CGACT=0,3"
;;
*)
at_command="AT+GTRNDIS=0,1"
;;
esac
;;
"meig")
at_command='AT$QCRMCALL=0,0,1,2,1'
;;
"huawei")
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()
{
m_debug "hang up $modem_path driver $driver"
@ -689,29 +700,29 @@ qmi_dial()
{
cmd_line="quectel-CM"
[ -e "/usr/bin/quectel-CM-M" ] && cmd_line="quectel-CM-M"
case $pdp_type in
"ip") cmd_line="$cmd_line -4" ;;
"ipv6") cmd_line="$cmd_line -6" ;;
"ipv4v6") cmd_line="$cmd_line -4 -6" ;;
*) cmd_line="$cmd_line -4 -6" ;;
esac
case $pdp_type in
"ip") cmd_line="$cmd_line -4" ;;
"ipv6") cmd_line="$cmd_line -6" ;;
"ipv4v6") cmd_line="$cmd_line -4 -6" ;;
*) cmd_line="$cmd_line -4 -6" ;;
esac
if [ "$network_bridge" = "1" ]; then
cmd_line="$cmd_line -b"
fi
if [ -n "$apn" ]; then
cmd_line="$cmd_line -s $apn"
fi
if [ -n "$username" ]; then
cmd_line="$cmd_line $username"
fi
if [ -n "$password" ]; then
cmd_line="$cmd_line $password"
fi
if [ "$auth" != "none" ]; then
cmd_line="$cmd_line $auth"
fi
if [ -n "$modem_netcard" ]; then
if [ "$network_bridge" = "1" ]; then
cmd_line="$cmd_line -b"
fi
if [ -n "$apn" ]; then
cmd_line="$cmd_line -s $apn"
fi
if [ -n "$username" ]; then
cmd_line="$cmd_line $username"
fi
if [ -n "$password" ]; then
cmd_line="$cmd_line $password"
fi
if [ "$auth" != "none" ]; then
cmd_line="$cmd_line $auth"
fi
if [ -n "$modem_netcard" ]; then
qmi_if=$modem_netcard
#if is wwan* ,use the first part of the name
if [[ "$modem_netcard" = "wwan"* ]];then
@ -721,8 +732,8 @@ qmi_dial()
if [[ "$modem_netcard" = "rmnet"* ]];then
qmi_if=$(echo "$modem_netcard" | cut -d. -f1)
fi
cmd_line="${cmd_line} -i ${qmi_if}"
fi
cmd_line="${cmd_line} -i ${qmi_if}"
fi
if [ "$en_bridge" = "1" ];then
cmd_line="${cmd_line} -b"
fi
@ -750,7 +761,7 @@ at_dial()
pdp_type="IP"
fi
local at_command='AT+COPS=0,0'
tmp=$(at "${at_port}" "${at_command}")
tmp=$(at "${at_port}" "${at_command}")
pdp_type=$(echo $pdp_type | tr 'a-z' 'A-Z')
case $manufacturer in
"quectel")
@ -763,6 +774,10 @@ at_dial()
at_command="AT+QNETDEVCTL=1,3,1"
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;;
"hisilicon")
at_command="AT+QNETDEVCTL=1,1,1"
cgdcont_command=""
;;
"lte")
if [ "$define_connect" = "3" ];then
at_command="AT+QNETDEVCTL=3,3,1"
@ -793,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
@ -802,6 +817,14 @@ at_dial()
;;
esac
;;
"huawei")
case $platform in
"hisilicon")
at_command="AT^NDISDUP=1,1"
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\""
;;
esac
;;
"simcom")
case $platform in
"qualcomm")
@ -814,7 +837,23 @@ at_dial()
"meig")
case $platform in
"qualcomm")
at_command=""
at_command='AT$QCRMCALL=1,0,1,2,1'
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;;
esac
;;
"neoway")
case $platform in
"unisoc")
at_command='AT$MYUSBNETACT=0,1'
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;;
esac
;;
"telit")
case $platform in
"qualcomm")
at_command="AT#ICMAUTOCONN=1,1"
cgdcont_command="AT+CGDCONT=1,\"$pdp_type\",\"$apn\""
;;
esac
@ -822,50 +861,54 @@ at_dial()
esac
m_debug "dialing vendor:$manufacturer;platform:$platform; $cgdcont_command ; $at_command"
at "${at_port}" "${cgdcont_command}"
if [ $mtk -eq 1 ];then
sleep 3
fi
at "$at_port" "$at_command"
if [ $mtk -eq 1 ];then
sleep 3
fastat "$at_port" "$at_command"
[ -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')
umbim -d $mbim_port disconnect
sleep 1
umbim -d $mbim_port connect 0
fi
}
ip_change_fm350()
{
m_debug "ip_change_fm350"
at_command="AT+CGPADDR=3"
local ipv4_config=$(at ${at_port} ${at_command} | cut -d, -f2 | grep -oE '[0-9]+.[0-9]+.[0-9]+.[0-9]+')
local public_dns1_ipv4="223.5.5.5"
local public_dns2_ipv4="119.29.29.29"
local public_dns1_ipv6="2400:3200::1"
local public_dns2_ipv6="2402:4e00::"
at_command="AT+GTDNS=3" | grep "+GTDNS: "| grep -E '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | sed -n '1p'
local ipv4_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $1}')
[ -z "$ipv4_dns1" ] && {
ipv4_dns1="${public_dns1_ipv4}"
}
local netmask="255.255.255.0"
local ipv4_dns2=$(echo "${response}" | awk -F'"' '{print $4}' | awk -F',' '{print $1}')
[ -z "$ipv4_dns2" ] && {
ipv4_dns2="${public_dns2_ipv4}"
}
if [ "$driver" = "mtk_pcie" ]; then
mbim_port=$(echo "$at_port" | sed 's/at/mbim/g')
local ipv6_dns1=$(echo "${response}" | awk -F'"' '{print $2}' | awk -F',' '{print $2}')
[ -z "$ipv6_dns1" ] && {
ipv6_dns1="${public_dns1_ipv6}"
}
local config=$(umbim -d $mbim_port config)
ipv4_config=$(echo "$config" | grep "ipv4address:" | awk '{print $2}' | cut -d'/' -f1)
gateway=$(echo "$config" | grep "ipv4gateway:" | awk '{print $2}')
local ipv6_dns2=$(echo "${response}" | awk -F'"' '{print $4}' | awk -F',' '{print $2}')
[ -z "$ipv6_dns2" ] && {
ipv6_dns2="${public_dns2_ipv6}"
}
uci_ipv4=$(uci -q get network.$interface_name.ipaddr)
ipv4_dns1=$(echo "$config" | grep "ipv4dnsserver:" | head -n 1 | awk '{print $2}')
ipv4_dns2=$(echo "$config" | grep "ipv4dnsserver:" | tail -n 1 | awk '{print $2}')
[ -z "$ipv4_dns1" ] && ipv4_dns1="$public_dns1_ipv4"
[ -z "$ipv4_dns2" ] && ipv4_dns2="$public_dns2_ipv4"
# m_debug "umbim config: ipv4=$ipv4_config, gateway=$gateway, netmask=$netmask, dns1=$ipv4_dns1, dns2=$ipv4_dns2"
else
at_command="AT+CGPADDR=3"
response=$(at ${at_port} ${at_command})
ipv4_config=$(echo "$response" | grep "+CGPADDR:" | grep -o '"[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+"' | head -1 | tr -d '"')
gateway="${ipv4_config%.*}.1"
response=$(at ${at_port} "AT+GTDNS=3")
ipv4_dns=$(echo "$response" | grep "+GTDNS:" | head -1)
ipv4_dns1=$(echo "$ipv4_dns" | grep -o '"[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+"' | head -1 | tr -d '"')
ipv4_dns2=$(echo "$ipv4_dns" | grep -o '"[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+"' | tail -1 | tr -d '"')
[ -z "$ipv4_dns1" ] && ipv4_dns1="$public_dns1_ipv4"
[ -z "$ipv4_dns2" ] && ipv4_dns2="$public_dns2_ipv4"
uci_ipv4=$(uci -q get network.$interface_name.ipaddr)
fi
uci set network.${interface_name}.proto='static'
uci set network.${interface_name}.ipaddr="${ipv4_config}"
uci set network.${interface_name}.netmask='255.255.255.0'
uci set network.${interface_name}.gateway="${ipv4_config%.*}.1"
uci set network.${interface_name}.netmask="${netmask}"
uci set network.${interface_name}.gateway="${gateway}"
uci set network.${interface_name}.peerdns='0'
uci -q del network.${interface_name}.dns
uci add_list network.${interface_name}.dns="${ipv4_dns1}"
@ -983,30 +1026,34 @@ check_logfile_line()
unexpected_response_count=0
at_dial_monitor()
{
check_ip
at_dial
ipv4_cache=$ipv4
ipv6_cache=$ipv6
sleep 5
while true; do
check_ip
if [ $connection_status -eq 0 ];then
at_dial
sleep 5
elif [ $connection_status -eq -1 ];then
unexpected_response_count=$((unexpected_response_count+1))
if [ $unexpected_response_count -gt 3 ];then
case $connection_status in
0)
at_dial
unexpected_response_count=0
fi
sleep 10
else
#检测ipv4是否变化
sleep 15
if [ "$ipv4" != "$ipv4_cache" ];then
handle_ip_change
ipv6_cache=$ipv6
ipv4_cache=$ipv4
fi
fi
sleep 3
;;
-1)
unexpected_response_count=$((unexpected_response_count+1))
if [ $unexpected_response_count -gt 3 ]; then
at_dial
unexpected_response_count=0
fi
sleep 5
;;
*)
if [ "$ipv4" != "$ipv4_cache" ] || [ "$ipv6" != "$ipv6_cache" ]; then
handle_ip_change
ipv4_cache=$ipv4
ipv6_cache=$ipv6
fi
[ "$connect_check" -eq 1 ] && { sleep 5; check_connection || { hang && at_dial; }; } || sleep 15
;;
esac
check_logfile_line
done
}

View File

@ -0,0 +1,78 @@
{
"modem_port_rule": {
"usb": {
"305a:1421": {
"name": "gm800",
"mode": "qmi",
"option_driver": 1,
"include": [
"1.1"
]
},
"305a:1404": {
"name": "gm800",
"mode": "rndis",
"option_driver": 0,
"include": [
"1.1"
]
},
"2dee:4d23": {
"name": "srm825xeu",
"mode": "ecm",
"option_driver": 1,
"include": [
"1.1"
]
},
"2dee:4d38": {
"name": "srm825xeu",
"mode": "rndis",
"option_driver": 1,
"include": [
"1.3"
]
},
"3466:3301": {
"name": "mt5700m-cn",
"option_driver": 1
},
"2c7c:8101": {
"name": "rg801",
"option_driver": 1
},
"1782:4039": {
"name": "nu313-m2",
"mode": "ecm",
"option_driver": 1,
"include": [
"1.2"
]
},
"1782:4038": {
"name": "nu313-m2",
"mode": "rndis",
"option_driver": 1,
"include": [
"1.2"
]
},
"1782:4040": {
"name": "nu313-m2",
"mode": "ncm",
"option_driver": 1,
"include": [
"1.2"
]
},
"3763:3c93": {
"name": "nari-m601",
"mode": "ecm",
"option_driver": 1,
"include": [
"1.1"
]
}
}
}
}

View File

@ -4,12 +4,11 @@ action=$1
config=$2
slot_type=$3
modem_support=$(cat /usr/share/qmodem/modem_support.json)
modem_port_rule=$(cat /usr/share/qmodem/modem_port_rule.json)
debug_subject="modem_scan"
source /lib/functions.sh
source /usr/share/qmodem/modem_util.sh
exec_post_init()
{
section_name=$1
@ -172,22 +171,23 @@ scan_pcie_slot_interfaces()
[ ! -z "$dun_device" ] && dun_device_path="$wwan0_path/$dun_device"
[ ! -z "$dun_device_path" ] && dun_devices=$(basename "$dun_device_path")
fi
fi
fi
#mt_t7xx device
wwan_path="$slot_path/wwan"
net_devices=$(ls "$wwan_path" | grep -E "wwan[0-9]")
devices_path="$wwan_path/$net_devices"
if [ -d "$devices_path" ];then
mbim_devices=$(ls "$devices_path" | grep -E "wwan[0-9]mbim[0-9]")
dun_devices=$(ls "$devices_path" | grep -E "wwan[0-9]at[0-9]")
if [ -d "$wwan_path" ]; then
net_devices=$(ls "$wwan_path" | grep -E "wwan[0-9]")
devices_path="$wwan_path/$net_devices"
if [ -d "$devices_path" ];then
mbim_devices=$(ls "$devices_path" | grep -E "wwan[0-9]mbim[0-9]")
dun_devices=$(ls "$devices_path" | grep -E "wwan[0-9]at[0-9]")
fi
fi
echo "net_devices: $net_devices dun_devices: $dun_devices"
m_debug "net_devices: $net_devices dun_devices: $dun_devices"
at_ports="$dun_devices"
[ -n "$net_devices" ] && get_associate_usb $slot
if [ -n "$associated_usb" ]; then
if [ -n "$associated_usb" ] && [ -d "/sys/bus/usb/devices/$associated_usb" ]; then
echo checking associated_usb: $associated_usb
local assoc_usb_path="/sys/bus/usb/devices/$associated_usb"
[ ! -d "$assoc_usb_path" ] && return
local slot_interfaces=$(ls $assoc_usb_path | grep -E "$associated_usb:[0-9]\.[0-9]+")
echo checking slot_interfaces: $slot_interfaces
for interface in $slot_interfaces; do
@ -214,7 +214,6 @@ scan_pcie_slot_interfaces()
done
at_ports="$dun_devices $tty_devices"
fi
validate_at_port
}
@ -225,6 +224,34 @@ scan_usb_slot_interfaces()
net_devices=""
tty_devices=""
[ ! -d "$slot_path" ] && return
slot_vid=$(cat "$slot_path/idVendor" 2>/dev/null || echo "")
slot_pid=$(cat "$slot_path/idProduct" 2>/dev/null || echo "")
# m_debug "($slot_vid:$slot_pid) $slot_path"
if [ -n "$slot_vid" ] && [ -n "$slot_pid" ]; then
modem_port_config=$(echo $modem_port_rule | jq '.modem_port_rule."'$slot_type'"."'$slot_vid:$slot_pid'"')
if [ "$modem_port_config" != "null" ] && [ -n "$modem_port_config" ]; then
config_modem_name=$(echo $modem_port_config | jq -r '.name' 2>/dev/null || echo "")
include_ports=$(echo $modem_port_config | jq -r '.include[]' 2>/dev/null || echo "")
option_driver=$(echo $modem_port_config | jq -r '.option_driver' 2>/dev/null || echo "0")
if [ -n "$include_ports" ]; then
include_mode=1
m_debug "using special config for $config_modem_name($slot_vid:$slot_pid) with ports: $include_ports"
fi
fi
else
m_debug "Unable to read VID/PID from device path: $slot_path"
fi
if [ "$option_driver" = "1" ] && [ -n "$slot_vid" ] && [ -n "$slot_pid" ]; then
if ! echo "$slot_vid $slot_pid" > /sys/bus/usb-serial/drivers/option1/new_id 2>/dev/null; then
m_debug "failed to set option driver"
fi
fi
local slot_interfaces=$(ls $slot_path | grep -E "$slot:[0-9]\.[0-9]+")
for interface in $slot_interfaces; do
unset device
@ -234,6 +261,9 @@ scan_usb_slot_interfaces()
[ ! -d "$interface_driver_path" ] && continue
interface_driver=$(basename $(readlink $interface_driver_path))
[ -z "$interface_driver" ] && continue
local if_port=$(echo "$interface" | grep -oE "[0-9]+\.[0-9]+$" || echo "")
case $interface_driver in
option|\
cdc_acm|\
@ -244,11 +274,26 @@ scan_usb_slot_interfaces()
[ -z "$ttyUSB_device" ] && [ -z "$ttyACM_device" ] && continue
[ -n "$ttyUSB_device" ] && device="$ttyUSB_device"
[ -n "$ttyACM_device" ] && device="$ttyACM_device"
[ -z "$tty_devices" ] && tty_devices="$device" || tty_devices="$tty_devices $device"
local should_include=1
if [ $include_mode -eq 1 ]; then
should_include=0
for included_port in $include_ports; do
if [ -n "$if_port" ] && [ "$included_port" = "$if_port" ]; then
should_include=1
break
fi
done
fi
if [ $should_include -eq 1 ]; then
[ -z "$tty_devices" ] && tty_devices="$device" || tty_devices="$tty_devices $device"
fi
;;
qmi_wwan*|\
cdc_mbim|\
cdc_ncm|\
*cdc_ncm|\
cdc_ether|\
rndis_host)
net_path="$slot_path/$interface/net"
@ -271,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
@ -283,24 +328,35 @@ match_config()
[[ "$name" = *"nl668"* ]] && name="nl668"
[[ "$name" = *"nl678"* ]] && name="nl678"
[[ "$name" = *"em120k"* ]] && name="em120k"
[[ "$name" = *"em120k"* ]] && name="em120k"
#FM350-GL-00 5G Module
[[ "$name" = *"fm350-gl"* ]] && name="fm350-gl"
#FM350-GL-00 5G Module
[[ "$name" = *"fm350-gl"* ]] && name="fm350-gl"
#FM190W-GL 5G Module
[[ "$name" = *"fm190w-gl"* ]] && name="fm190w-gl"
#RM500U-CNV
[[ "$name" = *"rm500u-cn"* ]] && name="rm500u-cn"
#RM500U-CNV
[[ "$name" = *"rm500u-cn"* ]] && name="rm500u-cn"
[[ "$name" = *"rm500u-ea"* ]] && name="rm500u-ea"
#t99w175
[[ "$name" = *"mv31-w"* ]] && name="t99w175"
[[ "$name" = *"rm500u-ea"* ]] && name="rm500u-ea"
#t99w175
[[ "$name" = *"mv31-w"* ]] || [[ "$name" = *"T99W175"* ]] && name="t99w175"
[[ "$name" = *"T99W175"* ]] && name="t99w175"
[[ "$name" = *"T99W373"* ]] && name="t99w373"
[[ "$name" = *"T99W373"* ]] && name="t99w373"
[[ "$name" = *"dp25-42843-47"* ]] && name="t99w640"
#rg200u-cn
[[ "$name" = *"SIM8380G"* ]] && name="SIM8380G-M2"
#rg200u-cn
[[ "$name" = *"rg200u-cn"* ]] && name="rg200u-cn"
#nu313-m2
[[ "$name" = *"nu313-m2"* ]] && name="srm821"
#nari-m601
[[ "$name" = *"m601"* ]] && name="n510m"
modem_config=$(echo $modem_support | jq '.modem_support."'$slot_type'"."'$name'"')
[ "$modem_config" == "null" ] && return
@ -319,17 +375,22 @@ match_config()
get_modem_model()
{
local at_port=$1
sleep 1
cgmm=$(at $at_port "AT+CGMM")
sleep 1
cgmm_1=$(at $at_port "AT+CGMM?")
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" | 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
}
@ -409,7 +470,9 @@ add()
set qmodem.$section_name.path="$modem_path"
set qmodem.$section_name.data_interface="$slot_type"
set qmodem.$section_name.enable_dial="1"
set qmodem.$section_name.pdp_type="ip"
set qmodem.$section_name.soft_reboot="1"
set qmodem.$section_name.extend_prefix="1"
set qmodem.$section_name.pdp_type="ipv4v6"
set qmodem.$section_name.state="enabled"
set qmodem.$section_name.metric=$metric
EOF
@ -437,6 +500,7 @@ EOF
for at_port in $at_ports; do
uci add_list qmodem.$section_name.ports="/dev/$at_port"
done
[ "$option_driver" == "1" ] && uci set qmodem.$section_name.option_driver="1"
uci commit qmodem
mkdir -p /var/run/qmodem/${section_name}_dir
lock -u /tmp/lock/modem_add_$slot

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",
@ -8,15 +22,48 @@
"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",
"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": [
"qmi",
"ecm",
"mbim",
"rndis",
"ncm"
"rndis"
]
},
"ep06": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
"platform": "lte",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/3/5/8",
"lte_band": "1/3/5/7/8/20/28/32/38/40/41",
"nsa_band": "0",
"sa_band": "0",
"modes": [
"qmi",
"ecm",
"mbim",
"rndis"
]
},
"em12": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
"platform": "lte",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/2/3/4/5/8/9/19",
"lte_band": "1/2/3/4/5/7/8/9/12/13/14/17/18/19/20/21/25/26/28/29/30/32/66",
"nsa_band": "0",
"sa_band": "0",
"modes": [
"qmi",
"ecm",
"mbim",
"rndis"
]
},
"em120k": {
@ -25,7 +72,7 @@
"platform": "lte12",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/2/4/5/6/8/19",
"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/31/34/38/39/40/41/42/43/46/48/66/71",
"nsa_band": "0",
"sa_band": "0",
@ -33,10 +80,55 @@
"qmi",
"ecm",
"mbim",
"rndis",
"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",
"platform": "hisilicon",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/8",
"lte_band": "1/3/5/8/34/38/39/40/41",
"nsa_band": "41/78/79",
"sa_band": "1/28/41/78/79",
"modes": [
"ecm",
"ncm"
]
},
"mh5000-31": {
"manufacturer_id": "12d1",
"manufacturer": "huawei",
"platform": "hisilicon",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/8",
"lte_band": "1/3/5/8/34/38/39/40/41",
"nsa_band": "41/78/79",
"sa_band": "1/41/78/79",
"modes": [
"ecm"
]
},
"rg200u-cn": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
@ -54,6 +146,22 @@
"ncm"
]
},
"rg801": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
"platform": "hisilicon",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/8",
"lte_band": "1/3/5/8/34/38/39/40/41",
"nsa_band": "41/78/79",
"sa_band": "1/28/41/78/79",
"modes": [
"ecm",
"rndis",
"ncm"
]
},
"rm500u-cn": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
@ -335,6 +443,25 @@
"ncm"
]
},
"rm551e-gl": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
"platform": "qualcomm",
"data_interface": "usb",
"define_connect": "1",
"wcdma_band": "1/2/4/5/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/13/14/18/20/25/26/28/29/30/38/40/41/48/66/70/71/75/76/77/78/79",
"sa_band": "1/2/3/5/7/8/12/13/14/18/20/25/26/28/29/30/38/40/41/48/66/70/71/75/76/77/78/79",
"modes": [
"qmi",
"gobinet",
"ecm",
"mbim",
"rndis",
"ncm"
]
},
"rg501q-eu": {
"manufacturer_id": "2c7c",
"manufacturer": "quectel",
@ -407,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",
@ -524,6 +670,21 @@
"ncm"
]
},
"fm190w-gl": {
"manufacturer_id": "2cb7",
"manufacturer": "fibocom",
"platform": "qualcomm",
"data_interface": "usb",
"define_connect": "1",
"modes": [
"qmi",
"gobinet",
"ecm",
"mbim",
"rndis",
"ncm"
]
},
"nl668": {
"manufacturer_id": "1508",
"manufacturer": "fibocom",
@ -654,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",
@ -705,7 +879,19 @@
"define_connect": "1",
"modes": [
"mbim",
"rmnet"
"rmnet"
]
},
"srm821": {
"manufacturer_id": "1782",
"manufacturer": "meig",
"platform": "unisoc",
"data_interface": "usb",
"define_connect": "1",
"modes": [
"ecm",
"rndis",
"ncm"
]
},
"t99w373": {
@ -718,9 +904,34 @@
"mbim",
"rmnet"
]
},
"n510m": {
"manufacturer_id": "3763",
"manufacturer": "neoway",
"platform": "unisoc",
"data_interface": "usb",
"define_connect": "1",
"modes": [
"ecm"
]
}
},
"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",
@ -750,6 +961,28 @@
"mbim"
]
},
"t99w640": {
"manufacturer": "foxconn",
"platform": "qualcomm",
"data_interface": "pcie",
"define_connect": "1",
"modes": [
"mbim"
]
},
"simcom_sim8380g-m2": {
"manufacturer": "simcom",
"platform": "qualcomm",
"data_interface": "pcie",
"define_connect": "1",
"wcdma_band": "1/2/3/4/5/8",
"lte_band": "1/2/3/4/5/7/8/12/13/14/17/18/19/20/25/26/28/29/30/66/71",
"nsa_band": "1/2/3/5/7/8/12/20/28/40/41/48/66/71/77/78/79",
"sa_band": "1/2/3/5/7/8/12/20/28/40/41/48/66/71/77/78/79",
"modes": [
"qmi"
]
},
"rm500q-cn": {
"manufacturer": "quectel",
"platform": "qualcomm",
@ -886,6 +1119,21 @@
"mbim"
]
},
"rm551e-gl": {
"manufacturer": "quectel",
"platform": "qualcomm",
"data_interface": "pcie",
"define_connect": "1",
"wcdma_band": "1/2/4/5/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/13/14/18/20/25/26/28/29/30/38/40/41/48/66/70/71/75/76/77/78/79",
"sa_band": "1/2/3/5/7/8/12/13/14/18/20/25/26/28/29/30/38/40/41/48/66/70/71/75/76/77/78/79",
"modes": [
"qmi",
"gobinet",
"mbim"
]
},
"rg520n-eu": {
"manufacturer": "quectel",
"platform": "qualcomm",
@ -927,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",
@ -960,6 +1223,15 @@
"mbim"
]
},
"rw350r-gl": {
"manufacturer": "fibocom",
"platform": "mediatek",
"data_interface": "pcie",
"define_connect": "1",
"modes": [
"mbim"
]
},
"fm150-ae": {
"manufacturer": "fibocom",
"platform": "qualcomm",
@ -969,6 +1241,35 @@
"qmi",
"mbim"
]
},
"fm190w-gl": {
"manufacturer": "fibocom",
"platform": "qualcomm",
"data_interface": "pcie",
"define_connect": "1",
"modes": [
"qmi"
]
},
"em9190": {
"manufacturer": "sierra",
"platform": "qualcomm",
"data_interface": "pcie",
"define_connect": "1",
"modes": [
"mbim",
"rmnet"
]
},
"fn990a40": {
"manufacturer": "telit",
"platform": "qualcomm",
"data_interface": "usb",
"define_connect": "1",
"modes": [
"mbim",
"qmi"
]
}
},
"device": {
@ -1070,13 +1371,17 @@
"meig": {
"unisoc": {
"vendor_id": [
"2dee"
"2dee",
"1782"
],
"product_id": [
"4d50",
"4d51",
"4d52",
"4d53"
"4d53",
"4039",
"4038",
"4040"
]
},
"qualcomm": {
@ -1117,11 +1422,13 @@
"qualcomm": {
"vendor_id": [
"1a0e",
"1e0e"
"1e0e",
"17cb"
],
"product_id": [
"9001",
"9011"
"9011",
"0308"
]
}
},
@ -1129,13 +1436,35 @@
"qualcomm": {
"vendor_id": [
"17cb",
"05c6"
"05c6",
"105b"
],
"product_id": [
"0306",
"0308",
"90d5",
"9025"
"90d5",
"9025",
"e0ab"
]
}
},
"neoway": {
"unisoc": {
"vendor_id": [
"3763"
],
"product_id": [
"3c93"
]
}
},
"telit": {
"qualcomm": {
"vendor_id": [
"1bc7"
],
"product_id": [
"1075"
]
}
}

View File

@ -11,7 +11,6 @@ at()
tom_modem -d $at_port -o a -c "$atcmd"
}
fastat()
{
local at_port=$1
@ -146,6 +145,40 @@ at_get_slot()
;;
esac
;;
"neoway")
at_res=$(at $at_port 'AT+SIMCROSS?' | grep "+SIMCROSS:" | awk -F'[ ,]' '{print $2}' | sed 's/\r//g')
case $at_res in
"1")
sim_slot="1"
;;
"2")
sim_slot="2"
;;
*)
sim_slot="1"
;;
*)
sim_slot="1"
;;
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

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

View File

@ -6,7 +6,9 @@ _Author="Siriling Fujr"
_Maintainer="Fujr <fjrcn@outlook.com>"
source /usr/share/qmodem/generic.sh
vendor_get_disabled_features(){
json_add_string "" ""
}
debug_subject="fibocom_ctrl"
#获取拨号模式
@ -58,6 +60,11 @@ get_mode()
"41") mode="rndis" ;;
*) mode="$mode_num" ;;
esac
driver=$(get_driver)
case "$driver" in
"mtk_pcie")
mode="mbim" ;;
esac
;;
*)
mode="$mode_num"
@ -72,7 +79,7 @@ get_mode()
json_add_string "$available_mode" "0"
fi
done
json_close_objectget_imei
json_close_object
}
#设置拨号模式
@ -214,7 +221,7 @@ set_network_prefer_nr()
esac
#设置模组
at_command="AT+GTACT=$network_prefer_num"
at_command="AT+GTACT=$network_prefer_num,6,3"
res=$(at $at_port "$at_command")
json_select_object "result"
json_add_string "status" "$res"
@ -571,10 +578,8 @@ network_info()
add_plain_info_entry "CQI DL" "$cqi_dl" "Channel Quality Indicator for Downlink"
add_plain_info_entry "AMBR UL" "$ambr_ul" "Access Maximum Bit Rate for Uplink"
add_plain_info_entry "AMBR DL" "$ambr_dl" "Access Maximum Bit Rate for Downlink"
rx_rate=$(rate_convert $rx_rate)
tx_rate=$(rate_convert $tx_rate)
add_plain_info_entry "Tx Rate" "$tx_rate" "Transmit Rate"
add_plain_info_entry "Rx Rate" "$rx_rate" "Receive Rate"
add_speed_entry rx $rx_rate
add_speed_entry tx $tx_rate
}
get_lockband(){
@ -823,8 +828,8 @@ set_lockband_nr()
m_debug "Fibocom set lockband info"
get_lockband_config_command="AT+GTACT?"
get_lockband_config_res=$(at $at_port $get_lockband_config_command)
network_prefer_config=$(echo $get_lockband_config_res |cut -d : -f 2| awk -F"," '{ print $1","$2","$3}' |tr -d ' ')
local lock_band="$network_prefer_config,$lock_band"
network_prefer_config=$(echo $get_lockband_config_res |cut -d : -f 2| awk -F"," '{print $1}' |tr -d ' ')
local lock_band="$network_prefer_config,6,3,$lock_band"
local set_lockband_command="AT+GTACT=$lock_band"
res=$(at $at_port $set_lockband_command)
}
@ -1037,7 +1042,7 @@ get_bandwidth()
"NR")
case $bandwidth_num in
"0") bandwidth="5" ;;
"10"|"15"|"20"|"25"|"30"|"40"|"50"|"60"|"70"|"80"|"90"|"100"|"200"|"400") bandwidth="$bandwidth_num" ;;
*) bandwidth=$(( $bandwidth_num / 5 )) ;;
esac
;;
esac
@ -1138,7 +1143,22 @@ cell_info()
case $rat in
"NR")
network_mode="NR5G-SA Mode"
at_command='AT+GTCAINFO?'
ca_response=$(at $at_port $at_command)
if echo "$ca_response" | grep -q "SCC"; then
has_ca=1
scc_info=$(echo "$ca_response" | grep "SCC" | sed 's/\r//g')
scc_band_num=$(echo "$scc_info" | awk -F',' '{print $3}')
scc_arfcn=$(echo "$scc_info" | awk -F',' '{print $5}')
scc_band=$(get_band "NR" ${scc_band_num})
nr_scc_dl_bandwidth_num=$(echo "$scc_info" | awk -F',' '{print $6}')
nr_scc_dl_bandwidth=$(get_bandwidth "NR" ${nr_scc_dl_bandwidth_num})
fi
if [ $has_ca -eq 1 ]; then
network_mode="NR5G-SA CA Mode"
else
network_mode="NR5G-SA Mode"
fi
nr_mcc=$(echo "$response" | awk -F',' '{print $3}')
nr_mnc=$(echo "$response" | awk -F',' '{print $4}')
nr_tac=$(echo "$response" | awk -F',' '{print $5}')
@ -1147,8 +1167,10 @@ cell_info()
nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $8}')
nr_band_num=$(echo "$response" | awk -F',' '{print $9}')
nr_band=$(get_band "NR" ${nr_band_num})
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
nr_dl_bandwidth_num=$(echo "$ca_response" | grep "PCC" | sed 's/\r//g' | awk -F',' '{print $4}')
nr_dl_bandwidth=$(get_bandwidth "NR" ${nr_dl_bandwidth_num})
nr_ul_bandwidth_num=$(echo "$ca_response" | grep "PCC" | sed 's/\r//g' | awk -F',' '{print $5}')
nr_ul_bandwidth=$(get_bandwidth "NR" ${nr_ul_bandwidth_num})
nr_sinr_num=$(echo "$response" | awk -F',' '{print $11}')
nr_sinr=$(get_sinr "NR" ${nr_sinr_num})
nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
@ -1256,19 +1278,26 @@ cell_info()
class="Cell Information"
add_plain_info_entry "network_mode" "$network_mode" "Network Mode"
case $network_mode in
"NR5G-SA Mode")
"NR5G-SA Mode"|"NR5G-SA CA Mode")
add_plain_info_entry "MMC" "$nr_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$nr_mnc" "Mobile Network Code"
add_plain_info_entry "Duplex Mode" "$nr_duplex_mode" "Duplex Mode"
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 "TAC" "$nr_tac" "Tracking area code of cell served by neighbor Enb"
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
if [ $has_ca -eq 1 ]; then
add_plain_info_entry "ARFCN" "$nr_arfcn / $scc_arfcn" "Absolute Radio-Frequency Channel Number"
add_plain_info_entry "Band" "$nr_band / $scc_band" "Band"
add_plain_info_entry "DL Bandwidth" "${nr_dl_bandwidth}M / ${nr_scc_dl_bandwidth}M" "DL Bandwidth"
else
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}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" -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"
@ -1287,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"
@ -1302,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"
;;
@ -1321,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,20 @@
#!/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
"t99w640")
at_pre="AT+"
;;
*)
at_pre="AT^"
;;
esac
function get_imei(){
imei=$(at $at_port "ATI" | awk -F': ' '/^IMEI:/ {print $2}' | xargs)
@ -11,21 +23,27 @@ function get_imei(){
function set_imei(){
imei=$1
extended="80A$imei" # 添加 80A 前缀
formatted=""
# 添加 80A 前缀
extended="80A${imei}"
swapped=""
len=${#extended}
i=0
while [ $i -lt ${#extended} ]; do
byte=$(echo "$extended" | cut -c$((i+1))-$((i+2))) # 获取两个字符
formatted="$formatted$byte,"
while [ $i -lt $len ]; do
pair=$(echo "$extended" | cut -c$((i+1))-$((i+2)))
if [ ${#pair} -eq 2 ]; then
swapped="${swapped}${pair:1:1}${pair:0:1}"
elif [ ${#pair} -eq 1 ]; then
swapped="${swapped}${pair:0:1}"
fi
i=$((i+2))
done
# 去除最后的逗号
formatted=$(echo ${formatted%,}|xargs)
#echo "$formatted"
# 两位分组加逗号,并转小写
formatted=$(echo "$swapped" | sed 's/../&,/g' | sed 's/,$//' | tr 'A-Z' 'a-z')
at_command="at^nv=550,9,$formatted"
res=$(at $at_port \"$at_command\")
at $at_port $at_pre'nv=550,"0"'
at_command=$at_pre'nv=550,9,"'$formatted'"'
res=$(at $at_port "$at_command")
json_select "result"
json_add_string "set_imei" "$res"
json_close_object
@ -35,19 +53,19 @@ function set_imei(){
function get_mode(){
local mode_num
local mode
cfg=$(at $at_port "AT^PCIEMODE?")
cfg=$(at $at_port $at_pre"PCIEMODE?")
config_type=`echo -e "$cfg" | grep -o '[0-9]'`
if [ "$config_type" = "1" ]; then
mode_num="0"
json_add_int disable_mode_btn 1
json_add_int disable_mode_btn 1
else
ucfg=$(at $at_port "AT+USBSWITCH?")
config_type=$(echo "$ucfg" | grep USBSWITCH: |cut -d':' -f2|xargs)
if [ "$config_type" = "9025" ]; then
mode_num="1"
elif [ "$config_type" = "90D5" ]; then
mode_num="0"
ucfg=$(at $at_port $at_pre"USBSWITCH?")
config_type=$(echo "$ucfg" | grep USBSWITCH: |cut -d':' -f2|xargs)
if [ "$config_type" = "9025" ]; then
mode_num="1"
elif [ "$config_type" = "90D5" ]; then
mode_num="0"
fi
fi
case "$platform" in
@ -90,7 +108,7 @@ set_mode(){
;;
esac
#设置模组
at_command="AT+USBSWITCH=${mode_num}"
at_command=$at_pre"USBSWITCH=${mode_num}"
res=$(at "${at_port}" "${at_command}")
json_select "result"
json_add_string "set_mode" "$res"
@ -98,7 +116,7 @@ set_mode(){
}
function get_network_prefer(){
res=$(at $at_port "AT^SLMODE?"| grep -o '[0-9]\+' | tr -d '\n' | tr -d ' ')
res=$(at $at_port $at_pre"SLMODE?"| grep -o '[0-9]\+' | tr -d '\n' | tr -d ' ')
# (RAT index):
# 0 Automatically
# 1 WCDMA Only
@ -187,7 +205,7 @@ function set_network_prefer(){
code="10"
;;
esac
res=$(at $at_port "AT^SLMODE=$(echo "$code" | awk '{print substr($0,1,1) "," substr($0,2,1)}')")
res=$(at $at_port $at_pre"SLMODE=$(echo "$code" | awk '{print substr($0,1,1) "," substr($0,2,1)}')")
json_add_string "code" "$code"
json_add_string "result" "$res"
}
@ -211,12 +229,12 @@ function sim_info()
#IMEI国际移动设备识别码
imei=$(at $at_port "ATI" | awk -F': ' '/^IMEI:/ {print $2}' | xargs)
at_command="at^switch_slot?"
at_command=$at_pre"switch_slot?"
sim_slot=$(at $at_port $at_command | grep ENABLE|grep -o 'SIM[0-9]*')
#SIM StatusSIM状态
at_command="AT+CPIN?"
sim_status=$(at $at_port $at_command | grep "+CPIN:")
sim_status=$(at $at_port $at_command | grep "+CPIN:")
sim_status=${sim_status:7:-1}
#lowercase
sim_status=$(echo $sim_status | tr A-Z a-z)
@ -238,15 +256,15 @@ function sim_info()
fi
at_command="AT+CNUM"
sim_number=$(at $at_port $at_command | awk -F'"' '{print $2}'|xargs)
sim_number=$(at $at_port $at_command | awk -F'"' '{print $2}'|xargs)
#IMSI国际移动用户识别码
at_command="AT+CIMI"
imsi=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
imsi=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#ICCID集成电路卡识别码
at_command="AT+ICCID"
iccid=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g'|sed 's/[^0-9]*//g')
iccid=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g'|sed 's/[^0-9]*//g')
case "$sim_status" in
"ready")
add_plain_info_entry "SIM Status" "$sim_status" "SIM Status"
@ -299,114 +317,121 @@ function network_info() {
local rat_num=$(at ${at_port} ${at_command} | grep "+COPS:" | awk -F',' '{print $4}' | sed 's/\r//g')
network_type=$(get_rat ${rat_num})
}
#at_command='AT^debug?'
#at_command='AT+debug?'
#response=$(at $at_port $at_command)
#lte_sinr=$(echo "$response"|awk -F'lte_snr:' '{print $2}'|awk '{print $1}|xargs)
add_plain_info_entry "Network Type" "$network_type" "Network Type"
}
function vendor_get_disabled_features(){
json_add_string "" "IMEI"
json_add_string "" "NeighborCell"
}
get_lockband_nr()
{
#local at_port="$1"
m_debug "Quectel sdx55 get lockband info"
wcdma_avalible_band="1,2,3,4,5,6,7,8,9,19"
lte_avalible_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,66,71"
sa_nr_avalible_band="1,2,3,5,7,8,12,20,25,28,38,40,41,48,66,71,77,78,79"
bands_command="AT^BAND_PREF?"
bands_command=$at_pre"BAND_PREF?"
get_lockbans=$(at $at_port $bands_command)
gw_band=$(echo "$get_lockbans" | grep "WCDMA,Enable Bands" | cut -d':' -f2 | tr -d ' '|tr ',' ' '|xargs)
lte_band=$(echo "$get_lockbans" | grep "LTE,Enable Bands" | cut -d':' -f2 | tr -d ' '|tr ',' ' ')
sa_nr_band=$(echo "$get_lockbans" | grep "NR5G,Enable Bands" | cut -d':' -f2 | tr -d ' '|tr ',' ' ')
# WCDMA
wcdma_enable=$(echo "$get_lockbans" | grep "WCDMA,Enable Bands" | cut -d':' -f2 | tr -d ' ' | tr ',' ' ')
wcdma_disable=$(echo "$get_lockbans" | grep "WCDMA,Disable Bands" | cut -d':' -f2 | tr -d ' ' | tr ',' ' ')
wcdma_enable=$(echo "$wcdma_enable" | tr ' ' '\n' | grep -v '^$')
wcdma_disable=$(echo "$wcdma_disable" | tr ' ' '\n' | grep -v '^$')
wcdma_all=$(echo "$wcdma_enable $wcdma_disable" | tr ' ' '\n' | grep -v '^$' | sort -n | uniq)
# LTE
lte_enable=$(echo "$get_lockbans" | grep "LTE,Enable Bands" | cut -d':' -f2 | tr -d ' ' | tr ',' ' ')
lte_disable=$(echo "$get_lockbans" | grep "LTE,Disable Bands" | cut -d':' -f2 | tr -d ' ' | tr ',' ' ')
lte_enable=$(echo "$lte_enable" | tr ' ' '\n' | grep -v '^$')
lte_disable=$(echo "$lte_disable" | tr ' ' '\n' | grep -v '^$')
lte_all=$(echo "$lte_enable $lte_disable" | tr ' ' '\n' | grep -v '^$' | sort -n | uniq)
# NR5G_NSA
nr_nsa_enable=$(echo "$get_lockbans" | grep "NR5G_NSA,Enable Bands" | cut -d':' -f2 | tr -d ' ' | tr ',' ' ')
nr_nsa_disable=$(echo "$get_lockbans" | grep "NR5G_NSA,Disable Bands" | cut -d':' -f2 | tr -d ' ' | tr ',' ' ')
nr_nsa_enable=$(echo "$nr_nsa_enable" | tr ' ' '\n' | grep -v '^$')
nr_nsa_disable=$(echo "$nr_nsa_disable" | tr ' ' '\n' | grep -v '^$')
nr_nsa_all=$(echo "$nr_nsa_enable $nr_nsa_disable" | tr ' ' '\n' | grep -v '^$' | sort -n | uniq)
# NR5G_SA
nr_sa_enable=$(echo "$get_lockbans" | grep "NR5G_SA,Enable Bands" | cut -d':' -f2 | tr -d ' ' | tr ',' ' ')
nr_sa_disable=$(echo "$get_lockbans" | grep "NR5G_SA,Disable Bands" | cut -d':' -f2 | tr -d ' ' | tr ',' ' ')
nr_sa_enable=$(echo "$nr_sa_enable" | tr ' ' '\n' | grep -v '^$')
nr_sa_disable=$(echo "$nr_sa_disable" | tr ' ' '\n' | grep -v '^$')
nr_sa_all=$(echo "$nr_sa_enable $nr_sa_disable" | tr ' ' '\n' | grep -v '^$' | sort -n | uniq)
# UMTS
json_add_object "UMTS"
json_add_array "available_band"
for i in $wcdma_all; do
echo "$i" | grep -Eq '^[0-9]+$' && add_avalible_band_entry "$i" "UMTS_$i"
done
json_close_array
json_add_array "lock_band"
json_close_object
json_close_object
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"
json_add_array "available_band"
json_close_array
json_add_array "lock_band"
for i in $wcdma_enable; do
echo "$i" | grep -Eq '^[0-9]+$' && json_add_string "" "$i"
done
json_close_array
json_close_object
for i in $(echo "$wcdma_avalible_band" | awk -F"," '{for(j=1; j<=NF; j++) print $j}'); do
json_select "UMTS"
json_select "available_band"
add_avalible_band_entry "$i" "UMTS_$i"
json_select ..
json_select ..
done
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" "LTE_B$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" "NR_N$i"
json_select ..
json_select ..
done
#+QNWPREFCFG: "nr5g_band",1:3:7:20:28:40:41:71:77:78:79
for i in $(echo "$gw_band"); do
if [ -n "$i" ]; then
json_select "UMTS"
json_select "lock_band"
json_add_string "" "$i"
json_select ..
json_select ..
fi
done
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 "$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
# LTE
json_add_object "LTE"
json_add_array "available_band"
for i in $lte_all; do
echo "$i" | grep -Eq '^[0-9]+$' && add_avalible_band_entry "$i" "LTE_B$i"
done
json_close_array
json_add_array "lock_band"
for i in $lte_enable; do
echo "$i" | grep -Eq '^[0-9]+$' && json_add_string "" "$i"
done
json_close_array
json_close_object
# NR_NSA
json_add_object "NR_NSA"
json_add_array "available_band"
for i in $nr_nsa_all; do
echo "$i" | grep -Eq '^[0-9]+$' && add_avalible_band_entry "$i" "NR_NSA_N$i"
done
json_close_array
json_add_array "lock_band"
for i in $nr_nsa_enable; do
echo "$i" | grep -Eq '^[0-9]+$' && json_add_string "" "$i"
done
json_close_array
json_close_object
# NR_SA
json_add_object "NR_SA"
json_add_array "available_band"
for i in $nr_sa_all; do
echo "$i" | grep -Eq '^[0-9]+$' && add_avalible_band_entry "$i" "NR_SA_N$i"
done
json_close_array
json_add_array "lock_band"
for i in $nr_sa_enable; do
echo "$i" | grep -Eq '^[0-9]+$' && json_add_string "" "$i"
done
json_close_array
json_close_object
}
set_lockband_nr(){
#lock_band=$(echo $lock_band | tr ',' ':')
case "$band_class" in
"UMTS")
lock_band=$(echo $lock_band)
at_command="AT^BAND_PREF=WCDMA,2,$lock_band"
lock_band=$(echo $lock_band)
at_command=$at_pre"BAND_PREF=WCDMA,2,$lock_band"
res=$(at $at_port $at_command)
;;
"LTE")
at_command="AT^BAND_PREF=LTE,2,$lock_band"
at_command=$at_pre"BAND_PREF=LTE,2,$lock_band"
res=$(at $at_port $at_command)
;;
"NR")
at_command="AT^BAND_PREF=NR5G,2,$lock_band"
at_command=$at_pre"BAND_PREF=NR5G,2,$lock_band"
res=$(at $at_port $at_command)
;;
esac
@ -440,7 +465,7 @@ function _get_voltage(){
}
function _get_temperature(){
temperature=$(at $at_port "at^temp?" | sed -n 's/.*TSENS: \([0-9]*\)C.*/\1/p' )
temperature=$(at $at_port $at_pre"temp?" | sed -n 's/.*TSENS: \([0-9]*\)C.*/\1/p' )
[ -n "$temperature" ] && {
add_plain_info_entry "temperature" "$temperature C" "Temperature"
}
@ -504,29 +529,48 @@ 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^debug?'
at_command=$at_pre"debug?"
response=$(at $at_port $at_command)
network_mode=$(echo "$response"|awk -F'RAT:' '{print $2}'|xargs)
#add_plain_info_entry "network_mode" "$network_mode" "Network Mode"
case $network_mode in
"LTE")
lte_mcc=$(echo "$response"|awk -F'mcc:' '{print $2}'|awk -F',' '{print $1}'|xargs)
lte_mnc=$(echo "$response"|awk -F'mnc:' '{print $2}'|xargs)
lte_earfcn=$(echo "$response"|awk -F'channel:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
lte_physical_cell_id=$(echo "$response"|awk -F'pci:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
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_tac=$(echo "$response"|awk -F'lte_tac:' '{print $2}'|xargs)
lte_tx_power=$(echo "$response"|awk -F'lte_tx_pwr:' '{print $2}'|xargs)
lte_mcc=$(echo "$response"|awk -F'mcc:' '{print $2}'|awk -F',' '{print $1}'|xargs)
lte_mnc=$(echo "$response"|awk -F'mnc:' '{print $2}'|xargs)
lte_earfcn=$(echo "$response"|awk -F'channel:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
lte_physical_cell_id=$(echo "$response"|awk -F'pci:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
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}'|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)
add_plain_info_entry "MCC" "$lte_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$lte_mnc" "Mobile Network Code"
@ -539,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"
@ -549,21 +593,41 @@ cell_info(){
#add_plain_info_entry "Srxlev" "$lte_srxlev" "Serving Cell Receive Level"
;;
"NR5G_SA")
has_ca=$(echo "$response" | grep -c "nr_scc1:")
nr_display_mode="$network_mode"
nr_mcc=$(echo "$response"|awk -F'mcc:' '{print $2}'|awk -F',' '{print $1}'|xargs)
nr_mnc=$(echo "$response"|awk -F'mnc:' '{print $2}'|xargs)
nr_earfcn=$(echo "$response"|awk -F'channel:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
nr_physical_cell_id=$(echo "$response"|awk -F'pci:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
nr_cell_id=$(echo "$response"|awk -F'nr_cell_id:' '{print $2}'|xargs)
nr_band=$(echo "$response"|awk -F'nr_band:' '{print $2}'|awk -F' ' '{print $1}'|xargs)
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_rsrp=$(echo "$response"|awk -F'rsrp:' '{print $2}'|awk '{print $1}'|xargs)
lte_rssi=$(echo "$response"|awk -F'nr_rssi:' '{print $2}'|awk -F',' '{print $1}'|xargs)
#lte_rssnr=$(echo "$response"|
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'lte_tx_pwr:' '{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"
scc1_band=$(echo "$response" | awk -F'nr_scc1:' '{print $2}' | awk -F'nr_band:' '{print $2}' | awk -F' ' '{print $1}' | xargs)
scc1_band_width=$(echo "$response" | awk -F'nr_scc1:' '{print $2}' | awk -F'nr_band_width:' '{print $2}' | awk -F' ' '{print $1}' | xargs)
nr_band="$nr_band $scc1_band"
nr_band_width="$nr_band_width $scc1_band_width"
fi
add_plain_info_entry "Network Mode" "$nr_display_mode" "Network Mode"
add_plain_info_entry "Band" "$nr_band" "Band"
add_plain_info_entry "DL Bandwidth" "$nr_band_width" "DL Bandwidth"
add_plain_info_entry "MCC" "$nr_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$nr_mnc" "Mobile Network Code"
#add_plain_info_entry "Duplex Mode" "$lte_duplex_mode" "Duplex Mode"
@ -571,22 +635,11 @@ cell_info(){
add_plain_info_entry "Physical Cell ID" "$nr_physical_cell_id" "Physical Cell ID"
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 "Band" "$nr_band" "Band"
#add_plain_info_entry "UL Bandwidth" "$nr_ul_bandwidth" "UL Bandwidth"
#add_plain_info_entry "DL Bandwidth" "$nr_dl_bandwidth" "DL Bandwidth"
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" -20 40 dBm
add_bar_info_entry "RSRP" "$nr_rsrp" "Reference Signal Received Power" -187 -29 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_plain_info_entry "RxLev" "$nr_rxlev" "Received Signal Level"
add_plain_info_entry "RSSNR" "$nr_rssnr" "Radio Signal Strength Noise Ratio"
#add_plain_info_entry "CQI" "$nr_cql" "Channel Quality Indicator"
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"
#add_plain_info_entry "Srxlev" "$nr_srxlev" "Serving Cell Receive Level"
;;
esac
}

View File

@ -0,0 +1,648 @@
#!/bin/sh
# Copyright (C) 2025 coolsnowwolf <coolsnowwolf@gmail.com>
_Vendor="huawei"
_Author="Lean"
_Maintainer="Lean <coolsnowwolf@gmail.com>"
source /usr/share/qmodem/generic.sh
debug_subject="quectel_ctrl"
vendor_get_disabled_features(){
json_add_string "" "LockBand"
}
function get_imei(){
imei=$(at $at_port "AT+CGSN" | grep -o '[0-9]\{15\}')
json_add_string imei $imei
}
function set_imei(){
imei=$1
at $at_port "at^phynum=IMEI,$imei"
}
function get_mode(){
cfg=$(at $at_port "AT^SETMODE?")
local mode_num=`echo -e "$cfg" | sed -n '2p' | sed 's/\r//g'`
case "$mode_num" in
"0"|"2") mode="ecm" ;;
"1"|"3"|"4"|"5") mode="ncm" ;;
"6") mode="rndis" ;;
"7") mode="mbim" ;;
"8") mode="ppp" ;;
*) mode="rndis" ;;
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
}
function set_mode(){
local mode=$1
local mode_num
case $mode in
"ecm")
mode_num="0"
;;
"ncm")
mode_num="4"
;;
*)
mode_num="0"
;;
esac
at $at_port "AT^SETMODE=${mode_num}"
}
function get_scs()
{
local scs
case $1 in
"0") scs="15" ;;
"1") scs="30" ;;
"2") scs="60" ;;
"3") scs="120" ;;
"4") scs="240" ;;
*) scs=$(awk "BEGIN{ print 2^$1 * 15 }") ;;
esac
echo "$scs"
}
function get_network_prefer(){
res=$(at $at_port "AT^SYSCFGEX?"| grep "\^SYSCFGEX:" | sed 's/\^SYSCFGEX://g')
# (RAT index):
# • 00 Automatic
# • 01 UMTS 3G only
# • 04 LTE only
# • 05 5G only
# • 0E UMTS and LTE only
# • 0F LTE and NR5G only
# • 10 WCDMA and NR5G only
local network_type_num=$(echo "$res" | awk -F'"' '{print $2}')
#获取网络类型
local network_prefer_3g="0"
local network_prefer_4g="0"
local network_prefer_5g="0"
#匹配不同的网络类型
local auto=$(echo "${network_type_num}" | grep "00")
if [ -n "$auto" ]; then
network_prefer_2g="1"
network_prefer_3g="1"
network_prefer_4g="1"
network_prefer_5g="1"
else
local wcdma=$(echo "${network_type_num}" | grep "02")
local lte=$(echo "${network_type_num}" | grep "03")
local nr=$(echo "${network_type_num}" | grep "08")
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_array
}
function set_network_prefer(){
local network_prefer_3g=$(echo $1 |jq -r 'contains(["3G"])')
local network_prefer_4g=$(echo $1 |jq -r 'contains(["4G"])')
local network_prefer_5g=$(echo $1 |jq -r 'contains(["5G"])')
count=$(echo $1 | jq -r 'length')
case "$count" in
"1")
if [ "$network_prefer_3g" = "true" ]; then
code="02"
elif [ "$network_prefer_4g" = "true" ]; then
code="03"
elif [ "$network_prefer_5g" = "true" ]; then
code="08"
fi
;;
"2")
if [ "$network_prefer_3g" = "true" ] && [ "$network_prefer_4g" = "true" ]; then
code="02"
elif [ "$network_prefer_4g" = "true" ] && [ "$network_prefer_5g" = "true" ]; then
code="03"
elif [ "$network_prefer_3g" = "true" ] && [ "$network_prefer_5g" = "true" ]; then
code="08"
fi
;;
"3")
code="080302"
;;
*)
code="00"
;;
esac
at_command='AT^SYSCFGEX="'${code}'",40000000,1,2,40000000,,'
res=$(at $at_port "${at_command}")
json_add_string "code" "$code"
json_add_string "result" "$res"
}
function get_lockband(){
json_add_object "lockband"
case $platform in
*)
_get_lockband_nr
;;
esac
json_close_object
}
function set_lockband(){
config=$1
band_class=$(echo $config | jq -r '.band_class')
lock_band=$(echo $config | jq -r '.lock_band')
case $platform in
*)
_set_lockband_nr
;;
esac
}
function sim_info()
{
class="SIM Information"
sim_slot="1"
#SIM StatusSIM状态
at_command="AT+CPIN?"
sim_status=$(at $at_port $at_command | grep "+CPIN:")
sim_status=${sim_status:7:-1}
#lowercase
sim_status=$(echo $sim_status | tr A-Z a-z)
#SIM NumberSIM卡号码手机号
at_command="AT+CNUM"
sim_number=$(at $at_port $at_command | grep "+CNUM: " | awk -F'"' '{print $2}')
[ -z "$sim_number" ] && {
sim_number=$(at $at_port $at_command | grep "+CNUM: " | awk -F'"' '{print $4}')
}
#IMSI国际移动用户识别码
at_command="AT+CIMI"
imsi=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#IMEI国际移动设备识别码
at_command="AT+CGSN"
imei=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
add_plain_info_entry "SIM Status" "$sim_status" "SIM Status"
add_plain_info_entry "SIM Slot" "$sim_slot" "SIM Slot"
add_plain_info_entry "SIM Number" "$sim_number" "SIM Number"
add_plain_info_entry "IMEI" "$imei" "International Mobile Equipment Identity"
add_plain_info_entry "IMSI" "$imsi" "International Mobile Subscriber Identity"
}
function base_info(){
#Name名称
at_command="AT+CGMM"
name=$(at $at_port $at_command | grep -v "OK" | sed -n '2p' | sed 's/\r//g')
#Manufacturer制造商
at_command="AT+CGMI"
manufacturer=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#Revision固件版本
at_command="ATI"
revision=$(at $at_port $at_command | grep "Revision:" | sed 's/Revision: //g' | sed 's/\r//g')
# at_command="AT+CGMR"
# revision=$(at $at_port $at_command | sed -n '2p' | 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_connect_status
_get_temperature
}
cell_info()
{
at_command="AT^MONSC"
response=$(at $at_port $at_command | grep "\^MONSC:" | sed 's/\^MONSC: //')
local rat=$(echo "$response" | awk -F',' '{print $1}')
case $rat in
"NR"|"NR-5GC")
network_mode="NR5G-SA Mode"
nr_mcc=$(echo "$response" | awk -F',' '{print $2}')
nr_mnc=$(echo "$response" | awk -F',' '{print $3}')
nr_arfcn=$(echo "$response" | awk -F',' '{print $4}')
nr_scs_num=$(echo "$response" | awk -F',' '{print $5}')
nr_scs=$(get_scs ${nr_scs_num})
nr_cell_id_hex=$(echo "$response" | awk -F',' '{print $6}')
nr_cell_id=$(echo "ibase=16; $nr_cell_id_hex" | bc)
nr_physical_cell_id_hex=$(echo "$response" | awk -F',' '{print $7}')
nr_physical_cell_id=$(echo "ibase=16; $nr_physical_cell_id_hex" | bc)
nr_tac=$(echo "$response" | awk -F',' '{print $8}')
nr_rsrp=$(echo "$response" | awk -F',' '{print $9}')
nr_rsrq=$(echo "$response" | awk -F',' '{print $10}')
nr_sinr=$(echo "$response" | awk -F',' '{print $11}' | sed 's/\r//g')
;;
"LTE-NR")
network_mode="EN-DC Mode"
#LTE
endc_lte_mcc=$(echo "$response" | awk -F',' '{print $2}')
endc_lte_mnc=$(echo "$response" | awk -F',' '{print $3}')
endc_lte_earfcn=$(echo "$response" | awk -F',' '{print $4}')
endc_lte_cell_id_hex=$(echo "$response" | awk -F',' '{print $5}')
endc_lte_cell_id=$(echo "ibase=16; $endc_lte_cell_id_hex" | bc)
endc_lte_physical_cell_id_hex=$(echo "$response" | awk -F',' '{print $6}')
endc_lte_physical_cell_id=$(echo "ibase=16; $endc_lte_physical_cell_id_hex" | bc)
endc_lte_tac=$(echo "$response" | awk -F',' '{print $7}')
endc_lte_rsrp=$(echo "$response" | awk -F',' '{print $8}')
endc_lte_rsrq=$(echo "$response" | awk -F',' '{print $9}')
endc_lte_rxlev=$(echo "$response" | awk -F',' '{print $10}' | sed 's/\r//g')
#NR5G-NSA
endc_nr_mcc=$(echo "$response" | awk -F',' '{print $2}')
endc_nr_mnc=$(echo "$response" | awk -F',' '{print $3}')
endc_nr_arfcn=$(echo "$response" | awk -F',' '{print $4}')
endc_nr_scs_num=$(echo "$response" | awk -F',' '{print $5}')
nr_scs=$(get_scs ${nr_scs_num})
endc_nr_cell_id_hex=$(echo "$response" | awk -F',' '{print $6}')
endc_nr_cell_id=$(echo "ibase=16; $endc_nr_cell_id_hex" | bc)
endc_nr_physical_cell_id_hex=$(echo "$response" | awk -F',' '{print $7}')
endc_nr_physical_cell_id=$(echo "ibase=16; $endc_nr_physical_cell_id_hex" | bc)
endc_nr_tac=$(echo "$response" | awk -F',' '{print $8}')
endc_nr_rsrp=$(echo "$response" | awk -F',' '{print $9}')
endc_nr_rsrq=$(echo "$response" | awk -F',' '{print $10}')
endc_nr_sinr=$(echo "$response" | awk -F',' '{print $11}' | sed 's/\r//g')
;;
"LTE"|"eMTC"|"NB-IoT")
network_mode="LTE Mode"
lte_mcc=$(echo "$response" | awk -F',' '{print $2}')
lte_mnc=$(echo "$response" | awk -F',' '{print $3}')
lte_earfcn=$(echo "$response" | awk -F',' '{print $4}')
lte_cell_id_hex=$(echo "$response" | awk -F',' '{print $5}')
lte_cell_id=$(echo "ibase=16; $lte_cell_id_hex" | bc)
lte_physical_cell_id_hex=$(echo "$response" | awk -F',' '{print $6}')
lte_physical_cell_id=$(echo "ibase=16; $lte_physical_cell_id_hex" | bc)
lte_tac=$(echo "$response" | awk -F',' '{print $7}')
lte_rsrp=$(echo "$response" | awk -F',' '{print $8}')
lte_rsrq=$(echo "$response" | awk -F',' '{print $9}')
lte_rxlev=$(echo "$response" | awk -F',' '{print $10}' | sed 's/\r//g')
;;
"WCDMA"|"TD-SCDMA"|"UMTS")
network_mode="WCDMA Mode"
wcdma_mcc=$(echo "$response" | awk -F',' '{print $2}')
wcdma_mnc=$(echo "$response" | awk -F',' '{print $3}')
wcdma_arfcn=$(echo "$response" | awk -F',' '{print $4}')
wcdma_psc=$(echo "$response" | awk -F',' '{print $5}')
wcdma_cell_id_hex=$(echo "$response" | awk -F',' '{print $6}')
wcdma_cell_id=$(echo "ibase=16; $wcdma_cell_id_hex" | bc)
wcdma_lac=$(echo "$response" | awk -F',' '{print $7}')
wcdma_rscp=$(echo "$response" | awk -F',' '{print $8}')
wcdma_rxlev=$(echo "$response" | awk -F',' '{print $9}')
wcdma_ecn0=$(echo "$response" | awk -F',' '{print $10}')
wcdma_drx=$(echo "$response" | awk -F',' '{print $11}')
wcdma_ura=$(echo "$response" | awk -F',' '{print $12}' | sed 's/\r//g')
;;
"GSM")
network_mode="GSM Mode"
gsm_mcc=$(echo "$response" | awk -F',' '{print $2}')
gsm_mnc=$(echo "$response" | awk -F',' '{print $3}')
gsm_band_num=$(echo "$response" | awk -F',' '{print $4}')
gsm_band=$(tdtech_get_band "GSM" ${gsm_band_num})
gsm_arfcn=$(echo "$response" | awk -F',' '{print $5}')
gsm_bsic=$(echo "$response" | awk -F',' '{print $6}')
gsm_cell_id_hex=$(echo "$response" | awk -F',' '{print $7}')
gsm_cell_id=$(echo "ibase=16; $gsm_cell_id_hex" | bc)
gsm_lac=$(echo "$response" | awk -F',' '{print $8}')
gsm_rxlev=$(echo "$response" | awk -F',' '{print $9}')
gsm_rx_quality=$(echo "$response" | awk -F',' '{print $10}')
gsm_ta=$(echo "$response" | awk -F',' '{print $11}' | sed 's/\r//g')
;;
esac
class="Cell Information"
add_plain_info_entry "network_mode" "$network_mode" "Network Mode"
case $network_mode in
"NR5G-SA Mode")
add_plain_info_entry "MMC" "$nr_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$nr_mnc" "Mobile Network Code"
add_plain_info_entry "Duplex Mode" "$nr_duplex_mode" "Duplex Mode"
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 "TAC" "$nr_tac" "Tracking area code of cell served by neighbor Enb"
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_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"
;;
"EN-DC Mode")
add_plain_info_entry "LTE" "LTE" ""
add_plain_info_entry "MCC" "$endc_lte_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$endc_lte_mnc" "Mobile Network Code"
add_plain_info_entry "Duplex Mode" "$endc_lte_duplex_mode" "Duplex Mode"
add_plain_info_entry "Cell ID" "$endc_lte_cell_id" "Cell ID"
add_plain_info_entry "Physical Cell ID" "$endc_lte_physical_cell_id" "Physical Cell ID"
add_plain_info_entry "EARFCN" "$endc_lte_earfcn" "E-UTRA Absolute Radio Frequency Channel Number"
add_plain_info_entry "Freq band indicator" "$endc_lte_freq_band_ind" "Freq band indicator"
add_plain_info_entry "Band" "$endc_lte_band" "Band"
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_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_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"
add_plain_info_entry "TX Power" "$endc_lte_tx_power" "TX Power"
add_plain_info_entry "Srxlev" "$endc_lte_srxlev" "Serving Cell Receive Level"
add_plain_info_entry NR5G-NSA "NR5G-NSA" ""
add_plain_info_entry "MCC" "$endc_nr_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$endc_nr_mnc" "Mobile Network Code"
add_plain_info_entry "Physical Cell ID" "$endc_nr_physical_cell_id" "Physical Cell ID"
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_plain_info_entry "SCS" "$endc_nr_scs" "SCS"
;;
"LTE Mode")
add_plain_info_entry "MCC" "$lte_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$lte_mnc" "Mobile Network Code"
add_plain_info_entry "Duplex Mode" "$lte_duplex_mode" "Duplex Mode"
add_plain_info_entry "Cell ID" "$lte_cell_id" "Cell ID"
add_plain_info_entry "Physical Cell ID" "$lte_physical_cell_id" "Physical Cell ID"
add_plain_info_entry "EARFCN" "$lte_earfcn" "E-UTRA Absolute Radio Frequency Channel Number"
add_plain_info_entry "Freq band indicator" "$lte_freq_band_ind" "Freq band indicator"
add_plain_info_entry "Band" "$lte_band" "Band"
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_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"
add_plain_info_entry "TX Power" "$lte_tx_power" "TX Power"
add_plain_info_entry "Srxlev" "$lte_srxlev" "Serving Cell Receive Level"
;;
"WCDMA Mode")
add_plain_info_entry "MCC" "$wcdma_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$wcdma_mnc" "Mobile Network Code"
add_plain_info_entry "LAC" "$wcdma_lac" "Location Area Code"
add_plain_info_entry "Cell ID" "$wcdma_cell_id" "Cell ID"
add_plain_info_entry "UARFCN" "$wcdma_uarfcn" "UTRA Absolute Radio Frequency Channel Number"
add_plain_info_entry "PSC" "$wcdma_psc" "Primary Scrambling Code"
add_plain_info_entry "RAC" "$wcdma_rac" "Routing Area Code"
add_plain_info_entry "Band" "$wcdma_band" "Band"
add_bar_info_entry "RSCP" "$wcdma_rscp" "Received Signal Code Power" -120 -25 dBm
add_plain_info_entry "Ec/Io" "$wcdma_ecio" "Ec/Io"
add_plain_info_entry "Ec/No" "$wcdma_ecno" "Ec/No"
add_plain_info_entry "Physical Channel" "$wcdma_phych" "Physical Channel"
add_plain_info_entry "Spreading Factor" "$wcdma_sf" "Spreading Factor"
add_plain_info_entry "Slot" "$wcdma_slot" "Slot"
add_plain_info_entry "Speech Code" "$wcdma_speech_code" "Speech Code"
add_plain_info_entry "Compression Mode" "$wcdma_com_mod" "Compression Mode"
add_plain_info_entry "RxLev" "$wcdma_rxlev" "RxLev"
;;
esac
}
function network_info() {
class="Network Information"
at_command="AT^SYSINFOEX"
res=$(at $at_port $at_command | grep "\^SYSINFOEX:" | awk -F'"' '{print $4}')
_parse_gstatus "$res"
}
function _get_lockband_nr(){
local bandcfg=$(at $at_port "AT!BAND?")
local bandtemplate=$(at $at_port "AT!BAND=?")
local start_flag=0
IFS=$'\n'
for line in $bandtemplate; do
if [ "$start_flag" = 0 ];then
if [ "${line:0:10}" == "Available:" ];then
start_flag=1
fi
continue
else
if [ "${line:0:2}" == "OK" ];then
break
fi
fi
type_line=$(echo $line | grep '[0-9]* - .*:')
if [ -n "$type_line" ]; then
type=$(echo $line | grep -o '[0-9]* - .*:')
type=${type:4:-1}
json_add_object $type
json_add_array "available_band"
json_close_array
json_add_array "lock_band"
json_close_array
json_close_object
elif [ -n "$line" ]; then
band_name=${line##*-}
band_name=$(echo $band_name | xargs)
[ -z "$band_name" ] && continue
case $type in
"GW")
band_hex=${line%%-*}
band_bin=$(echo "obase=2; ibase=16; $band_hex" | bc)
band_id=$(echo $band_bin | wc -c)
band_id=$(($band_id - 1))
;;
*)
band_id=$(echo $band_name |grep -o '^[BbNn][0-9]*' | grep -o '[0-9]*')
;;
esac
json_select $type
json_select "available_band"
add_avalible_band_entry $band_id ${type}_${band_name}
json_close_array
json_close_object
fi
done
for line in $bandcfg; do
cfg_line=$(echo $line | grep '[0-9]* - ')
if [ -n "$cfg_line" ]; then
type=$(echo $cfg_line | cut -d' ' -f3)
type=${type:0:-1}
low_band=${cfg_line:11:16}
high_band=${cfg_line:28:16}
json_select $type
json_select "lock_band"
_mask_to_band _add_lock_band $low_band $high_band
json_select ".."
json_select ".."
fi
done
unset IFS
}
function _set_lockband_nr(){
case $band_class in
"GW")
band_class=0
;;
"LTE")
band_class=1
;;
"NRNSA")
band_class=3
;;
"NRSA")
band_class=4
;;
esac
bandlist=$(_band_list_to_mask $lock_band)
[ "$band_class" -eq 0 ] && bandlist=${bandlist:0:16}
cmd="AT!BAND=0F,1,\"Custom\",$band_class,${bandlist}"
res=$(at $at_port "$cmd" | xargs)
if [ "$res" == "OK" ]; then
set_lockband="AT!BAND=0F"
else
set_lockband="AT!BAND=00"
fi
r=$(at $at_port "$set_lockband")
json_add_string "result" "$res"
json_add_string "cmd" "$cmd"
}
function _get_temperature(){
response=$(at $at_port "AT^CHIPTEMP?" | grep "\^CHIPTEMP" | awk -F',' '{print $6}' | sed 's/\r//g' )
local temperature
[ -n "$response" ] && {
response=$(awk "BEGIN{ printf \"%.2f\", $response / 10 }" | sed 's/\.*0*$//')
add_plain_info_entry "temperature" "$response $(printf "\xc2\xb0")C" "Temperature"
}
}
function _add_avalible_band(){
add_avalible_band_entry $1 $1
}
function _add_lock_band(){
json_add_string "" $1
}
function _mask_to_band()
{
func=$1
low_band=$2
high_band=$3
low_band=$(echo "obase=2; ibase=16; $low_band" | bc)
low_band=$(printf "%064s" $low_band)
for i in $(seq 1 64); do
if [ "${low_band: -$i:1}" = "1" ]; then
band=$i
$func $band
fi
done
[ -z "$high_band" ] && return
high_band=$(echo "obase=2; ibase=16; $high_band" | bc)
high_band=$(printf "%064s" $high_band)
for i in $(seq 1 64); do
if [ "${high_band: -$i:1}" = "1" ]; then
band=$((64+i))
$func $band
fi
done
}
function _band_list_to_mask()
{
local band_list=$1
local low=0
local high=0
#以逗号分隔
IFS=","
for band in $band_list;do
if [ "$band" -le 64 ]; then
#使用bc计算2的band次方
res=$(echo "2^($band-1)" | bc)
low=$(echo "$low+$res" | bc)
else
tmp_band=$((band-64))
res=$(echo "2^($tmp_band-1)" | bc)
high=$(echo "$high+$res" | bc)
fi
done
#十六进制输出padding到16位
low=$(printf "%016x" $low)
high=$(printf "%016x" $high)
echo "$low,$high"
}
function _parse_gstatus(){
data=$1
IFS=$'\t\r\n'
for line in $data;do
line=${line//[$'\t\r\n']}
key=${line%%:*}
value=${line##*:}
key=${key}
#trim space at value
value=$(echo $value | xargs)
if [ -z "$value" ] || [ "$value" = "---" ]; then
continue
fi
case $key in
OK)
continue
;;
*SINR*)
add_bar_info_entry "SINR" "$value" "$key" 0 30 dB
;;
*RSRP*)
add_bar_info_entry "RSRP" "$value" "$key" -140 -44 dBm
;;
*RSRQ*)
add_bar_info_entry "RSRQ" "$value" "$key" -19.5 -3 dB
;;
*RSSI*)
add_bar_info_entry "RSSI" "$value" "$key" -120 -20 dBm
;;
*)
add_plain_info_entry $key $value $key
;;
esac
done
unset IFS
}

View File

@ -44,7 +44,7 @@ get_mode()
*) mode="${mode_num}" ;;
esac
;;
"unisoc"|"lte12"|"lte")
"lte12"|"lte")
case "$mode_num" in
"2") mode="ecm" ;;
"3") mode="rndis" ;;
@ -52,6 +52,14 @@ get_mode()
*) mode="${mode_num}" ;;
esac
;;
"unisoc")
case "$mode_num" in
"2") mode="ecm" ;;
"3") mode="rndis" ;;
"1") mode="ncm" ;;
*) mode="${mode_num}" ;;
esac
;;
*)
mode="${mode_num}"
;;
@ -73,7 +81,7 @@ set_mode()
{
local mode=$1
case "$platform" in
"qualcomm"|"unisoc"|"lte12"|"lte")
"qualcomm"|"lte12"|"lte")
case "$mode" in
"ecm") mode_num="2" ;;
"rndis") mode_num="3" ;;
@ -81,6 +89,14 @@ set_mode()
*) mode_num="1" ;;
esac
;;
"unisoc")
case "$mode" in
"ecm") mode_num="2" ;;
"rndis") mode_num="3" ;;
"ncm") mode_num="1" ;;
*) mode_num="1" ;;
esac
;;
*)
mode_num="1"
;;
@ -176,12 +192,30 @@ get_voltage()
get_temperature()
{
at_command="AT+TEMP"
local response=$(at ${at_port} ${at_command} | grep 'TEMP: "cpu0-0-usr"' | awk -F'"' '{print $4}')
local response
local temp
if [ -n "$response" ]; then
temp="${response}$(printf "\xc2\xb0")C"
local degree_symbol=$(printf "\xc2\xb0")C
# 根据平台选择不同的AT命令并提取温度值
if [ "$platform" = "unisoc" ]; then
response=$(at ${at_port} ${at_command} | grep 'TEMP: "soc-thmzone"' | awk -F'"' '{print $4}')
else
response=$(at ${at_port} ${at_command} | grep 'TEMP: "cpu0-0-usr"' | awk -F'"' '{print $4}')
fi
# 处理响应值
if [ -n "$response" ]; then
if [ "$platform" = "unisoc" ]; then
# Unisoc平台需要将原始值除以1000并保留两位小数
temp_value=$(echo "scale=2; $response / 1000" | bc)
temp="${temp_value}${degree_symbol}"
else
temp="NaN $(printf "\xc2\xb0")C"
# 其他平台直接使用原始值
temp="${response}${degree_symbol}"
fi
else
# 无响应时显示NaN
temp="NaN ${degree_symbol}"
fi
add_plain_info_entry "temperature" "$temp" "Temperature"
}
@ -346,10 +380,8 @@ network_info()
add_plain_info_entry "Network Type" "$network_type" "Network Type"
add_plain_info_entry "AMBR UL" "$ambr_ul" "Access Maximum Bit Rate for Uplink"
add_plain_info_entry "AMBR DL" "$ambr_dl" "Access Maximum Bit Rate for Downlink"
rx_rate=$(rate_convert $rx_rate)
tx_rate=$(rate_convert $tx_rate)
add_plain_info_entry "Tx Rate" "$tx_rate" "Transmit Rate"
add_plain_info_entry "Rx Rate" "$rx_rate" "Receive Rate"
add_speed_entry rx $rx_rate
add_speed_entry tx $tx_rate
}
# Cell information
@ -535,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")
@ -552,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" ""
@ -562,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
;;
@ -579,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")
@ -635,4 +667,4 @@ get_bandwidth()
fi
echo "$bandwidth"
}
}

View File

@ -0,0 +1,791 @@
#!/bin/sh
# Copyright (C) 2025 sfwtw
_Vendor="neoway"
_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 "" "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()
{
at_command='AT$MYSYSINFO'
local response=$(at ${at_port} ${at_command} | grep '$MYSYSINFO:' | awk -F',' '{print $1}' | awk '{print $2}' | sed 's/\r//g')
network_prefer_3g="0";
network_prefer_4g="0";
network_prefer_5g="0";
case "$response" in
"3")
# 3G
network_prefer_3g="1"
;;
"4")
# 4G
network_prefer_4g="1"
;;
"5")
# 5G
network_prefer_5g="1"
;;
"7")
# 3G + 4G
network_prefer_3g="1"
network_prefer_4g="1"
;;
"9")
# 5G
network_prefer_5g="1"
;;
"11")
# 3G + 5G
network_prefer_3g="1"
network_prefer_5g="1"
;;
"12")
# 4G + 5G
network_prefer_4g="1"
network_prefer_5g="1"
;;
"14")
# 3G + 4G + 5G
network_prefer_3g="1"
network_prefer_4g="1"
network_prefer_5g="1"
;;
"*")
# AUTO
network_prefer_3g="1"
network_prefer_4g="1"
network_prefer_5g="1"
;;
esac
json_add_object network_prefer
json_add_string 2G "$network_prefer_2g"
json_add_string 3G "$network_prefer_3g"
json_add_string 4G "$network_prefer_4g"
json_add_string 5G "$network_prefer_5g"
json_close_object
}
#设置网络偏好
# $1:AT串口
# $2:网络偏好配置
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')
local config_mode="1"
case "$length" in
"1")
if [ "$network_prefer_3g" = "true" ]; then
config_mode="3" # 仅3G
elif [ "$network_prefer_4g" = "true" ]; then
config_mode="4" # 仅4G
elif [ "$network_prefer_5g" = "true" ]; then
config_mode="9" # 仅5G
fi
;;
"2")
if [ "$network_prefer_3g" = "true" ] && [ "$network_prefer_4g" = "true" ]; then
config_mode="7" # 3G + 4G
elif [ "$network_prefer_3g" = "true" ] && [ "$network_prefer_5g" = "true" ]; then
config_mode="11" # 3G + 5G
elif [ "$network_prefer_4g" = "true" ] && [ "$network_prefer_5g" = "true" ]; then
config_mode="12" # 4G + 5G
fi
;;
"3")
config_mode="14" # 3G + 4G + 5G
;;
*)
config_mode="1" # AUTO
;;
esac
at_command='AT$MYSYSINFO='${config_mode}
res=$(at "${at_port}" "${at_command}")
json_select "result"
json_add_string "set_network_prefer" "$res"
json_close_object
}
#基本信息
base_info()
{
m_debug "Neoway base info"
#Name名称
at_command="AT+CGMM"
name=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#Manufacturer制造商
at_command="AT+CGMI"
manufacturer=$(at $at_port $at_command | grep "+CGMI:" | sed 's/+CGMI: //g' | sed 's/\r//g')
#Revision固件版本
at_command="ATI"
revision=$(at $at_port $at_command | sed -n '5p' | sed 's/\r//g')
# at_command="AT+CGMR"
# revision=$(at $at_port $at_command | sed -n '2p' | 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_connect_status
}
#SIM卡信息
sim_info()
{
m_debug "Neoway sim info"
#SIM SlotSIM卡卡槽
at_command="AT+SIMCROSS?"
sim_slot=$(at $at_port $at_command | grep "+SIMCROSS:" | awk -F'[ ,]' '{print $2}' | sed 's/\r//g')
# m_debug "SIM Slot: $sim_slot"
#IMEI国际移动设备识别码
at_command="AT+CGSN"
imei=$(at $at_port $at_command | sed -n '3p' | awk -F'"' '{print $2}')
#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")
[ "$sim_status" != "ready" ] && return
#ISP互联网服务提供商
at_command="AT+COPS?"
isp=$(at $at_port $at_command | sed -n '2p' | 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
#SIM NumberSIM卡号码手机号
at_command="AT+CNUM"
sim_number=$(at $at_port $at_command | sed -n '3p' | awk -F'"' '{print $4}')
#IMSI国际移动用户识别码
at_command="AT+CIMI"
imsi=$(at $at_port $at_command | sed -n '3p' | sed 's/\r//g')
#ICCID集成电路卡识别码
iccid=$(at $at_port 'AT$MYCCID' | grep '$MYCCID:' | awk -F' "' '{print $2}' | sed 's/"//g')
[ -n "$iccid" ] || return
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 "SIM Number" "$sim_number" "SIM Number"
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
}
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()
{
m_debug "Neoway network info"
#CSQ信号强度
at_command="AT+CSQ"
response=$(at ${at_port} ${at_command} | grep "+CSQ:" | sed 's/+CSQ: //g' | sed 's/\r//g')
#最大比特率,信道质量指示
at_command='AT+C5GQOSRDP'
response=$(at $at_port $at_command | grep "+C5GQOSRDP:")
if [ -n "$response" ]; then
# Parse 5G QoS parameters
# Format: +C5GQOSRDP: <cid>,<5QI>[,<DL_GFBR>,<UL_GFBR>[,<DL_MFBR>,<UL_MFBR>[,<DL_SAMBR>,<UL_SAMBR>[,<Averaging_window>]]]]]
# Extract DL_SAMBR (downlink session AMBR) and UL_SAMBR (uplink session AMBR) in kbit/s
ambr_dl=$(echo "$response" | awk -F',' '{print $7}' | 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
[ -n "$ambr_dl" ] && ambr_dl=$(rate_convert $ambr_dl)
[ -n "$ambr_ul" ] && ambr_ul=$(rate_convert $ambr_ul)
fi
class="Network Information"
add_plain_info_entry "AMBR UL" "$ambr_ul" "Access Maximum Bit Rate for Uplink"
add_plain_info_entry "AMBR DL" "$ambr_dl" "Access Maximum Bit Rate for Downlink"
}
convert_neoway_band_to_readable() {
local act=$1
local band_value=$2
case "$act" in
"2") echo "WB$band_value" ;; # UTRAN
"3") echo "B$band_value" ;; # E-UTRAN
"6") echo "N$band_value" ;; # NR
*) echo "$band_value" ;;
esac
}
convert_readable_band_to_neoway() {
local band=$1
local prefix=${band:0:1}
local band_value
case "$prefix" in
"W")
band_value=${band:2}
echo "2 $band_value"
;;
"B")
band_value=${band:1}
echo "3 $band_value"
;;
"N")
band_value=${band:1}
echo "6 $band_value"
;;
*)
echo "3 $band"
;;
esac
}
get_lockband() {
json_add_object "lockband"
at_command="AT+NWSETBAND?"
response=$(at $at_port $at_command)
local band_num=$(echo "$response" | grep "+NWSETBAND:" | awk '{print $2}' | sed 's/\r//g')
m_debug "Band number: $band_num"
json_add_object "UMTS"
json_add_array "available_band"
json_close_array
json_add_array "lock_band"
json_close_array
json_close_object
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"
json_add_array "available_band"
json_close_array
json_add_array "lock_band"
json_close_array
json_close_object
at_command="AT+NWSETBAND=?"
available_bands=$(at $at_port $at_command | grep "+" | awk -F',' '{for(i=2;i<=NF;i++) print $i}' | sed 's/\r//g')
m_debug "Available bands: $available_bands"
for band in $available_bands; do
if [[ "$band" == WB* ]]; then
band_value=${band:2}
json_select "UMTS"
json_select "available_band"
add_avalible_band_entry "$band_value" "$band"
json_select ..
json_select ..
elif [[ "$band" == B* ]]; then
band_value=${band:1}
json_select "LTE"
json_select "available_band"
add_avalible_band_entry "$band_value" "$band"
json_select ..
json_select ..
elif [[ "$band" == N* ]]; then
band_value=${band:1}
json_select "NR"
json_select "available_band"
add_avalible_band_entry "$band_value" "$band"
json_select ..
json_select ..
fi
done
if [ "$band_num" != "0" ]; then
IFS=$'\n'
for line in $(echo "$response" | grep -v "+NWSETBAND:" | grep -v "OK"); do
set -- $(echo $line | tr ',' ' ')
act=$1
num=$2
shift 2
for band_value in "$@"; do
if [[ "$band" == WB* ]]; then
act="2"
elif [[ "$band" == B* ]]; then
act="3"
elif [[ "$band" == N* ]]; then
act="6"
fi
band_value=$(echo "$band_value" | awk -F' ' '{print $3}' | sed 's/\r//g')
m_debug "Processing band: $band_value for act: $act"
if [ -n "$band_value" ]; then
case "$act" in
"2")
json_select "UMTS"
json_select "lock_band"
band_value=${band_value:2}
json_add_string "" "$band_value"
json_select ..
json_select ..
;;
"3")
json_select "LTE"
json_select "lock_band"
band_value=${band_value:1}
json_add_string "" "$band_value"
json_select ..
json_select ..
;;
"6")
json_select "NR"
json_select "lock_band"
band_value=${band_value:1}
json_add_string "" "$band_value"
json_select ..
json_select ..
;;
esac
fi
done
done
unset IFS
fi
json_close_object
}
set_lockband() {
m_debug "neoway set lockband info"
config=$1
band_class=$(echo $config | jq -r '.band_class')
lock_band=$(echo $config | jq -r '.lock_band')
if [ -z "$lock_band" ] || [ "$lock_band" = "null" ]; then
at_command="AT+NWSETBAND=0"
res=$(at $at_port $at_command)
json_select "result"
json_add_string "set_lockband" "$res"
json_close_object
return
fi
local act
case "$band_class" in
"UMTS") act=2 ;;
"LTE") act=3 ;;
"NR") act=6 ;;
*) act=3 ;; # 默认LTE
esac
IFS=','; set -- $lock_band
band_num=$#
at_command="AT+NWSETBAND=$act,$band_num"
for band in "$@"; do
at_command="$at_command,$band"
done
unset IFS
res=$(at $at_port $at_command)
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
}
#UL_bandwidth
# $1:上行带宽数字
get_bandwidth()
{
local network_type="$1"
local bandwidth_num="$2"
local bandwidth
case $network_type in
"LTE")
case $bandwidth_num in
"0") bandwidth="1.4" ;;
"1") bandwidth="3" ;;
"2"|"3"|"4"|"5") bandwidth=$((($bandwidth_num - 1) * 5)) ;;
esac
;;
"NR")
case $bandwidth_num in
"0"|"1"|"2"|"3"|"4"|"5") bandwidth=$((($bandwidth_num + 1) * 5)) ;;
"6"|"7"|"8"|"9"|"10"|"11"|"12") bandwidth=$((($bandwidth_num - 2) * 10)) ;;
"13") bandwidth="200" ;;
"14") bandwidth="400" ;;
esac
;;
esac
echo "$bandwidth"
}
#获取NR子载波间隔
# $1:NR子载波间隔数字
get_scs()
{
local scs
case $1 in
"0") scs="15" ;;
"1") scs="30" ;;
"2") scs="60" ;;
"3") scs="120" ;;
"4") scs="240" ;;
*) scs=$(awk "BEGIN{ print 2^$1 * 15 }") ;;
esac
echo "$scs"
}
#获取物理信道
# $1:物理信道数字
get_phych()
{
local phych
case $1 in
"0") phych="DPCH" ;;
"1") phych="FDPCH" ;;
esac
echo "$phych"
}
#获取扩频因子
# $1:扩频因子数字
get_sf()
{
local sf
case $1 in
"0"|"1"|"2"|"3"|"4"|"5"|"6"|"7") sf=$(awk "BEGIN{ print 2^$(($1+2)) }") ;;
"8") sf="UNKNOWN" ;;
esac
echo "$sf"
}
#获取插槽格式
# $1:插槽格式数字
get_slot()
{
local slot=$1
# case $1 in
# "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"10"|"11"|"12"|"13"|"14"|"15"|"16") slot=$1 ;;
# "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9") slot=$1 ;;
# esac
echo "$slot"
}
#小区信息
cell_info()
{
m_debug "Neoway cell info"
at_command='AT+NETDMSGEX'
response=$(at $at_port $at_command)
if [ -n "$(echo "$response" | grep "+NETDMSGEX:")" ]; then
net_mode=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $1}' | sed 's/+NETDMSGEX: "//g' | sed 's/"//g')
network_mode=$(get_network_mode "$net_mode")
mcc_mnc=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $2}' | sed 's/"//g')
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/"//g')
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}' | 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')
[ -n "$ss_rsrp" ] && ss_rsrp_actual=$(printf "%.1f" $(echo "$ss_rsrp / 10" | bc -l 2>/dev/null))
[ -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"
nr_mnc="$mnc"
nr_cell_id="$gnbid"
nr_physical_cell_id="$pci"
nr_arfcn="$arfcn"
nr_band="$band"
nr_rsrp="$ss_rsrp_actual"
nr_rsrq="$ss_rsrq_actual"
nr_sinr="$ss_sinr_actual"
;;
"TDD LTE"|"FDD LTE")
tac=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $5}')
cell_id=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $6}')
pci=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $7}')
rx_dbm=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $8}')
tx_dbm=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $9}')
rsrp=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $10}')
rsrq=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $11}')
sinr=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $12}')
rssi=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $13}')
if [ "$(echo "$response" | grep -o ',' | wc -l)" -ge 17 ]; then
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')
dl_bandwidth=$(get_bandwidth "LTE" "$dl_bw_num")
ul_bandwidth=$(get_bandwidth "LTE" "$ul_bw_num")
fi
[ -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"
lte_mnc="$mnc"
lte_cell_id="$cell_id"
lte_physical_cell_id="$pci"
lte_earfcn="$arfcn"
lte_freq_band_ind="$band"
lte_tac="$tac"
lte_rsrp="$rsrp_actual"
lte_rsrq="$rsrq_actual"
lte_sinr="$sinr_actual"
lte_rssi="$rssi_actual"
lte_cql="$cqi"
lte_srxlev="$srxlev"
lte_dl_bandwidth="$dl_bandwidth"
lte_ul_bandwidth="$ul_bandwidth"
lte_tx_power="$tx_dbm"
lte_rx_power="$rx_dbm"
;;
"WCDMA"|"HSDPA"|"HSUPA"|"HSDPA and HSUPA"|"HSDPA+"|"HSDPA+ and HSUPA")
lac=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $5}')
cell_id=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $6}')
psc=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $7}')
rac=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $8}')
rx_dbm=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $9}')
tx_dbm=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $10}')
rscp=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $11}')
ecio=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $12}')
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}')
phych_num=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $16}')
sf_num=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $17}')
slot_num=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $18}')
is_commod=$(echo "$response" | grep "+NETDMSGEX:" | awk -F',' '{print $19}' | sed 's/\r//g')
phych=$(get_phych "$phych_num")
sf=$(get_sf "$sf_num")
slot=$(get_slot "$slot_num")
fi
[ -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"
wcdma_mnc="$mnc"
wcdma_lac="$lac"
wcdma_cell_id="$cell_id"
wcdma_uarfcn="$arfcn"
wcdma_psc="$psc"
wcdma_rac="$rac"
wcdma_band="$band"
wcdma_rscp="$rscp_actual"
wcdma_ecio="$ecio_actual"
wcdma_phych="$phych"
wcdma_sf="$sf"
wcdma_slot="$slot"
wcdma_com_mod="$is_commod"
wcdma_rx_dbm="$rx_dbm"
wcdma_tx_dbm="$tx_dbm"
;;
*)
network_mode="Unknown Mode"
;;
esac
class="Cell Information"
add_plain_info_entry "network_mode" "$network_mode" "Network Mode"
case $network_mode in
"NR5G-SA Mode")
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 "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"
add_plain_info_entry "Cell ID" "$lte_cell_id" "Cell ID"
add_plain_info_entry "Physical Cell ID" "$lte_physical_cell_id" "Physical Cell ID"
add_plain_info_entry "EARFCN" "$lte_earfcn" "E-UTRA Absolute Radio Frequency Channel Number"
add_plain_info_entry "Band" "$lte_freq_band_ind" "Band"
add_plain_info_entry "TAC" "$lte_tac" "Tracking Area Code"
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" -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"
add_plain_info_entry "DL Bandwidth" "$lte_dl_bandwidth" "DL Bandwidth"
add_plain_info_entry "UL Bandwidth" "$lte_ul_bandwidth" "UL Bandwidth"
add_plain_info_entry "Srxlev" "$lte_srxlev" "Serving Cell Receive Level"
fi
;;
"WCDMA Mode")
add_plain_info_entry "MCC" "$wcdma_mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$wcdma_mnc" "Mobile Network Code"
add_plain_info_entry "LAC" "$wcdma_lac" "Location Area Code"
add_plain_info_entry "Cell ID" "$wcdma_cell_id" "Cell ID"
add_plain_info_entry "UARFCN" "$wcdma_uarfcn" "UTRA Absolute Radio Frequency Channel Number"
add_plain_info_entry "PSC" "$wcdma_psc" "Primary Scrambling Code"
add_plain_info_entry "RAC" "$wcdma_rac" "Routing Area Code"
add_plain_info_entry "Band" "$wcdma_band" "Band"
add_plain_info_entry "RX Power" "$wcdma_rx_dbm" "RX Power (dBm)"
add_plain_info_entry "TX Power" "$wcdma_tx_dbm" "TX Power (dBm)"
add_bar_info_entry "RSCP" "$wcdma_rscp" "Received Signal Code Power" -120 -25 dBm
add_plain_info_entry "Ec/Io" "$wcdma_ecio" "Ec/Io"
if [ -n "$wcdma_phych" ]; then
add_plain_info_entry "Physical Channel" "$wcdma_phych" "Physical Channel"
add_plain_info_entry "Spreading Factor" "$wcdma_sf" "Spreading Factor"
add_plain_info_entry "Slot" "$wcdma_slot" "Slot"
add_plain_info_entry "Compression Mode" "$wcdma_com_mod" "Compression Mode"
fi
;;
*)
add_plain_info_entry "Network Type" "$net_mode" "Network Type"
add_plain_info_entry "MCC" "$mcc" "Mobile Country Code"
add_plain_info_entry "MNC" "$mnc" "Mobile Network Code"
add_plain_info_entry "ARFCN" "$arfcn" "Absolute Radio-Frequency Channel Number"
add_plain_info_entry "Band" "$band" "Band"
;;
esac
fi
}
get_network_mode()
{
local mode="$1"
case "$mode" in
"NR to 5GCN"|"NR-LTE ENDC"|"NR-LTE NEDC") echo "NR5G-SA Mode" ;;
"NR to EPS") echo "NR5G-SA Mode" ;;
"TDD LTE"|"FDD LTE") echo "LTE Mode" ;;
"WCDMA"|"HSDPA"|"HSUPA"|"HSDPA and HSUPA"|"HSDPA+"|"HSDPA+ and HSUPA") echo "WCDMA Mode" ;;
"GSM"|"GPRS"|"EDGE") echo "GSM Mode" ;;
*) echo "$mode Mode" ;;
esac
}

View File

@ -53,6 +53,15 @@ get_mode()
*) mode="${mode_num}" ;;
esac
;;
"hisilicon")
case "$mode_num" in
"1") mode="ecm" ;;
"3") mode="rndis" ;;
"4") mode="ncm" ;;
"5") mode="ncm" ;;
*) mode="ncm" ;;
esac
;;
"lte12"|\
"lte")
case "$mode_num" in
@ -145,6 +154,9 @@ get_network_prefer()
"unisoc")
get_network_prefer_nr
;;
"hisilicon")
get_network_prefer_nr
;;
"lte")
get_network_prefer_lte
;;
@ -162,6 +174,9 @@ get_network_prefer()
"unisoc")
json_add_string 5G $network_prefer_5g
;;
"hisilicon")
json_add_string 5G $network_prefer_5g
;;
esac
json_close_array
@ -490,10 +505,8 @@ network_info()
add_plain_info_entry "CQI DL" "$cqi_dl" "Channel Quality Indicator for Downlink"
add_plain_info_entry "AMBR UL" "$ambr_ul" "Access Maximum Bit Rate for Uplink"
add_plain_info_entry "AMBR DL" "$ambr_dl" "Access Maximum Bit Rate for Downlink"
rx_rate=$(rate_convert $rx_rate)
tx_rate=$(rate_convert $tx_rate)
add_plain_info_entry "Tx Rate" "$tx_rate" "Transmit Rate"
add_plain_info_entry "Rx Rate" "$rx_rate" "Receive Rate"
add_speed_entry rx $rx_rate
add_speed_entry tx $tx_rate
}
#获取频段
@ -1607,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"
@ -1629,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"
@ -1644,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")
@ -1661,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"
@ -1693,4 +1706,3 @@ cell_info()
;;
esac
}

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
add_bar_info_entry "RSRP" "$value" "$key" -140 -44 dBm
;;
*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
@ -31,6 +31,12 @@ get_mode()
at_command='AT+CUSBCFG?'
local mode_num=$(at ${at_port} ${at_command} | grep "USBID: " | sed 's/USBID: 0X1E0E,0X//g' | sed 's/\r//g')
local mode
pcie_cfg=$(at ${at_port} "AT+CPCIEMODE?")
pcie_mode=$(echo "$pcie_cfg"|grep +CPCIEMODE: |cut -d':' -f2|xargs)
if [ "$pcie_mode" = "EP" ] && [ "$mode_num" = "902B" ]; then
mode_num="9001"
json_add_int disable_mode_btn 1
fi
case "$platform" in
"qualcomm")
case "$mode_num" in
@ -192,7 +198,7 @@ set_network_prefer_nr()
get_voltage()
{
at_command="AT+CBC"
local voltage=$(at ${at_port} ${at_command} | grep "+CBC:" | sed 's/+CBC: //g' | sed 's/V//g' | sed 's/\r//g')
local voltage=$(at ${at_port} ${at_command} | grep "+CBC:" | sed 's/+CBC: //g' | sed 's/V//g' | sed 's/\r//g')
[ -n "$voltage" ] && {
add_plain_info_entry "voltage" "$voltage V" "Voltage"
}
@ -208,9 +214,9 @@ get_temperature()
local line=1
QTEMP=$(at ${at_port} ${at_command} | grep "+CPMUTEMP:")
temp=$(echo $QTEMP | awk -F': ' '{print $2}' | sed 's/\r//g')
if [ -n "$temp" ]; then
temp="${temp}$(printf "\xc2\xb0")C"
fi
if [ -n "$temp" ]; then
temp="${temp}$(printf "\xc2\xb0")C"
fi
add_plain_info_entry "temperature" "$temp" "Temperature"
}
@ -249,15 +255,15 @@ sim_info()
#SIM SlotSIM卡卡槽
at_command="AT+SMSIMCFG?"
sim_slot=$(at $at_port $at_command | grep "+SMSIMCFG:" | awk -F',' '{print $2}' | sed 's/\r//g')
sim_slot=$(at $at_port $at_command | grep "+SMSIMCFG:" | awk -F',' '{print $2}' | sed 's/\r//g')
#IMEI国际移动设备识别码
at_command="AT+CGSN"
imei=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
imei=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#SIM StatusSIM状态
at_command="AT+CPIN?"
sim_status_flag=$(at $at_port $at_command | sed -n '2p')
sim_status_flag=$(at $at_port $at_command | sed -n '2p')
sim_status=$(get_sim_status "$sim_status_flag")
if [ "$sim_status" != "ready" ]; then
@ -279,15 +285,15 @@ sim_info()
#SIM NumberSIM卡号码手机号
at_command="AT+CNUM"
sim_number=$(at $at_port $at_command | sed -n '2p' | awk -F'"' '{print $4}')
sim_number=$(at $at_port $at_command | sed -n '2p' | awk -F'"' '{print $4}')
#IMSI国际移动用户识别码
at_command="AT+CIMI"
imsi=$(at $at_port $at_command | sed -n '2p' | sed 's/\r//g')
imsi=$(at $at_port $at_command | sed -n '2p' | 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\}")
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")
@ -319,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')
@ -333,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"
}
#获取频段
@ -542,8 +524,8 @@ get_neighborcell_qualcomm(){
local at_command='AT+CPSI?'
nr_lock_check="AT+C5GCELLCFG?"
lte_lock_check="AT+CCELLCFG?"
lte_status=$(at $at_port $lte_lock_check | grep "+CCELLCFG:")
if [ "$lte_status" != "+CCELLCFG: 0,0" ]; then
lte_status=$(at $at_port $lte_lock_check | grep "+CCELLCFG:")
if [ ! -z "$lte_status" ]; then
lte_lock_status="locked"
else
lte_lock_status=""
@ -551,19 +533,28 @@ get_neighborcell_qualcomm(){
lte_lock_freq=$(echo $lte_status | awk -F',' '{print $2}' | sed 's/\r//g')
lte_lock_pci=$(echo $lte_status | awk -F',' '{print $1}' | sed 's/+CCELLCFG: //g' | sed 's/\r//g')
nr_status=$(at $at_port $nr_lock_check | grep "+C5GCELLCFG:")
nr_lock_status=$(echo $nr_status | awk -F': ' '{print $2}' | sed 's/\r//g')
nr_lock_pci=$(echo $nr_status | awk -F',' '{print $2}' | sed 's/\r//g')
nr_lock_freq=$(echo $nr_status | awk -F',' '{print $3}' | sed 's/\r//g')
nr_lock_scs=$(echo $nr_status | awk -F',' '{print $4}' | sed 's/\r//g')
nr_lock_band=$(echo $nr_status | awk -F',' '{print $5}' | sed 's/\r//g')
nr_lock_status=$(echo "$nr_status" | awk -F': ' '{print $2}' | xargs)
nr_lock_pci=$(echo "$nr_status" | awk -F',' '{print $2}' | xargs)
nr_lock_freq=$(echo "$nr_status" | awk -F',' '{print $3}' | xargs)
nr_lock_scs=$(echo "$nr_status" | awk -F',' '{print $4}' | xargs)
nr_lock_band=$(echo "$nr_status" | awk -F',' '{print $5}' | xargs)
if [ "$nr_lock_status" != "0" ]; then
nr_lock_status="locked"
else
nr_lock_status=""
fi
at $at_port $at_command > /tmp/neighborcell
modem_status=$(at $at_port $at_command)
modem_status_net=$(echo "$modem_status"|grep "+CPSI:"|awk -F',' '{print $1}'|awk -F':' '{print $2}'|xargs)
modem_status_band=$(echo "$modem_status"|grep "+CPSI:"|awk -F',' '{print $7}'|awk -F'_' '{print $2}'|sed 's/BAND//g'|xargs)
if [ $modem_status_net == "NR5G_SA" ];then
scans=$(at $at_port "AT+CNWSEARCH=\"nr5g\"")
sleep 10
at $at_port "AT+CNWSEARCH=\"nr5g\",3" > /tmp/neighborcell
elif [ $modem_status_net == "LTE" ];then
at $at_port "AT+CNWSEARCH=\"lte\",1" > /tmp/neighborcell
sleep 5
fi
json_add_object "Feature"
json_add_string "Unlock" "2"
json_add_string "Lock PCI" "1"
@ -593,9 +584,9 @@ get_neighborcell_qualcomm(){
fi
json_close_object
while read line; do
if [ -n "$(echo $line | grep "+CPSI:")" ]; then
if [ -n "$(echo $line | grep "+NR_NGH_CELL:")" ] || [ -n "$(echo $line | grep "+LTE_CELL:")" ]; then
# CPSI: NR5G_SA,Online,460-01,0x6F4700,29869309958,95,NR5G_BAND78,627264,-800,-110,14
line=$(echo $line | sed 's/+CPSI: //g')
case $line in
*WCDMA*)
type="WCDMA"
@ -605,37 +596,34 @@ get_neighborcell_qualcomm(){
rscp=$(echo $line | awk -F',' '{print $11}')
ecno=$(echo $line | awk -F',' '{print $10}')
;;
*LTE*)
*LTE_CELL*)
type="LTE"
arfcn=$(echo $line | awk -F',' '{print $8}')
pci=$(echo $line | awk -F',' '{print $6}')
rsrp=$(echo $line | awk -F',' '{print $12}')
rsrq=$(echo $line | awk -F',' '{print $11}')
arfcn=$(echo $line | awk -F',' '{print $6}')
pci=$(echo $line | awk -F',' '{print $7}')
rsrp=$(echo $line | awk -F',' '{print $8}')
rsrq=$(echo $line | awk -F',' '{print $9}')
band=$(echo $line | awk -F',' '{print $5}')
mnc=$(echo $line | awk -F',' '{print $2}')
;;
*NR5G_SA*)
type="NR5G_SA"
arfcn=$(echo $line | awk -F',' '{print $8}')
pci=$(echo $line | awk -F',' '{print $6}')
rsrp=$(echo $line | awk -F',' '{print $9}')
rsrq=$(echo $line | awk -F',' '{print $10}')
;;
*NR5G_NSA*)
type="NR5G_NSA"
arfcn=$(echo $line | awk -F',' '{print $4}')
*NR_NGH_CELL*)
type="NR"
arfcn=$(echo $line | awk -F',' '{print $1}'| awk -F':' '{print $2}'| xargs)
pci=$(echo $line | awk -F',' '{print $2}')
rsrp=$(echo $line | awk -F',' '{print $5}')
rsrq=$(echo $line | awk -F',' '{print $6}')
rsrp=$(echo $line | awk -F',' '{print $3}')
rsrq=$(echo $line | awk -F',' '{print $4}')
band=$modem_status_band
;;
esac
json_select $type
json_add_object ""
json_add_string "neighbourcell" "neighbourcell"
json_add_string "mnc" "$mnc"
json_add_string "arfcn" "$arfcn"
json_add_string "pci" "$pci"
json_add_string "rscp" "$rscp"
json_add_string "ecno" "$ecno"
json_add_string "rsrp" "$rsrp"
json_add_string "rsrq" "$rsrq"
json_add_string "band" "$band"
json_close_object
json_select ".."
fi
@ -689,8 +677,8 @@ lockcell_qualcomm(){
res2=$(at $at_port $unlock4g)
res=$res1,$res2
else
lock4g="AT+CCELLCFG=1,$arfcn,$pci;+CNMP=38"
locknr="AT+C5GCELLCFG="pci",$pci,$arfcn,$(get_scs $scs),$band;+CNMP=71"
lock4g="AT+CCELLCFG=1,$pci,$arfcn;+CNMP=38"
locknr="AT+C5GCELLCFG=\"pci\",$pci,$arfcn,$scs,$band;+CNMP=71"
if [ $rat = "1" ]; then
res=$(at $at_port $locknr)
else
@ -715,7 +703,7 @@ get_bandwidth()
local bandwidth
case $network_type in
"LTE")
"LTE")
case $bandwidth_num in
"0") bandwidth="1.4" ;;
"1") bandwidth="3" ;;
@ -730,7 +718,7 @@ get_bandwidth()
"14") bandwidth="400" ;;
esac
;;
esac
esac
echo "$bandwidth"
}
@ -739,14 +727,14 @@ get_bandwidth()
get_scs()
{
local scs
case $1 in
"0") scs="15" ;;
"1") scs="30" ;;
case $1 in
"0") scs="15" ;;
"1") scs="30" ;;
"2") scs="60" ;;
"3") scs="120" ;;
"4") scs="240" ;;
*) scs=$(awk "BEGIN{ print 2^$1 * 15 }") ;;
esac
esac
echo "$scs"
}
@ -755,10 +743,10 @@ get_scs()
get_phych()
{
local phych
case $1 in
"0") phych="DPCH" ;;
case $1 in
"0") phych="DPCH" ;;
"1") phych="FDPCH" ;;
esac
esac
echo "$phych"
}
@ -767,10 +755,10 @@ get_phych()
get_sf()
{
local sf
case $1 in
"0"|"1"|"2"|"3"|"4"|"5"|"6"|"7") sf=$(awk "BEGIN{ print 2^$(($1+2)) }") ;;
case $1 in
"0"|"1"|"2"|"3"|"4"|"5"|"6"|"7") sf=$(awk "BEGIN{ print 2^$(($1+2)) }") ;;
"8") sf="UNKNOWN" ;;
esac
esac
echo "$sf"
}
@ -779,10 +767,10 @@ get_sf()
get_slot()
{
local slot=$1
# case $1 in
# "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"10"|"11"|"12"|"13"|"14"|"15"|"16") slot=$1 ;;
# case $1 in
# "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"|"10"|"11"|"12"|"13"|"14"|"15"|"16") slot=$1 ;;
# "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9") slot=$1 ;;
# esac
# esac
echo "$slot"
}
@ -944,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"
@ -966,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"
@ -981,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")
@ -998,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
}

View File

@ -9,10 +9,10 @@ def generate_markdown(result):
markdown_output = []
for vendor, models in result.items():
markdown_output.append(f"# {vendor}")
markdown_output.append("型号 | USB 支持 | PCIe 支持")
markdown_output.append("--- | --- | ---")
markdown_output.append("Model | Platform | USB | PCIe ")
markdown_output.append("--- | --- | --- | ---")
for model, support in models.items():
markdown_output.append(f"{model} | {support['usb']} | {support['pcie']}")
markdown_output.append(f"{model} | {support['platform']} |{support['usb']} | {support['pcie']}")
markdown_output.append("") # 空行分隔
return markdown_output
@ -22,7 +22,7 @@ def generate_github_release_notes(result):
for vendor, models in result.items():
release_notes.append(f"## {vendor}")
for model, support in models.items():
release_notes.append(f"- {model}: USB 支持 - {support['usb']}, PCIe 支持 - {support['pcie']}")
release_notes.append(f"- {model}: USB - {support['usb']}, PCIe - {support['pcie']}")
release_notes.append("")
return release_notes
@ -41,6 +41,7 @@ if __name__ == "__main__":
for interface_type in ['usb', 'pcie']:
for model, details in data['modem_support'][interface_type].items():
vendor = details.get('manufacturer', 'unknown').lower()
platform = details.get('platform', 'unknown').lower()
modes = ','.join(details.get('modes', []))
support = f"{interface_type}({modes})"
@ -50,6 +51,7 @@ if __name__ == "__main__":
result[vendor][model] = {'usb': '', 'pcie': ''}
result[vendor][model][interface_type] = support
result[vendor][model]['platform'] = platform
markdown_output = generate_markdown(result)
release_notes = generate_github_release_notes(result)
with open(f"{prefix}.md", 'w') as f: