← 返回
开发者工具 中文

HiLink LTE Modem

Control Huawei HiLink USB LTE modems (E3372, E8372, etc.) via REST API. Send/receive SMS, check signal strength, manage SIM PIN, query prepaid balance, and m...
通过 REST API 控制 Huawei HiLink USB LTE 上网卡(如 E3372、E8372)。支持收发短信、检查信号、管理 SIM 卡 PIN、查询余额等。
and0r-
开发者工具 clawhub v1.0.0 1 版本 99852.1 Key: 无需
★ 0
Stars
📥 675
下载
💾 9
安装
1
版本
#latest

概述

HiLink LTE Modem

Control Huawei HiLink USB LTE modems via their local REST API.

Setup

The modem must be in HiLink mode (not stick/serial mode) and accessible via HTTP.

Config

Set gateway IP in ~/.config/hilink/config:

HILINK_GATEWAY=192.168.200.1

Or pass via environment: export HILINK_GATEWAY=192.168.200.1

Default: 192.168.200.1

Network Requirements

The LTE USB interface needs an IP on the modem's subnet (e.g., 192.168.200.x). Configure as static IP with no gateway and no DNS to avoid routing conflicts:

# /etc/network/interfaces.d/lte
allow-hotplug lte0
iface lte0 inet static
    address 192.168.200.100/24

Critical: Never let the LTE interface set a default route or DNS — it will override your LAN connection. Use nogateway and nohook resolv.conf in dhcpcd, or a static config with no gateway line.

Persistent Interface Name

USB network interfaces get random names on each boot. Create a udev rule for a stable name:

# Find MAC address
cat /sys/class/net/enx*/address

# Create udev rule
echo 'SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="xx:xx:xx:xx:xx:xx", NAME="lte0"' \
  | sudo tee /etc/udev/rules.d/70-lte-modem.rules

CLI Usage

# SMS
scripts/hilink.sh sms send "+41791234567" "Hello!"
scripts/hilink.sh sms list
scripts/hilink.sh sms read 40001
scripts/hilink.sh sms delete 40001

# Status & Signal
scripts/hilink.sh status
scripts/hilink.sh signal

# SIM PIN
scripts/hilink.sh pin enter 1234
scripts/hilink.sh pin disable 1234
scripts/hilink.sh pin status

# Prepaid Balance (USSD)
scripts/hilink.sh balance

# Connection info
scripts/hilink.sh info

API Overview

All HiLink API calls require a session token + CSRF token pair:

# Get tokens
curl -s http://GATEWAY/api/webserver/SesTokInfo
# Returns: <SesInfo>cookie</SesInfo><TokInfo>csrf_token</TokInfo>

# Use in requests
curl -X POST http://GATEWAY/api/endpoint \
  -H "Cookie: <SesInfo value>" \
  -H "__RequestVerificationToken: <TokInfo value>" \
  -H "Content-Type: application/xml" \
  -d '<xml request body>'

For detailed API endpoints, see references/api.md.

Troubleshooting

  • Error 113018 on SMS send: SIM not registered to network. Check PIN status and signal.
  • SimState 260: PIN required. Enter PIN first via scripts/hilink.sh pin enter .
  • SignalStrength 0: No network registration. Wait after PIN entry or check antenna.
  • DNS/routing broken: LTE interface set a default route. Remove it: sudo ip route del default via 192.168.200.1
  • Interface name changed: USB MAC randomized. Create udev rule (see Setup).

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 19:47 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,473
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,926
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,528