From b2276f9142b2e5bca353ecab1661c4f149706092 Mon Sep 17 00:00:00 2001
From: ling <1042585959@qq.com>
Date: Wed, 10 Jan 2024 18:43:48 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A8=A1=E5=9D=97=E6=8F=92?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
luci-app-modem/luasrc/controller/modem.lua | 2 -
luci-app-modem/luasrc/view/modem/at.htm | 150 ------------------
.../root/usr/share/modem/fibocom.sh | 6 +-
.../root/usr/share/modem/quectel.sh | 10 +-
4 files changed, 9 insertions(+), 159 deletions(-)
delete mode 100644 luci-app-modem/luasrc/view/modem/at.htm
diff --git a/luci-app-modem/luasrc/controller/modem.lua b/luci-app-modem/luasrc/controller/modem.lua
index 7a5bf85..aa9ef30 100644
--- a/luci-app-modem/luasrc/controller/modem.lua
+++ b/luci-app-modem/luasrc/controller/modem.lua
@@ -29,8 +29,6 @@ function index()
entry({"admin", "network", "modem", "send_at_command"}, call("sendATCommand"), nil).leaf = true
entry({"admin", "network", "modem", "user_at_command"}, call("userATCommand"), nil).leaf = true
entry({"admin", "network", "modem", "get_at_port"}, call("getATPort"), nil).leaf = true
-
- entry({"admin", "network", "modem", "at"},template("modem/at"),translate("AT"),40).leaf = true
end
-- 判断字符串是否含有字母
diff --git a/luci-app-modem/luasrc/view/modem/at.htm b/luci-app-modem/luasrc/view/modem/at.htm
deleted file mode 100644
index 4ca2c2f..0000000
--- a/luci-app-modem/luasrc/view/modem/at.htm
+++ /dev/null
@@ -1,150 +0,0 @@
-<%+header%>
-<%
-local sys = require "luci.sys"
-local utl = require "luci.util"
-local fs = require "nixio.fs"
-local uci = require "luci.model.uci".cursor()
-local s = uci:get("custom", "bandlock", "enabled")
-local a = uci:get("custom", "atcmd", "enabled")
-
-local multilock = uci:get("custom", "multiuser", "multi") or "0"
-local rootlock = uci:get("custom", "multiuser", "root") or "0"
-nomulti=1
-if (multilock == "0") or (multilock == "1" and rootlock == "1") then
- nosms = 1
- if a == "1" then
- nosms = 0
- end
-else
- nosms = 1
- nomulti = 0
-end
-block = 1
-if s == "1" then
- block = 0
-end
-
-function showicon(lck)
-end
-
--%>
-
-
-
-
-
-
<%:AT Commands%>
-
<%:Debugging Your Module with AT Command%>
-
-
-
-
-
-
-
-
-<%+footer%>
diff --git a/luci-app-modem/root/usr/share/modem/fibocom.sh b/luci-app-modem/root/usr/share/modem/fibocom.sh
index 0111089..b51413c 100755
--- a/luci-app-modem/root/usr/share/modem/fibocom.sh
+++ b/luci-app-modem/root/usr/share/modem/fibocom.sh
@@ -7,7 +7,7 @@ get_fibocom_mode()
{
local at_port="$1"
at_command="AT+GTUSBMODE?"
- local mode_num=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/+GTUSBMODE: //g' | sed 's/\r//g')
+ local mode_num=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+GTUSBMODE:" | sed 's/+GTUSBMODE: //g' | sed 's/\r//g')
local mode
case "$mode_num" in
@@ -80,7 +80,7 @@ fibocom_sim_info()
#SIM Slot(SIM卡卡槽)
at_command="AT+GTDUALSIM"
- sim_slot=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $2}' | sed 's/SUB//g')
+ sim_slot=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+GTDUALSIM:" | awk -F'"' '{print $2}' | sed 's/SUB//g')
#IMEI(国际移动设备识别码)
at_command="AT+CGSN"
@@ -138,7 +138,7 @@ fibocom_network_info()
#Network Type(网络类型)
at_command="AT+PSRAT?"
- network_type=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/+PSRAT: //g' | sed 's/\r//g')
+ network_type=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+PSRAT:" | sed 's/+PSRAT: //g' | sed 's/\r//g')
# #CSQ
# local at_command="AT+CSQ"
diff --git a/luci-app-modem/root/usr/share/modem/quectel.sh b/luci-app-modem/root/usr/share/modem/quectel.sh
index 2585535..e9945ac 100755
--- a/luci-app-modem/root/usr/share/modem/quectel.sh
+++ b/luci-app-modem/root/usr/share/modem/quectel.sh
@@ -7,7 +7,7 @@ get_quectel_mode()
{
local at_port="$1"
at_command='AT+QCFG="usbnet"'
- local mode_num=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/+QCFG: "usbnet",//g' | sed 's/\r//g')
+ local mode_num=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+QCFG:" | sed 's/+QCFG: "usbnet",//g' | sed 's/\r//g')
local mode
case "$mode_num" in
@@ -29,11 +29,13 @@ get_connect_status()
local at_port="$1"
at_command="AT+QNWINFO"
- local response=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p')
+ local response=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+QNWINFO:")
local connect_status
if [[ "$response" = *"No Service"* ]]; then
connect_status="disconnect"
+ elif [[ "$response" = *"Unknown Service"* ]]; then
+ connect_status="disconnect"
else
connect_status="connect"
fi
@@ -88,7 +90,7 @@ quectel_sim_info()
#SIM Slot(SIM卡卡槽)
at_command="AT+QUIMSLOT?"
- sim_slot=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F' ' '{print $2}' | sed 's/\r//g')
+ sim_slot=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+QUIMSLOT:" | awk -F' ' '{print $2}' | sed 's/\r//g')
#IMEI(国际移动设备识别码)
at_command="AT+CGSN"
@@ -149,7 +151,7 @@ quectel_network_info()
#Network Type(网络类型)
# at_command="AT+COPS?"
at_command="AT+QNWINFO"
- network_type=$(sh $current_dir/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $2}')
+ network_type=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+QNWINFO:" | awk -F'"' '{print $2}')
#CSQ
at_command="AT+CSQ"