优化界面
This commit is contained in:
parent
3e936889b4
commit
1b597bfd81
@ -34,6 +34,9 @@ function index()
|
|||||||
|
|
||||||
--AT命令旧界面
|
--AT命令旧界面
|
||||||
entry({"admin", "network", "modem", "at_command_old"},template("modem/at_command_old")).leaf = true
|
entry({"admin", "network", "modem", "at_command_old"},template("modem/at_command_old")).leaf = true
|
||||||
|
|
||||||
|
--AT快捷命令配置
|
||||||
|
entry({"admin", "network", "modem", "quick_commands_config"},cbi("modem/quick_commands_config"),translate("自定义快捷命令配置"),40).leaf = true
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
|
@ -0,0 +1,53 @@
|
|||||||
|
-- Copyright 2020-2021 Rafa<66> Wabik (IceG) - From eko.one.pl forum
|
||||||
|
-- Licensed to the GNU General Public License v3.0.
|
||||||
|
|
||||||
|
local dispatcher = require "luci.dispatcher"
|
||||||
|
local fs = require "nixio.fs"
|
||||||
|
local http = require "luci.http"
|
||||||
|
local uci = require "luci.model.uci".cursor()
|
||||||
|
|
||||||
|
local AT_FILE_PATH = "/etc/modem/custom_at_commands.json"
|
||||||
|
|
||||||
|
m = Map("sms_tool")
|
||||||
|
m.title = translate("Configuration sms-tool")
|
||||||
|
m.description = translate("Configuration panel for sms_tool and gui application.")
|
||||||
|
|
||||||
|
-- 自定义命令 --
|
||||||
|
s = m:section(TypedSection, "custom_at_commands", translate("Custom AT Commands"))
|
||||||
|
s.anonymous = true
|
||||||
|
s.addremove = true
|
||||||
|
s.template = "cbi/tblsection"
|
||||||
|
|
||||||
|
description = s:option(Value, "description", translate("Description"))
|
||||||
|
description.placeholder = ""
|
||||||
|
description.rmempty = false
|
||||||
|
description.optional = false
|
||||||
|
|
||||||
|
command = s:option(Value, "command", translate("Command"))
|
||||||
|
-- command.placeholder = ""
|
||||||
|
command.rmempty = false
|
||||||
|
-- command.optional = false
|
||||||
|
|
||||||
|
function command.cfgvalue(self, section)
|
||||||
|
local custom_commands=fs.readfile(AT_FILE_PATH)
|
||||||
|
return "模组信息 > ATI"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- RAW File --
|
||||||
|
s = m:section(NamedSection, 'general' , "sms_tool" , translate(""))
|
||||||
|
s.anonymous = true
|
||||||
|
|
||||||
|
local tat = s:option(TextValue, "user_at", translate("User AT Commands"), translate("Each line must have the following format: 'AT Command name;AT Command'. Save to file '/etc/config/atcmds.user'."))
|
||||||
|
tat.rows = 20
|
||||||
|
tat.rmempty = true
|
||||||
|
|
||||||
|
function tat.cfgvalue(self, section)
|
||||||
|
return fs.readfile(AT_FILE_PATH)
|
||||||
|
end
|
||||||
|
|
||||||
|
function tat.write(self, section, value)
|
||||||
|
value = value:gsub("\r\n", "\n")
|
||||||
|
fs.writefile(AT_FILE_PATH, value)
|
||||||
|
end
|
||||||
|
|
||||||
|
return m
|
@ -526,7 +526,7 @@ end
|
|||||||
</fieldset> -->
|
</fieldset> -->
|
||||||
|
|
||||||
<% if havegps == 1 then %>
|
<% if havegps == 1 then %>
|
||||||
<fieldset class="cbi-section" id="cbi-gpsinfo">
|
<!-- <fieldset class="cbi-section" id="cbi-gpsinfo">
|
||||||
<h3><%:GPS 定位%></h3>
|
<h3><%:GPS 定位%></h3>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@ -540,7 +540,7 @@ end
|
|||||||
<td> </td>
|
<td> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset> -->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,21 +9,54 @@ get_mode()
|
|||||||
at_command="AT+GTUSBMODE?"
|
at_command="AT+GTUSBMODE?"
|
||||||
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_num=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+GTUSBMODE:" | sed 's/+GTUSBMODE: //g' | sed 's/\r//g')
|
||||||
|
|
||||||
|
#获取芯片平台
|
||||||
|
local platform
|
||||||
|
local modem_number=$(uci -q get modem.global.modem_number)
|
||||||
|
for i in $(seq 0 $((modem_number-1))); do
|
||||||
|
local at_port_tmp=$(uci -q get modem.modem$i.at_port)
|
||||||
|
if [ "$at_port" = "$at_port_tmp" ]; then
|
||||||
|
platform=$(uci -q get modem.modem$i.platform)
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
local mode
|
local mode
|
||||||
|
case "$platform" in
|
||||||
|
"qualcomm")
|
||||||
case "$mode_num" in
|
case "$mode_num" in
|
||||||
"17") mode="qmi" ;; #-
|
"17") mode="qmi" ;; #-
|
||||||
"31") mode="qmi" ;; #-
|
"31") mode="qmi" ;; #-
|
||||||
"32") mode="qmi" ;;
|
"32") mode="qmi" ;;
|
||||||
|
"34") mode="qmi" ;;
|
||||||
# "32") mode="gobinet" ;;
|
# "32") mode="gobinet" ;;
|
||||||
"18") mode="ecm" ;;
|
"18") mode="ecm" ;;
|
||||||
"23") mode="ecm" ;; #-
|
"23") mode="ecm" ;; #-
|
||||||
"33") mode="ecm" ;; #-
|
"33") mode="ecm" ;; #-
|
||||||
|
"35") mode="ecm" ;; #-
|
||||||
"29") mode="mbim" ;; #-
|
"29") mode="mbim" ;; #-
|
||||||
"30") mode="mbim" ;;
|
"30") mode="mbim" ;;
|
||||||
"24") mode="rndis" ;;
|
"24") mode="rndis" ;;
|
||||||
"18") mode='ncm' ;;
|
"18") mode='ncm' ;;
|
||||||
*) mode="$mode_num" ;;
|
*) mode="$mode_num" ;;
|
||||||
esac
|
esac
|
||||||
|
;;
|
||||||
|
"unisoc")
|
||||||
|
case "$mode_num" in
|
||||||
|
"34") mode="ecm" ;;
|
||||||
|
"35") mode="ecm" ;; #-
|
||||||
|
"40") mode="mbim" ;;
|
||||||
|
"41") mode="mbim" ;; #-
|
||||||
|
"38") mode="rndis" ;;
|
||||||
|
"39") mode="rndis" ;; #-
|
||||||
|
"36") mode='ncm' ;;
|
||||||
|
"37") mode='ncm' ;; #-
|
||||||
|
*) mode="$mode_num" ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
mode="$mode_num"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
echo "$mode"
|
echo "$mode"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ setPortConfig()
|
|||||||
uci set modem.modem$i.at_port="$2"
|
uci set modem.modem$i.at_port="$2"
|
||||||
setModemInfoConfig $i $2
|
setModemInfoConfig $i $2
|
||||||
fi
|
fi
|
||||||
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -122,7 +123,7 @@ setModemInfoConfig()
|
|||||||
#获取一行的内容
|
#获取一行的内容
|
||||||
local line_context=$(sed -n $i'p' "$modem_support_file")
|
local line_context=$(sed -n $i'p' "$modem_support_file")
|
||||||
#获取数据接口内容
|
#获取数据接口内容
|
||||||
local data_interface_info=$(echo "$line_context" | cut -d ";" -f 3)
|
local data_interface_info=$(echo "$line_context" | cut -d ";" -f 4)
|
||||||
if [ "$data_interface" = "$data_interface_info" ]; then
|
if [ "$data_interface" = "$data_interface_info" ]; then
|
||||||
#获取模块名
|
#获取模块名
|
||||||
local modem_name=$(echo "$line_context" | cut -d ";" -f 2)
|
local modem_name=$(echo "$line_context" | cut -d ";" -f 2)
|
||||||
@ -144,17 +145,21 @@ setModemInfoConfig()
|
|||||||
local manufacturer=$(echo "$line_context" | cut -d ";" -f 1)
|
local manufacturer=$(echo "$line_context" | cut -d ";" -f 1)
|
||||||
uci set modem.modem$1.manufacturer="$manufacturer"
|
uci set modem.modem$1.manufacturer="$manufacturer"
|
||||||
|
|
||||||
|
#设置平台
|
||||||
|
local platform=$(echo "$line_context" | cut -d ";" -f 3)
|
||||||
|
uci set modem.modem$1.platform="$platform"
|
||||||
|
|
||||||
#设置当前的拨号模式
|
#设置当前的拨号模式
|
||||||
local mode
|
local mode
|
||||||
if [ "$manufacturer" = "unknown" ]; then
|
if [ "$manufacturer" = "unknown" ]; then
|
||||||
mode="unknown"
|
mode="unknown"
|
||||||
else
|
else
|
||||||
mode=$(source $current_dir/$manufacturer.sh && get_mode $2)
|
mode=$(source $current_dir/$manufacturer.sh && get_mode $2 $platform)
|
||||||
fi
|
fi
|
||||||
uci set modem.modem$1.mode="$mode"
|
uci set modem.modem$1.mode="$mode"
|
||||||
|
|
||||||
#设置支持的拨号模式
|
#设置支持的拨号模式
|
||||||
local modes=$(echo "$line_context" | cut -d ";" -f 4 | tr ',' ' ')
|
local modes=$(echo "$line_context" | cut -d ";" -f 5 | tr ',' ' ')
|
||||||
|
|
||||||
#删除原来的拨号模式列表
|
#删除原来的拨号模式列表
|
||||||
uci -q del modem.modem$1.modes
|
uci -q del modem.modem$1.modes
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
quectel;rg200u-cn;usb;ecm,mbim,rndis,ncm
|
quectel;rg200u-cn;unisoc;usb;ecm,mbim,rndis,ncm
|
||||||
quectel;rm500u-cn;usb;ecm,mbim,rndis,ncm
|
quectel;rm500u-cn;unisoc;usb;ecm,mbim,rndis,ncm
|
||||||
quectel;rm500q-gl;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
quectel;rm500q-gl;qualcomm;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||||
quectel;rm500q-gl;pcie;qmi,gobinet,mbim
|
quectel;rm500q-gl;qualcomm;pcie;qmi,gobinet,mbim
|
||||||
quectel;rm502q-gl;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
quectel;rm502q-gl;qualcomm;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||||
quectel;rm502q-gl;pcie;qmi,gobinet,mbim
|
quectel;rm502q-gl;qualcomm;pcie;qmi,gobinet,mbim
|
||||||
fibocom;fm650-cn;usb;ecm,mbim,rndis,ncm
|
fibocom;fm650-cn;unisoc;usb;ecm,mbim,rndis,ncm
|
||||||
fibocom;fm150-ae;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
fibocom;fm150-ae;qualcomm;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||||
fibocom;fm150-ae;pcie;qmi
|
fibocom;fm150-ae;qualcomm;pcie;qmi
|
||||||
fibocom;fm160-cn;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
fibocom;fm160-cn;qualcomm;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||||
unknown;unknown;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
unknown;unknown;unknown;usb;qmi,gobinet,ecm,mbim,rndis,ncm
|
||||||
unknown;unknown;pcie;qmi,gobinet,mbim
|
unknown;unknown;unknown;pcie;qmi,gobinet,mbim
|
||||||
|
@ -9,7 +9,20 @@ get_mode()
|
|||||||
at_command='AT+QCFG="usbnet"'
|
at_command='AT+QCFG="usbnet"'
|
||||||
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_num=$(sh $current_dir/modem_at.sh $at_port $at_command | grep "+QCFG:" | sed 's/+QCFG: "usbnet",//g' | sed 's/\r//g')
|
||||||
|
|
||||||
|
#获取芯片平台
|
||||||
|
local platform
|
||||||
|
local modem_number=$(uci -q get modem.global.modem_number)
|
||||||
|
for i in $(seq 0 $((modem_number-1))); do
|
||||||
|
local at_port_tmp=$(uci -q get modem.modem$i.at_port)
|
||||||
|
if [ "$at_port" = "$at_port_tmp" ]; then
|
||||||
|
platform=$(uci -q get modem.modem$i.platform)
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
local mode
|
local mode
|
||||||
|
case "$platform" in
|
||||||
|
"qualcomm")
|
||||||
case "$mode_num" in
|
case "$mode_num" in
|
||||||
"0") mode="qmi" ;;
|
"0") mode="qmi" ;;
|
||||||
# "0") mode="gobinet" ;;
|
# "0") mode="gobinet" ;;
|
||||||
@ -19,6 +32,20 @@ get_mode()
|
|||||||
"5") mode='ncm' ;;
|
"5") mode='ncm' ;;
|
||||||
*) mode="$mode_num" ;;
|
*) mode="$mode_num" ;;
|
||||||
esac
|
esac
|
||||||
|
;;
|
||||||
|
"unisoc")
|
||||||
|
case "$mode_num" in
|
||||||
|
"1") mode="ecm" ;;
|
||||||
|
"2") mode="mbim" ;;
|
||||||
|
"3") mode="rndis" ;;
|
||||||
|
"5") mode='ncm' ;;
|
||||||
|
*) mode="$mode_num" ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
mode="$mode_num"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
echo "$mode"
|
echo "$mode"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user