This commit is contained in:
ling 2024-05-09 20:57:51 +08:00
parent 6cdec2d910
commit a05c68c8fa
30 changed files with 1756 additions and 586 deletions

View File

@ -6,14 +6,22 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-modem
LUCI_TITLE:=LuCI support for Modem
LUCI_PKGARCH:=all
PKG_VERSION:=1.4.3
PKG_VERSION:=1.4.4
PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE
PKF_MAINTAINER:=Siriling <siriling@qq.com>
LUCI_DEPENDS:=+luci-compat \
LUCI_DEPENDS:=+luci-compat +kmod-usb-net +kmod-usb-net-cdc-ether +kmod-usb-acm \
+kmod-usb-net-qmi-wwan +kmod-usb-net-rndis +kmod-usb-serial-qualcomm \
+kmod-usb-net-sierrawireless +kmod-usb-ohci +kmod-usb-serial \
+kmod-usb-serial-option +kmod-usb-wdm \
+kmod-usb2 +kmod-usb3 \
+kmod-usb-net-cdc-mbim \
+usbutils \
+kmod-pcie_mhi \
+pciutils \
+quectel-CM-5G \
+modemmanager \
+luci-proto-modemmanager \
+sms-tool \
+jq \

View File

@ -33,6 +33,7 @@
| 移远通信 | RM500Q-GL | 高通 | USB | RMNETECMMBIMRNDISNCM |
| 移远通信 | RM502Q-AE | 高通 | USB | RMNETECMMBIMRNDISNCM |
| 移远通信 | RM502Q-GL | 高通 | USB | RMNETECMMBIMRNDISNCM |
| 移远通信 | RM505Q-AE | 高通 | USB | RMNETECMMBIMRNDISNCM |
| 移远通信 | RM520N-CN | 高通 | USB | RMNETECMMBIMRNDISNCM |
| 移远通信 | RM520N-GL | 高通 | USB | RMNETECMMBIMRNDISNCM |
| 移远通信 | RM500Q-GL | 高通 | PCIE | RMNETMBIM |
@ -44,3 +45,6 @@
| 广和通 | FM150-AE-01FM150-AE-11FM150-AE-21FM150-NA-01 | 高通 | USB | RMNETECMMBIMRNDISNCM |
| 广和通 | FM350-GL | 联发科 | PCIE | MBIM |
| 广和通 | FM150-AE-00FM150-AE-10FM150-AE-20FM150-NA-00 | 高通 | PCIE | QMI |
| 美格智能 | SRM815 | 高通 | USB | ECMMBIMRNDISNCM |
| 美格智能 | SRM825 | 高通 | USB | ECMMBIMRNDISNCM |
| 美格智能 | SRM825N | 高通 | USB | ECMMBIMRNDISNCM |

View File

@ -96,7 +96,6 @@ function getManufacturer(at_port)
local manufacturer
uci:foreach("modem", "modem-device", function (modem_device)
--设置模组AT串口
if at_port == modem_device["at_port"] then
manufacturer=modem_device["manufacturer"]
return true --跳出循环
@ -134,7 +133,6 @@ function getModes(at_port)
local modes
uci:foreach("modem", "modem-device", function (modem_device)
--设置模组AT串口
if at_port == modem_device["at_port"] then
modes=modem_device["modes"]
return true --跳出循环
@ -196,10 +194,10 @@ end
at_port AT串口
manufacturer
]]
function getModemMoreInfo(at_port,manufacturer,define_connect)
function getModemMoreInfo(at_port,manufacturer,platform,define_connect)
--获取模组信息
local command="sh "..script_path.."modem_info.sh".." "..at_port.." "..manufacturer.." "..define_connect
local command="sh "..script_path.."modem_info.sh".." "..at_port.." "..manufacturer.." "..platform.." "..define_connect
local result=shell(command)
--设置值
@ -220,7 +218,7 @@ function getModemInfo()
local modem_more_info
if at_port then
modem_device_info=getModemDeviceInfo(at_port)
modem_more_info=getModemMoreInfo(at_port,modem_device_info["manufacturer"],modem_device_info["define_connect"])
modem_more_info=getModemMoreInfo(at_port,modem_device_info["manufacturer"],modem_device_info["platform"],modem_device_info["define_connect"])
end
--设置信息
@ -525,7 +523,6 @@ function getModeInfo()
--获取值
local mode_info={}
uci:foreach("modem", "modem-device", function (modem_device)
--设置模组AT串口
if at_port == modem_device["at_port"] then
--获取制造商
@ -680,25 +677,46 @@ function getQuickCommands()
--获取AT串口
local at_port = http.formvalue("port")
--获取制造商
local manufacturer=getManufacturer(at_port)
local manufacturer
local platform
uci:foreach("modem", "modem-device", function (modem_device)
if at_port == modem_device["at_port"] then
--获取制造商
manufacturer=modem_device["manufacturer"]
--获取平台
platform=modem_device["platform"]
return true --跳出循环
end
end)
--未适配模组时,快捷命令选项为自定义
if manufacturer=="unknown" then
if manufacturer=="unknown" or manufacturer=="unknown" then
quick_option="custom"
end
local quick_commands={}
local commands={}
if quick_option=="auto" then
--获取模组AT命令
-- local command="source "..script_path.."modem_debug.sh && get_quick_commands "..quick_option.." "..manufacturer
local command="cat "..script_path..manufacturer.."_at_commands.json"
local result=shell(command)
quick_commands=json.parse(result)
--获取通用模组AT命令
local command="jq '.quick_commands.general' \""..script_path.."at_commands.json\""
local result=shell(command)
local general_commands=json.parse(result)
--获取特殊模组AT命令
command="jq '.quick_commands."..manufacturer.."."..platform.."' \""..script_path.."at_commands.json\""
result=shell(command)
local special_commands=json.parse(result)
--把通用命令和特殊命令整合到一起
for i = 1, #special_commands do
local special_command = special_commands[i]
table.insert(general_commands,special_command)
end
quick_commands["quick_commands"]=general_commands
else
uci:foreach("modem", "custom-commands", function (custom_commands)
uci:foreach("custom_at_commands", "custom-commands", function (custom_commands)
local command={}
command[custom_commands["description"]]=custom_commands["command"]
table.insert(commands,command)
@ -840,6 +858,7 @@ function getPluginInfo()
-- 设置翻译
translation={}
translation["Unknown"]=luci.i18n.translate("Unknown")
translation["Not installed"]=luci.i18n.translate("Not installed")
translation["Loaded"]=luci.i18n.translate("Loaded")
translation["Not loaded"]=luci.i18n.translate("Not loaded")
@ -850,19 +869,21 @@ function getPluginInfo()
-- 获取拨号工具信息
local dial_tool_info={}
dial_tool_info["quectel-CM-5G"]="Unknown"
dial_tool_info["modemmanager"]="Unknown"
dial_tool_info["quectel-CM-5G"]="Not installed"
dial_tool_info["modemmanager"]="Not installed"
setPluginVersionInfo(dial_tool_info)
-- 获取通用驱动信息
local general_driver_info={}
general_driver_info["usbnet.ko"]="Not loaded"
general_driver_info["qcserial.ko"]="Not loaded"
general_driver_info["option.ko"]="Not loaded"
-- general_driver_info["qcserial.ko"]="Not loaded"
setModelStatus(general_driver_info)
-- 获取模组USB驱动信息
local usb_driver_info={}
usb_driver_info["qmi_wwan.ko"]="Not loaded"
usb_driver_info["GobiNet.ko"]="Not loaded"
usb_driver_info["cdc_ether.ko"]="Not loaded"
usb_driver_info["cdc_mbim.ko"]="Not loaded"
usb_driver_info["rndis_host.ko"]="Not loaded"

View File

@ -78,6 +78,15 @@ s = m:section(NamedSection, arg[1], "modem-device", "")
s.addremove = false
s.dynamic = false
-- 手动配置
manual = s:option(Flag, "manual", translate("Manual"))
manual.default = "1"
manual.rmempty = false
-- uci:set('modem','modem-device','manual',1)
-- 隐藏手动配置
m:append(Template("modem/hide_manual_config_modem"))
-- 移动网络
mobile_network = s:option(ListValue, "network", translate("Mobile Network"))
mobile_network.rmempty = true
@ -95,9 +104,11 @@ function getMobileNetwork()
-- local count=$(echo "${network_path}" | grep -o "/net" | wc -l)
-- [ "$count" -ge "2" ] && return
-- 判断路径是否带有usb排除其他eth网络设备
-- 获取网络设备路径
local command="readlink -f /sys/class/net/"..network
local network_path=shell(command)
-- 判断路径是否带有usb排除其他eth网络设备
local flag="0"
if network_path:find("eth") and not network_path:find("usb") then
flag="1"
@ -120,7 +131,7 @@ getMobileNetwork()
-- 模组名称
name = s:option(ListValue, "name", translate("Modem Name"))
name.placeholder = translate("Not Null")
name.placeholder = translate("Not null")
name.rmempty = false
-- 按照制造商给模组分类
@ -142,7 +153,7 @@ end
-- AT串口
at_port = s:option(Value, "at_port", translate("AT Port"))
at_port.placeholder = translate("Not Null")
at_port.placeholder = translate("Not null")
at_port.rmempty = false
return m

View File

@ -36,11 +36,17 @@ s.extedit = d.build_url("admin", "network", "modem", "modem_config", "%s")
function s.create(uci, t)
-- 获取模组序号
local modem_no=tonumber(uci.map:get("@global[0]","modem_number")) -- 将字符串转换为数字类型
-- local modem_no=tonumber(uci.map:get("@global[0]","modem_number")) -- 将字符串转换为数字类型
local modem_no=0
local uci_tmp=luci.model.uci.cursor()
uci_tmp:foreach("modem", "modem-device", function (modem_device)
modem_no=modem_no+1
end)
t="modem"..modem_no
TypedSection.create(uci, t)
-- 设置手动配置
uci.map:set(t,"manual","1")
-- uci.map:set(t,"manual","1")
luci.http.redirect(uci.extedit:format(t))
end
@ -61,10 +67,10 @@ o.cfgvalue = function(t, n)
end
-- AT串口
-- o = s:option(DummyValue, "at_port", translate("AT Port"))
o = s:option(Value, "at_port", translate("AT Port"))
o.placeholder = translate("Not Null")
o.rmempty = false
o.optional = false
o = s:option(DummyValue, "at_port", translate("AT Port"))
-- o = s:option(Value, "at_port", translate("AT Port"))
-- o.placeholder = translate("Not null")
-- o.rmempty = false
-- o.optional = false
return m

View File

@ -5,7 +5,7 @@ local fs = require "nixio.fs"
local http = require "luci.http"
local uci = require "luci.model.uci".cursor()
m = Map("modem")
m = Map("custom_at_commands")
m.title = translate("Custom quick commands")
m.description = translate("Customize your quick commands")
m.redirect = dispatcher.build_url("admin", "network", "modem","modem_debug")
@ -18,12 +18,12 @@ s.sortable = true
s.template = "modem/tblsection_command"
description = s:option(Value, "description", translate("Description"))
description.placeholder = translate("Not Null")
description.placeholder = translate("Not null")
description.rmempty = true
description.optional = false
command = s:option(Value, "command", translate("Command"))
command.placeholder = translate("Not Null")
command.placeholder = translate("Not null")
command.rmempty = true
command.optional = false

View File

@ -1,6 +1,21 @@
<%+header%>
<style type="text/css">
/* 消息样式 */
#info_message {
text-align: left;
font-size: 1.8em;
}
#info_message img {
vertical-align: middle;
}
#info_message a {
color: rgb(61, 143, 173);
font-size: 50%;
}
#modem_status_view > div {
display: inline-block;
margin: 1rem;
@ -127,7 +142,7 @@
if (Object.keys(at_ports).length==0)
{
// 更新提示信息
document.getElementById("info_message").innerHTML="<strong><%:No modems found%></strong>";
document.getElementById("info_message").innerHTML='<strong><%:No modems found%></strong> <a href="https://blog.siriling.com:1212/2023/03/18/openwrt-5g-modem/#zi-dong-sao-miao-shi-bie-gong-neng" target="_blank"><%:(Check the reason)%></a>';
// 显示提示信息
document.getElementById("cbi-info").style.display="block";
// 隐藏AT命令界面
@ -216,8 +231,8 @@
<table class="table" id="message">
<tr class="tr">
<td colspan="2" class="td left">
<div align="left" id="info_message" style="font-size:1.875em">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
<div id="info_message">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>"/>
<%:Loading modem%>...
</div>
</td>

View File

@ -0,0 +1,19 @@
<script type="text/javascript">//<![CDATA[
window.onload=function()
{
// 获取高级设置标签元素
var str="manual"
var manual_element = document.querySelector('div[data-tab="'+str+'"]');
// 适配老版lucilede
if (manual_element==null) {
manual_element = document.querySelectorAll('div[id*="'+str+'"]')[0];
}
//隐藏拨号配置ID元素
manual_element.style.display="none";
}
//]]>
</script>

View File

@ -11,8 +11,8 @@
//获取快捷命令
get_quick_commands();
//获取模组调试信息
var debug_params={first_cache:true};
get_modem_debug_info(debug_params);
document.getElementById("first_cache").checked=true;
get_modem_debug_info();
});
//获取标签菜单
@ -79,8 +79,8 @@
{
childElements[i].addEventListener('click', function(event) {
tab_event(this);
var debug_params={first_cache:true};
get_modem_debug_info(debug_params);
document.getElementById("first_cache").checked=true;
get_modem_debug_info();
});
// // 创建一个 MutationObserver 实例
@ -90,8 +90,8 @@
// //只处理当前变为禁用的tab
// if (mutation.target.className=='cbi-tab') {
// //获取模组调试信息
// var debug_params={first_cache:true};
// get_modem_debug_info(debug_params);
// document.getElementById("first_cache").checked=true;
// get_modem_debug_info();
// //只处理一次
// break;
// }
@ -295,7 +295,7 @@
function no_modems_view()
{
//更新提示信息
document.getElementById("info_message").innerHTML="<strong><%:No modems found%></strong>";
document.getElementById("info_message").innerHTML='<strong><%:No modems found%></strong> <a href="https://blog.siriling.com:1212/2023/03/18/openwrt-5g-modem/#zi-dong-sao-miao-shi-bie-gong-neng" target="_blank"><%:(Check the reason)%></a>';
//显示提示信息
document.getElementById("cbi-info").style.display="block";
//隐藏模组选择界面
@ -305,12 +305,12 @@
//隐藏tab内容界面
document.getElementById("tab_context").style.display="none";
}
// 未适配模组界面
function not_adapted_modems_view()
{
//更新提示信息
document.getElementById("info_message").innerHTML="<strong><%:Not adapted to this modem%></strong>";
document.getElementById("info_message").innerHTML='<strong><%:Not adapted to this modem%></strong> <a href="https://github.com/Siriling/5G-Modem-Support/blob/main/luci-app-modem/README.md" target="_blank"><%:(Check adapted modem)%></a>';
//显示提示信息
document.getElementById("cbi-info").style.display="block";
//显示模组选择界面
@ -331,7 +331,7 @@
function all_function_view()
{
//更新提示信息
document.getElementById("info_message").innerHTML='<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/><%:Loading modem%>...';
document.getElementById("info_message").innerHTML='<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>"/><%:Loading modem%>...';
//显示模组选择界面
document.getElementById("cbi-modem").style.display="block";
//显示标签菜单界面
@ -880,6 +880,22 @@
<div class="cbi-map-descr"><%:Debug Your Module%></div>
<head>
<style type="text/css">
/* 消息样式 */
#info_message {
text-align: left;
font-size: 1.8em;
}
#info_message img {
vertical-align: middle;
}
#info_message a {
color: rgb(61, 143, 173);
font-size: 50%;
}
/* table {
width: 100%;
border-spacing: 10px;
@ -920,8 +936,8 @@
width:560px;
height:190px;
padding:20px;
background-color:gainsboro;
border-style : solid;
background-color:gainsboro;
border-style : solid;
position:fixed;
top : 40%;
margin-left: auto;
@ -931,6 +947,7 @@
text-align: center;
display:none;
}
</style>
</head>
@ -940,8 +957,8 @@
<table class="table" id="message">
<tr class="tr">
<td colspan="2" class="td left">
<div align="left" id="info_message" style="font-size:1.875em">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
<div id="info_message">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>"/>
<%:Loading modem%>...
</div>
</td>

View File

@ -22,6 +22,22 @@ end
}
} */
/* 消息样式 */
#info_message {
text-align: left;
font-size: 1.8em;
}
#info_message img {
vertical-align: middle;
}
#info_message a {
color: rgb(61, 143, 173);
font-size: 50%;
}
/* 信号样式 */
.signal-view {
position: relative;
min-width: 11rem;
@ -33,6 +49,7 @@ end
overflow: hidden;
}
/* 信号百分比样式 */
.signal-percent {
width: 0;
height: 100%;
@ -43,6 +60,7 @@ end
border-bottom-right-radius: 4px; */
}
/* 信号文字内容样式 */
.signal-context{
font-family: monospace;
/* font-size: 1em; */
@ -597,7 +615,7 @@ end
else //未适配模组
{
// 更新提示信息
document.getElementById("info_message").innerHTML="<strong><%:Not adapted to this modem%></strong>";
document.getElementById("info_message").innerHTML='<strong><%:Not adapted to this modem%></strong> <a href="https://github.com/Siriling/5G-Modem-Support/blob/main/luci-app-modem/README.md" target="_blank"><%:(Check adapted modem)%></a>';
// 显示提示信息
document.getElementById("cbi-info").style.display="block";
// 显示基本信息
@ -803,11 +821,11 @@ end
}
);
//无模界面
//无模界面
function no_modems_view()
{
// 更新提示信息
document.getElementById("info_message").innerHTML="<strong><%:No modems found%></strong>";
document.getElementById("info_message").innerHTML='<strong><%:No modems found%></strong> <a href="https://blog.siriling.com:1212/2023/03/18/openwrt-5g-modem/#zi-dong-sao-miao-shi-bie-gong-neng" target="_blank"><%:(Check the reason)%></a>';
// 显示提示信息
document.getElementById("cbi-info").style.display="block";
// 隐藏基本信息
@ -833,8 +851,8 @@ end
<tbody id="message">
<tr class="tr">
<td class="td left">
<div align="left" id="info_message" style="font-size:1.875em">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
<div id="info_message">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>"/>
<%:Loading modem information%>...
</div>
</td>

View File

@ -19,7 +19,7 @@ function modem_scan()
disabled_function("modem_scan",true);
//修改描述信息
var description='<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/><%:Scaning modem...%>'
var description='<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>"/><%:Scaning modem...%>'
document.getElementById('modem_scan_description').innerHTML=description;
XHR.get('<%=luci.dispatcher.build_url("admin", "network", "modem", "modem_scan")%>', null,
@ -37,7 +37,12 @@ function modem_scan()
//]]>
</script>
<style type="text/css"></style>
<style type="text/css">
/* 加载中样式 */
#modem_scan_description img {
vertical-align: middle;
}
</style>
<input class="btn cbi-button cbi-button-apply" type="button" id="modem_scan_button" value="<%:Scan%>" onclick="modem_scan()" alt="<%:Scan%>" title="<%:Scan%>"/>
<div class="cbi-value-description" id="modem_scan_description">

View File

@ -134,6 +134,11 @@
</script>
<style type="text/css">
/* 加载中样式 */
#modem_status_view img {
vertical-align: middle;
}
#modem_status_view > div {
display: inline-block;
margin: 1rem;
@ -149,7 +154,7 @@
<!-- <legend><%:Modem Status%></legend> -->
<h3><%:Modem Status%></h3>
<div id="modem_status_view">
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle"/>
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>"/>
<%:Loading modem status%>...
</div>
</fieldset>

View File

@ -21,7 +21,7 @@
for (var model in info)
{
//获取状态元素
var status_element=document.getElementById(model.replace(".ko","_status"));
var status_element=document.getElementById(model.toLowerCase().replace(".ko","_status"));
// 设置状态页面
set_status_view(info[model],status_element,translation);
}
@ -39,6 +39,10 @@
version_element.innerHTML=translation[info[plugin]];
version_element.style.color = "goldenrod";
}
else if (info[plugin]=="Not installed") {
version_element.innerHTML=translation[info[plugin]];
version_element.style.color = "red";
}
else
{
version_element.innerHTML="v"+info[plugin];
@ -156,10 +160,15 @@
<td class="td cbi-value-field" data-title="<%:Status%>" id="usbnet_status">-</td>
</tr>
<tr class="tr cbi-section-table-row cbi-rowstyle-2">
<td class="td cbi-value-field" data-title="<%:Driver Type%>" id="serial"><%:Serial Port%></td>
<td class="td cbi-value-field" data-title="<%:Kernel Model%>" id="serial_kernel_model_name">qcserial.ko</td>
<td class="td cbi-value-field" data-title="<%:Status%>" id="qcserial_status">-</td>
<td class="td cbi-value-field" data-title="<%:Driver Type%>" id="serial_port"><%:Serial Port%></td>
<td class="td cbi-value-field" data-title="<%:Kernel Model%>" id="serial_port_kernel_model_name">option.ko</td>
<td class="td cbi-value-field" data-title="<%:Status%>" id="option_status">-</td>
</tr>
<!-- <tr class="tr cbi-section-table-row cbi-rowstyle-2">
<td class="td cbi-value-field" data-title="<%:Driver Type%>" id="serial_port"><%:Serial Port%></td>
<td class="td cbi-value-field" data-title="<%:Kernel Model%>" id="serial_port_kernel_model_name">qcserial.ko</td>
<td class="td cbi-value-field" data-title="<%:Status%>" id="qcserial_status">-</td>
</tr> -->
</tbody>
</table>
</div>
@ -182,21 +191,26 @@
<td class="td cbi-value-field" data-title="<%:Status%>" id="qmi_wwan_status">-</td>
</tr>
<tr class="tr cbi-section-table-row cbi-rowstyle-2">
<td class="td cbi-value-field" data-title="<%:Driver Type%>" id="gobinet"><%:GobiNet%></td>
<td class="td cbi-value-field" data-title="<%:Kernel Model%>" id="gobinet_kernel_model_name">GobiNet.ko</td>
<td class="td cbi-value-field" data-title="<%:Status%>" id="gobinet_status">-</td>
</tr>
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
<td class="td cbi-value-field" data-title="<%:Driver Type%>" id="ecm"><%:ECM%></td>
<td class="td cbi-value-field" data-title="<%:Kernel Model%>" id="ecm_kernel_model_name">cdc_ether.ko</td>
<td class="td cbi-value-field" data-title="<%:Status%>" id="cdc_ether_status">-</td>
</tr>
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
<tr class="tr cbi-section-table-row cbi-rowstyle-2">
<td class="td cbi-value-field" data-title="<%:Driver Type%>" id="mbim"><%:MBIM%></td>
<td class="td cbi-value-field" data-title="<%:Kernel Model%>" id="mbim_kernel_model_name">cdc_mbim.ko</td>
<td class="td cbi-value-field" data-title="<%:Status%>" id="cdc_mbim_status">-</td>
</tr>
<tr class="tr cbi-section-table-row cbi-rowstyle-2">
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
<td class="td cbi-value-field" data-title="<%:Driver Type%>" id="rndis"><%:RNDIS%></td>
<td class="td cbi-value-field" data-title="<%:Kernel Model%>" id="rndis_kernel_model_name">rndis_host.ko</td>
<td class="td cbi-value-field" data-title="<%:Status%>" id="rndis_host_status">-</td>
</tr>
<tr class="tr cbi-section-table-row cbi-rowstyle-1">
<tr class="tr cbi-section-table-row cbi-rowstyle-2">
<td class="td cbi-value-field" data-title="<%:Driver Type%>" id="ecm"><%:NCM%></td>
<td class="td cbi-value-field" data-title="<%:Kernel Model%>" id="ncm_kernel_model_name">cdc_ncm.ko</td>
<td class="td cbi-value-field" data-title="<%:Status%>" id="cdc_ncm_status">-</td>

View File

@ -43,6 +43,9 @@ msgstr "查看已适配模组的信息"
msgid "Not adapted to this modem"
msgstr "未适配该模组"
msgid "(Check adapted modem)"
msgstr "(查看已适配模组)"
msgid "Loading modem information"
msgstr "正在加载模组信息"
@ -196,6 +199,9 @@ msgstr "模组信息"
msgid "No modems found"
msgstr "没有找到模组"
msgid "(Check the reason)"
msgstr "(查看原因)"
msgid "Enable dial configurations"
msgstr "启用拨号配置"
@ -394,6 +400,9 @@ msgstr "LTE 模式"
msgid "WCDMA Mode"
msgstr "WCDMA 模式"
msgid "GSM Mode"
msgstr "GSM 模式"
msgid "MCC"
msgstr "移动国家代码 (MCC)"
@ -577,6 +586,12 @@ msgstr "启用手动配置模组信息"
msgid "(After enable, the automatic scanning and configuration function for modem information will be disabled)"
msgstr "(启用后将禁用自动扫描并配置模组信息功能)"
msgid "Not null"
msgstr "不能为空"
msgid "missing"
msgstr "有必填选项为空值"
msgid "Plugin Info"
msgstr "插件信息"
@ -595,6 +610,9 @@ msgstr "quectel-CM 版本"
msgid "modemmanager Version"
msgstr "modemmanager 版本"
msgid "Not installed"
msgstr "未安装"
msgid "Modem General Driver Info"
msgstr "模组通用驱动信息"

View File

@ -43,6 +43,9 @@ msgstr "查看已适配模组的信息"
msgid "Not adapted to this modem"
msgstr "未适配该模组"
msgid "(Check adapted modem)"
msgstr "(查看已适配模组)"
msgid "Loading modem information"
msgstr "正在加载模组信息"
@ -196,6 +199,9 @@ msgstr "模组信息"
msgid "No modems found"
msgstr "没有找到模组"
msgid "(Check the reason)"
msgstr "(查看原因)"
msgid "Enable dial configurations"
msgstr "启用拨号配置"
@ -394,6 +400,9 @@ msgstr "LTE 模式"
msgid "WCDMA Mode"
msgstr "WCDMA 模式"
msgid "GSM Mode"
msgstr "GSM 模式"
msgid "MCC"
msgstr "移动国家代码 (MCC)"
@ -577,6 +586,12 @@ msgstr "启用手动配置模组信息"
msgid "(After enable, the automatic scanning and configuration function for modem information will be disabled)"
msgstr "(启用后将禁用自动扫描并配置模组信息功能)"
msgid "Not null"
msgstr "不能为空"
msgid "missing"
msgstr "有必填选项为空值"
msgid "Plugin Info"
msgstr "插件信息"
@ -595,6 +610,9 @@ msgstr "quectel-CM 版本"
msgid "modemmanager Version"
msgstr "modemmanager 版本"
msgid "Not installed"
msgstr "未安装"
msgid "Modem General Driver Info"
msgstr "模组通用驱动信息"

View File

@ -0,0 +1,332 @@
config custom-commands
option description '****************通用****************'
option command 'ATI'
config custom-commands
option description '模组信息 > ATI'
option command 'ATI'
config custom-commands
option description '查询SIM卡状态 > AT+CPIN?'
option command 'AT+CPIN?'
config custom-commands
option description '查询网络信号质量4G > AT+CSQ'
option command 'AT+CSQ'
config custom-commands
option description '查询网络信号质量5G > AT+CESQ'
option command 'AT+CESQ'
config custom-commands
option description '查询网络信息 > AT+COPS?'
option command 'AT+COPS?'
config custom-commands
option description '查询PDP信息 > AT+CGDCONT?'
option command 'AT+CGDCONT?'
config custom-commands
option description '查询PDP地址 > AT+CGPADDR'
option command 'AT+CGPADDR'
config custom-commands
option description '查询模组IMEI > AT+CGSN'
option command 'AT+CGSN'
config custom-commands
option description '查询模组IMEI > AT+GSN'
option command 'AT+GSN'
config custom-commands
option description '查看当前电压'
option command 'AT+CBC'
config custom-commands
option description '最小功能模式 > AT+CFUN=0'
option command 'AT+CFUN=0'
config custom-commands
option description '全功能模式 > AT+CFUN=1'
option command 'AT+CFUN=1'
config custom-commands
option description '重启模组 > AT+CFUN=1,1'
option command 'AT+CFUN=1,1'
config custom-commands
option description '****************移远****************'
option command 'ATI'
config custom-commands
option description 'SIM卡状态上报 > AT+QSIMSTAT?'
option command 'AT+QSIMSTAT?'
config custom-commands
option description '设置当前使用的为卡1 > AT+QUIMSLOT=1'
option command 'AT+QUIMSLOT=1'
config custom-commands
option description '设置当前使用的为卡2 > AT+QUIMSLOT=2'
option command 'AT+QUIMSLOT=2'
config custom-commands
option description '查询网络信息 > AT+QNWINFO'
option command 'AT+QNWINFO'
config custom-commands
option description '查询SIM卡签约速率 > AT+QNWCFG="nr5g_ambr"'
option command 'AT+QNWCFG="nr5g_ambr"'
config custom-commands
option description '查询载波聚合参数 > AT+QCAINFO'
option command 'AT+QCAINFO'
config custom-commands
option description '查询当前拨号模式 > AT+QCFG="usbnet"'
option command 'AT+QCFG="usbnet"'
config custom-commands
option description 'QMI/GobiNet拨号 > AT+QCFG="usbnet",0'
option command 'AT+QCFG="usbnet",0'
config custom-commands
option description 'ECM拨号 > AT+QCFG="usbnet",1'
option command 'AT+QCFG="usbnet",1'
config custom-commands
option description 'MBIM拨号 > AT+QCFG="usbnet",2'
option command 'AT+QCFG="usbnet",2'
config custom-commands
option description 'RNDIS拨号 > AT+QCFG="usbnet",3'
option command 'AT+QCFG="usbnet",3'
config custom-commands
option description 'NCM拨号 > AT+QCFG="usbnet",5'
option command 'AT+QCFG="usbnet",5'
config custom-commands
option description '锁4G > AT+QNWPREFCFG="mode_pref",LTE'
option command 'AT+QNWPREFCFG="mode_pref",LTE'
config custom-commands
option description '锁5G > AT+QNWPREFCFG="mode_pref",NR5G'
option command 'AT+QNWPREFCFG="mode_pref",NR5G'
config custom-commands
option description '锁5G NSA > AT+QNWPREFCFG="mode_pref",NR5G-NSA'
option command 'AT+QNWPREFCFG="mode_pref",NR5G-NSA'
config custom-commands
option description '锁5G SA > AT+QNWPREFCFG="mode_pref",NR5G-SA'
option command 'AT+QNWPREFCFG="mode_pref",NR5G-SA'
config custom-commands
option description '恢复自动搜索网络 > AT+QNWPREFCFG="mode_pref",AUTO'
option command 'AT+QNWPREFCFG="mode_pref",AUTO'
config custom-commands
option description '查询模组IMEI > AT+EGMR=0,7'
option command 'AT+EGMR=0,7'
config custom-commands
option description '更改模组IMEI > AT+EGMR=1,7,"IMEI"'
option command 'AT+EGMR=1,7,"在此设置IMEI"'
config custom-commands
option description '获取模组温度 > AT+QTEMP'
option command 'AT+QTEMP'
config custom-commands
option description '切换为USB通信端口 > AT+QCFG="data_interface",0,0'
option command 'AT+QCFG="data_interface",0,0'
config custom-commands
option description '切换为PCIE通信端口 > AT+QCFG="data_interface",1,0'
option command 'AT+QCFG="data_interface",1,0'
config custom-commands
option description '查看当前USB速率 > AT+QCFG="usbspeed"'
option command 'AT+QCFG="usbspeed"'
config custom-commands
option description '切换为USB2.0 > AT+QCFG="usbspeed","20"'
option command 'AT+QCFG="usbspeed","20"'
config custom-commands
option description '切换为USB3.1 Gen15Gbps > AT+QCFG="usbspeed","311"'
option command 'AT+QCFG="usbspeed","311"'
config custom-commands
option description '切换为USB3.1 Gen110Gbps > AT+QCFG="usbspeed","312"'
option command 'AT+QCFG="usbspeed","312"'
config custom-commands
option description '重置模组 > AT+QCFG="ResetFactory"'
option command 'AT+QCFG="ResetFactory"'
config custom-commands
option description '****************广和通****************'
option command 'ATI'
config custom-commands
option description '设置当前使用的为卡1 > AT+GTDUALSIM=0'
option command 'AT+GTDUALSIM=0'
config custom-commands
option description '设置当前使用的为卡2 > AT+GTDUALSIM=1'
option command 'AT+GTDUALSIM=1'
config custom-commands
option description 'ECM手动拨号 > AT+GTRNDIS=1,1'
option command 'AT+GTRNDIS=1,1'
config custom-commands
option description 'ECM拨号断开 > AT+GTRNDIS=0,1'
option command 'AT+GTRNDIS=0,1'
config custom-commands
option description '查询当前端口模式 > AT+GTUSBMODE?'
option command 'AT+GTUSBMODE?'
config custom-commands
option description 'QMI/GobiNet拨号 > AT+GTUSBMODE=32'
option command 'AT+GTUSBMODE=32'
config custom-commands
option description 'ECM拨号 > AT+GTUSBMODE=18'
option command 'AT+GTUSBMODE=18'
config custom-commands
option description 'MBIM拨号 > AT+GTUSBMODE=30'
option command 'AT+GTUSBMODE=30'
config custom-commands
option description 'RNDIS拨号 > AT+GTUSBMODE=24'
option command 'AT+GTUSBMODE=24'
config custom-commands
option description 'NCM拨号 > AT+GTUSBMODE=18'
option command 'AT+GTUSBMODE=18'
config custom-commands
option description '锁4G > AT+GTACT=2'
option command 'AT+GTACT=2'
config custom-commands
option description '锁5G > AT+GTACT=14'
option command 'AT+GTACT=14'
config custom-commands
option description '恢复自动搜索网络 > AT+GTACT=20'
option command 'AT+GTACT=20'
config custom-commands
option description '查询当前连接的网络类型 > AT+PSRAT?'
option command 'AT+PSRAT?'
config custom-commands
option description '查询模组IMEI > AT+GTSN=0,7'
option command 'AT+GTSN=0,7'
config custom-commands
option description '更改模组IMEI > AT+GTSN=1,7,"IMEI"'
option command 'AT+GTSN=1,7,"在此设置IMEI"'
config custom-commands
option description '报告一次当前BBIC的温度 > AT+MTSM=1,6'
option command 'AT+MTSM=1,6'
config custom-commands
option description '报告一次当前射频的温度 > AT+MTSM=1,7'
option command 'AT+MTSM=1,7'
config custom-commands
option description '获取当前温度 > AT+GTLADC'
option command 'AT+GTLADC'
config custom-commands
option description '重启模组 > AT+CFUN=15'
option command 'AT+CFUN=15'
config custom-commands
option description '****************美格****************'
option command 'ATI'
config custom-commands
option description 'SIM卡状态上报 > AT^SIMSLOTURC=1'
option command 'AT^SIMSLOTURC=1'
config custom-commands
option description '获取SIM卡卡槽状态 > AT^SIMSLOT?'
option command 'AT^SIMSLOT?'
config custom-commands
option description '设置当前使用的为卡1 > AT^SIMSLOT=1'
option command 'AT^SIMSLOT=1'
config custom-commands
option description '设置当前使用的为卡2 > AT^SIMSLOT=2'
option command 'AT^SIMSLOT=2'
config custom-commands
option description '查询网络信息 > AT^SYSINFOEX'
option command 'AT^SYSINFOEX'
config custom-commands
option description '查询载波聚合小区信息 > AT^CELLINFO=3'
option command 'AT^CELLINFO=3'
config custom-commands
option description '查询当前拨号模式 > AT+SER?'
option command 'AT+SER?'
config custom-commands
option description 'QMI/GobiNet拨号 > AT+SER=1,1'
option command 'AT+SER=1,1'
config custom-commands
option description 'ECM拨号 > AT+SER=2,1'
option command 'AT+SER=2,1'
config custom-commands
option description 'MBIM拨号 > AT+SER=3,1'
option command 'AT+SER=3,1'
config custom-commands
option description 'RNDIS拨号 > AT+SER=3,1'
option command 'AT+SER=3,1'
config custom-commands
option description 'NCM拨号 > AT+SER=2,1'
option command 'AT+SER=2,1'
config custom-commands
option description '锁4G > AT^SYSCFGEX="03",all,0,2,all,all,all,all,1'
option command 'AT^SYSCFGEX="03",all,0,2,all,all,all,all,1'
config custom-commands
option description '锁5G > AT^SYSCFGEX="04",all,0,2,all,all,all,all,1'
option command 'AT^SYSCFGEX="04",all,0,2,all,all,all,all,1'
config custom-commands
option description '恢复自动搜索网络 > AT^SYSCFGEX="00",all,0,2,all,all,all,all,1'
option command 'AT^SYSCFGEX="00",all,0,2,all,all,all,all,1'
config custom-commands
option description '查询模组IMEI > AT+LCTSN=0,7'
option command 'AT+LCTSN=0,7'
config custom-commands
option description '更改模组IMEI > AT+LCTSN=1,7,"IMEI"'
option command 'AT+LCTSN=1,7,"在此设置IMEI"'
config custom-commands
option description '获取模组温度 > AT+TEMP'
option command 'AT+TEMP'
config custom-commands
option description '重启模组 > AT+RESET'
option command 'AT+RESET'

View File

@ -2,248 +2,4 @@
config global 'global'
option enable_dial '1'
option modem_number '0'
option manual_configuration '0'
config custom-commands
option description '****************通用****************'
option command 'ATI'
config custom-commands
option description '模组信息 > ATI'
option command 'ATI'
config custom-commands
option description '查询SIM卡状态 > AT+CPIN?'
option command 'AT+CPIN?'
config custom-commands
option description '查询网络信号质量4G > AT+CSQ'
option command 'AT+CSQ'
config custom-commands
option description '查询网络信号质量5G > AT+CESQ'
option command 'AT+CESQ'
config custom-commands
option description '查询网络信息 > AT+COPS?'
option command 'AT+COPS?'
config custom-commands
option description '查询PDP信息 > AT+CGDCONT?'
option command 'AT+CGDCONT?'
config custom-commands
option description '查询PDP地址 > AT+CGPADDR'
option command 'AT+CGPADDR'
config custom-commands
option description '最小功能模式 > AT+CFUN=0'
option command 'AT+CFUN=0'
config custom-commands
option description '全功能模式 > AT+CFUN=1'
option command 'AT+CFUN=1'
config custom-commands
option description '重启模组 > AT+CFUN=1,1'
option command 'AT+CFUN=1,1'
config custom-commands
option description '****************移远****************'
option command 'ATI'
config custom-commands
option description 'SIM卡状态上报 > AT+QSIMSTAT?'
option command 'AT+QSIMSTAT?'
config custom-commands
option description '设置当前使用的为卡1 > AT+QUIMSLOT=1'
option command 'AT+QUIMSLOT=1'
config custom-commands
option description '设置当前使用的为卡2 > AT+QUIMSLOT=2'
option command 'AT+QUIMSLOT=2'
config custom-commands
option description '查询网络信息 > AT+QNWINFO'
option command 'AT+QNWINFO'
config custom-commands
option description '查询SIM卡签约速率 > AT+QNWCFG="nr5g_ambr"'
option command 'AT+QNWCFG="nr5g_ambr"'
config custom-commands
option description '查询载波聚合参数 > AT+QCAINFO'
option command 'AT+QCAINFO'
config custom-commands
option description '查询当前拨号模式 > AT+QCFG="usbnet"'
option command 'AT+QCFG="usbnet"'
config custom-commands
option description 'QMI/GobiNet拨号 > AT+QCFG="usbnet",0'
option command 'AT+QCFG="usbnet",0'
config custom-commands
option description 'ECM拨号 > AT+QCFG="usbnet",1'
option command 'AT+QCFG="usbnet",1'
config custom-commands
option description 'MBIM拨号 > AT+QCFG="usbnet",2'
option command 'AT+QCFG="usbnet",2'
config custom-commands
option description 'RNDIS拨号 > AT+QCFG="usbnet",3'
option command 'AT+QCFG="usbnet",3'
config custom-commands
option description 'NCM拨号 > AT+QCFG="usbnet",5'
option command 'AT+QCFG="usbnet",5'
config custom-commands
option description '锁4G > AT+QNWPREFCFG="mode_pref",LTE'
option command 'AT+QNWPREFCFG="mode_pref",LTE'
config custom-commands
option description '锁5G > AT+QNWPREFCFG="mode_pref",NR5G'
option command 'AT+QNWPREFCFG="mode_pref",NR5G'
config custom-commands
option description '锁5G NSA > AT+QNWPREFCFG="mode_pref",NR5G-NSA'
option command 'AT+QNWPREFCFG="mode_pref",NR5G-NSA'
config custom-commands
option description '锁5G SA > AT+QNWPREFCFG="mode_pref",NR5G-SA'
option command 'AT+QNWPREFCFG="mode_pref",NR5G-SA'
config custom-commands
option description '恢复自动搜索网络 > AT+QNWPREFCFG="mode_pref",AUTO'
option command 'AT+QNWPREFCFG="mode_pref",AUTO'
config custom-commands
option description '查询模组IMEI > AT+CGSN'
option command 'AT+CGSN'
config custom-commands
option description '查询模组IMEI > AT+GSN'
option command 'AT+GSN'
config custom-commands
option description '更改模组IMEI > AT+EGMR=1,7,"IMEI"'
option command 'AT+EGMR=1,7,"在此设置IMEI"'
config custom-commands
option description '获取模组温度 > AT+QTEMP'
option command 'AT+QTEMP'
config custom-commands
option description '切换为USB通信端口 > AT+QCFG="data_interface",0,0'
option command 'AT+QCFG="data_interface",0,0'
config custom-commands
option description '切换为PCIE通信端口 > AT+QCFG="data_interface",1,0'
option command 'AT+QCFG="data_interface",1,0'
config custom-commands
option description '查看当前USB速率 > AT+QCFG="usbspeed"'
option command 'AT+QCFG="usbspeed"'
config custom-commands
option description '切换为USB2.0 > AT+QCFG="usbspeed","20"'
option command 'AT+QCFG="usbspeed","20"'
config custom-commands
option description '切换为USB3.1 Gen15Gbps > AT+QCFG="usbspeed","311"'
option command 'AT+QCFG="usbspeed","311"'
config custom-commands
option description '切换为USB3.1 Gen110Gbps > AT+QCFG="usbspeed","312"'
option command 'AT+QCFG="usbspeed","312"'
config custom-commands
option description '重置模组 > AT+QCFG="ResetFactory"'
option command 'AT+QCFG="ResetFactory"'
config custom-commands
option description '****************广和通****************'
option command 'ATI'
config custom-commands
option description '设置当前使用的为卡1 > AT+GTDUALSIM=0'
option command 'AT+GTDUALSIM=0'
config custom-commands
option description '设置当前使用的为卡2 > AT+GTDUALSIM=1'
option command 'AT+GTDUALSIM=1'
config custom-commands
option description 'ECM手动拨号 > AT+GTRNDIS=1,1'
option command 'AT+GTRNDIS=1,1'
config custom-commands
option description 'ECM拨号断开 > AT+GTRNDIS=0,1'
option command 'AT+GTRNDIS=0,1'
config custom-commands
option description '查询当前端口模式 > AT+GTUSBMODE?'
option command 'AT+GTUSBMODE?'
config custom-commands
option description 'QMI/GobiNet拨号 > AT+GTUSBMODE=32'
option command 'AT+GTUSBMODE=32'
config custom-commands
option description 'ECM拨号 > AT+GTUSBMODE=18'
option command 'AT+GTUSBMODE=18'
config custom-commands
option description 'MBIM拨号 > AT+GTUSBMODE=30'
option command 'AT+GTUSBMODE=30'
config custom-commands
option description 'RNDIS拨号 > AT+GTUSBMODE=24'
option command 'AT+GTUSBMODE=24'
config custom-commands
option description 'NCM拨号 > AT+GTUSBMODE=18'
option command 'AT+GTUSBMODE=18'
config custom-commands
option description '锁4G > AT+GTACT=2'
option command 'AT+GTACT=2'
config custom-commands
option description '锁5G > AT+GTACT=14'
option command 'AT+GTACT=14'
config custom-commands
option description '恢复自动搜索网络 > AT+GTACT=20'
option command 'AT+GTACT=20'
config custom-commands
option description '查询当前连接的网络类型 > AT+PSRAT?'
option command 'AT+PSRAT?'
config custom-commands
option description '查询模组IMEI > AT+CGSN?'
option command 'AT+CGSN?'
config custom-commands
option description '查询模组IMEI > AT+GSN?'
option command 'AT+GSN?'
config custom-commands
option description '更改模组IMEI > AT+GTSN=1,7,"IMEI"'
option command 'AT+GTSN=1,7,"在此设置IMEI"'
config custom-commands
option description '报告一次当前BBIC的温度 > AT+MTSM=1,6'
option command 'AT+MTSM=1,6'
config custom-commands
option description '报告一次当前射频的温度 > AT+MTSM=1,7'
option command 'AT+MTSM=1,7'
config custom-commands
option description '重置模组 > AT+CFUN=15'
option command 'AT+CFUN=15'
option manual_configuration '0'

View File

@ -402,6 +402,8 @@ stop_gobinet()
at_command='ATI'
elif [ "$manufacturer" = "fibocom" ]; then
at_command='AT$QCRMCALL=0,1'
elif [ "$manufacturer" = "meig" ]; then
at_command='ATI'
else
at_command='ATI'
fi
@ -428,6 +430,8 @@ stop_ecm()
else
at_command="AT+GTRNDIS=0,${define_connect}"
fi
elif [ "$manufacturer" = "meig" ]; then
at_command="AT$QCRMCALL=0,1,${define_connect},2,1"
else
at_command='ATI'
fi
@ -518,10 +522,6 @@ connect_presets()
local at_command='AT+COPS=0,0'
tmp=$(at "${at_port}" "${at_command}")
#设置IPv6地址格式
at_command='AT+CGPIAF=1,0,0,0'
tmp=$(at "${at_port}" "${at_command}")
#获取连接定义
local define_connect=$(uci -q get modem.modem${modem_no}.define_connect)
#获取PDP类型和APN
@ -719,7 +719,7 @@ manual_set_modem_config()
m_set_modem_port "${physical_path}"
#获取模组数量
local modem_number=$(uci -q get modem.@global[0].modem_number)
modem_number=$(uci -q get modem.@global[0].modem_number)
#获取模组序号
local modem_no
for i in $(seq 0 $((modem_number-1))); do
@ -779,22 +779,23 @@ service_triggers()
}
start_service() {
#统计模组数量
modem_count=0
config_foreach count_modem_number "modem-device"
#设置模组数量
uci set modem.@global[0].modem_number=${modem_count}
uci commit modem
#加载模组配置
config_load modem
#手动设置模组信息
config_foreach manual_set_modem_config "modem-device"
local enable_dial=$(uci -q get modem.@global[0].enable_dial)
if [ "$enable_dial" = "0" ]; then
stop_service
else
#加载模组配置
config_load modem
#手动设置模组信息
config_foreach manual_set_modem_config "modem-device"
#统计模组数量
modem_count=0
config_foreach count_modem_number "modem-device"
#设置模组数量
uci set modem.@global[0].modem_number=${modem_count}
uci commit modem
#删除拨号配置
del_dial_config
#加载拨号配置

View File

@ -0,0 +1,164 @@
{
"quick_commands":{
"general":[
{"模组信息 > ATI":"ATI"},
{"查询SIM卡状态 > AT+CPIN?":"AT+CPIN?"},
{"查询网络信号质量4G > AT+CSQ":"AT+CSQ"},
{"查询网络信号质量5G > AT+CESQ":"AT+CESQ"},
{"查询网络信息 > AT+COPS?":"AT+COPS?"},
{"查询PDP信息 > AT+CGDCONT?":"AT+CGDCONT?"},
{"查询PDP地址 > AT+CGPADDR":"AT+CGPADDR"},
{"查询模组IMEI > AT+CGSN":"AT+CGSN"},
{"查询模组IMEI > AT+GSN":"AT+GSN"},
{"查看当前电压 > AT+CBC":"AT+CBC"},
{"最小功能模式 > AT+CFUN=0":"AT+CFUN=0"},
{"全功能模式 > AT+CFUN=1":"AT+CFUN=1"},
{"重启模组 > AT+CFUN=1,1":"AT+CFUN=1,1"}
],
"quectel":{
"qualcomm":[
{"SIM卡状态上报 > AT+QSIMSTAT?":"AT+QSIMSTAT?"},
{"设置当前使用的为卡1 > AT+QUIMSLOT=1":"AT+QUIMSLOT=1"},
{"设置当前使用的为卡2 > AT+QUIMSLOT=2":"AT+QUIMSLOT=2"},
{"查询网络信息 > AT+QNWINFO":"AT+QNWINFO"},
{"查询载波聚合参数 > AT+QCAINFO":"AT+QCAINFO"},
{"查询当前拨号模式 > AT+QCFG=\"usbnet\"":"AT+QCFG=\"usbnet\""},
{"QMI/GobiNet拨号模式 > AT+QCFG=\"usbnet\",0":"AT+QCFG=\"usbnet\",0"},
{"ECM拨号模式 > AT+QCFG=\"usbnet\",1":"AT+QCFG=\"usbnet\",1"},
{"MBIM拨号模式 > AT+QCFG=\"usbnet\",2":"AT+QCFG=\"usbnet\",2"},
{"RNDIS拨号模式 > AT+QCFG=\"usbnet\",3":"AT+QCFG=\"usbnet\",3"},
{"NCM拨号模式 > AT+QCFG=\"usbnet\",5":"AT+QCFG=\"usbnet\",5"},
{"锁4G > AT+QNWPREFCFG=\"mode_pref\",LTE":"AT+QNWPREFCFG=\"mode_pref\",LTE"},
{"锁5G > AT+QNWPREFCFG=\"mode_pref\",NR5G":"AT+QNWPREFCFG=\"mode_pref\",NR5G"},
{"锁5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"},
{"锁5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"},
{"恢复自动搜索网络 > AT+QNWPREFCFG=\"mode_pref\",AUTO":"AT+QNWPREFCFG=\"mode_pref\",AUTO"},
{"查询模组IMEI > AT+EGMR=0,7":"AT+EGMR=0,7"},
{"更改模组IMEI > AT+EGMR=1,7,\"IMEI\"":"AT+EGMR=1,7,\"在此设置IMEI\""},
{"获取模组温度 > AT+QTEMP":"AT+QTEMP"},
{"切换为USB通信端口 > AT+QCFG=\"data_interface\",0,0":"AT+QCFG=\"data_interface\",0,0"},
{"切换为PCIE通信端口 > AT+QCFG=\"data_interface\",1,0":"AT+QCFG=\"data_interface\",1,0"},
{"查看当前USB速率 > AT+QCFG=\"usbspeed\"":"AT+QCFG=\"usbspeed\""},
{"切换为USB2.0 > AT+QCFG=\"usbspeed\",\"20\"":"AT+QCFG=\"usbspeed\",\"20\""},
{"切换为USB3.1 Gen15Gbps > AT+QCFG=\"usbspeed\",\"311\"":"AT+QCFG=\"usbspeed\",\"311\""},
{"切换为USB3.1 Gen110Gbps > AT+QCFG=\"usbspeed\",\"312\"":"AT+QCFG=\"usbspeed\",\"312\""},
{"重置模组 > AT+QCFG=\"ResetFactory\"":"AT+QCFG=\"ResetFactory\""}
],
"unisoc":[
{"SIM卡状态上报 > AT+QSIMSTAT?":"AT+QSIMSTAT?"},
{"设置当前使用的为卡1 > AT+QUIMSLOT=1":"AT+QUIMSLOT=1"},
{"设置当前使用的为卡2 > AT+QUIMSLOT=2":"AT+QUIMSLOT=2"},
{"查询网络信息 > AT+QNWINFO":"AT+QNWINFO"},
{"查询载波聚合参数 > AT+QCAINFO":"AT+QCAINFO"},
{"查询当前拨号模式 > AT+QCFG=\"usbnet\"":"AT+QCFG=\"usbnet\""},
{"ECM拨号模式 > AT+QCFG=\"usbnet\",1":"AT+QCFG=\"usbnet\",1"},
{"MBIM拨号模式 > AT+QCFG=\"usbnet\",2":"AT+QCFG=\"usbnet\",2"},
{"RNDIS拨号模式 > AT+QCFG=\"usbnet\",3":"AT+QCFG=\"usbnet\",3"},
{"NCM拨号模式 > AT+QCFG=\"usbnet\",5":"AT+QCFG=\"usbnet\",5"},
{"锁4G > AT+QNWPREFCFG=\"mode_pref\",LTE":"AT+QNWPREFCFG=\"mode_pref\",LTE"},
{"锁5G > AT+QNWPREFCFG=\"mode_pref\",NR5G":"AT+QNWPREFCFG=\"mode_pref\",NR5G"},
{"锁5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"},
{"锁5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"},
{"恢复自动搜索网络 > AT+QNWPREFCFG=\"mode_pref\",AUTO":"AT+QNWPREFCFG=\"mode_pref\",AUTO"},
{"查询模组IMEI > AT+EGMR=0,7":"AT+EGMR=0,7"},
{"更改模组IMEI > AT+EGMR=1,7,\"IMEI\"":"AT+EGMR=1,7,\"在此设置IMEI\""},
{"获取模组温度 > AT+QTEMP":"AT+QTEMP"},
{"切换为USB通信端口 > AT+QCFG=\"data_interface\",0,0":"AT+QCFG=\"data_interface\",0,0"},
{"切换为PCIE通信端口 > AT+QCFG=\"data_interface\",1,0":"AT+QCFG=\"data_interface\",1,0"},
{"查看当前USB速率 > AT+QCFG=\"usbspeed\"":"AT+QCFG=\"usbspeed\""},
{"切换为USB2.0 > AT+QCFG=\"usbspeed\",\"20\"":"AT+QCFG=\"usbspeed\",\"20\""},
{"切换为USB3.1 Gen15Gbps > AT+QCFG=\"usbspeed\",\"311\"":"AT+QCFG=\"usbspeed\",\"311\""},
{"切换为USB3.1 Gen110Gbps > AT+QCFG=\"usbspeed\",\"312\"":"AT+QCFG=\"usbspeed\",\"312\""},
{"重置模组 > AT+QCFG=\"ResetFactory\"":"AT+QCFG=\"ResetFactory\""}
]
},
"fibocom":{
"qualcomm":[
{"设置当前使用的为卡1 > AT+GTDUALSIM=0":"AT+GTDUALSIM=0"},
{"设置当前使用的为卡2 > AT+GTDUALSIM=1":"AT+GTDUALSIM=1"},
{"ECM手动拨号 > AT+GTRNDIS=1,1":"AT+GTRNDIS=1,1"},
{"ECM拨号断开 > AT+GTRNDIS=0,1":"AT+GTRNDIS=0,1"},
{"查询当前端口模式 > AT+GTUSBMODE?":"AT+GTUSBMODE?"},
{"QMI/GobiNet拨号模式 > AT+GTUSBMODE=32":"AT+GTUSBMODE=32"},
{"ECM拨号模式 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"},
{"MBIM拨号模式 > AT+GTUSBMODE=30":"AT+GTUSBMODE=30"},
{"RNDIS拨号模式 > AT+GTUSBMODE=24":"AT+GTUSBMODE=24"},
{"NCM拨号模式 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"},
{"锁4G > AT+GTACT=2":"AT+GTACT=2"},
{"锁5G > AT+GTACT=14":"AT+GTACT=14"},
{"恢复自动搜索网络 > AT+GTACT=20":"AT+GTACT=20"},
{"查询当前连接的网络类型 > AT+PSRAT?":"AT+PSRAT?"},
{"查询模组IMEI > AT+GTSN=0,7":"AT+GTSN=0,7"},
{"更改模组IMEI > AT+GTSN=1,7,\"IMEI\"":"AT+GTSN=1,7,\"在此设置IMEI\""},
{"报告一次当前BBIC的温度 > AT+MTSM=1,6":"AT+MTSM=1,6"},
{"报告一次当前射频的温度 > AT+MTSM=1,7":"AT+MTSM=1,7"},
{"重启模组 > AT+CFUN=15":"AT+CFUN=15"}
],
"unisoc":[
{"设置当前使用的为卡1 > AT+GTDUALSIM=0":"AT+GTDUALSIM=0"},
{"设置当前使用的为卡2 > AT+GTDUALSIM=1":"AT+GTDUALSIM=1"},
{"ECM手动拨号 > AT+GTRNDIS=1,1":"AT+GTRNDIS=1,1"},
{"ECM拨号断开 > AT+GTRNDIS=0,1":"AT+GTRNDIS=0,1"},
{"查询当前端口模式 > AT+GTUSBMODE?":"AT+GTUSBMODE?"},
{"ECM拨号模式 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"},
{"MBIM拨号模式 > AT+GTUSBMODE=30":"AT+GTUSBMODE=30"},
{"RNDIS拨号模式 > AT+GTUSBMODE=24":"AT+GTUSBMODE=24"},
{"NCM拨号模式 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"},
{"锁4G > AT+GTACT=2":"AT+GTACT=2"},
{"锁5G > AT+GTACT=14":"AT+GTACT=14"},
{"恢复自动搜索网络 > AT+GTACT=20":"AT+GTACT=20"},
{"查询当前连接的网络类型 > AT+PSRAT?":"AT+PSRAT?"},
{"查询模组IMEI > AT+GTSN=0,7":"AT+GTSN=0,7"},
{"更改模组IMEI > AT+GTSN=1,7,\"IMEI\"":"AT+GTSN=1,7,\"在此设置IMEI\""},
{"报告一次当前BBIC的温度 > AT+MTSM=1,6":"AT+MTSM=1,6"},
{"报告一次当前射频的温度 > AT+MTSM=1,7":"AT+MTSM=1,7"},
{"重启模组 > AT+CFUN=15":"AT+CFUN=15"}
],
"mediatek":[
{"设置当前使用的为卡1 > AT+GTDUALSIM=0":"AT+GTDUALSIM=0"},
{"设置当前使用的为卡2 > AT+GTDUALSIM=1":"AT+GTDUALSIM=1"},
{"手动设置接入点 > AT+CGDCONT=3,\"IPV4V6\",\"APN\"":"AT+CGDCONT=3,\"IPV4V6\",\"在此设置APN\""},
{"手动拨号 > AT+CGACT=1,3":"AT+CGACT=1,3"},
{"停止拨号 > AT+CGACT=0,3":"AT+CGACT=0,3"},
{"查询当前端口模式 > AT+GTUSBMODE?":"AT+GTUSBMODE?"},
{"RNDIS拨号模式40 > AT+GTUSBMODE=40":"AT+GTUSBMODE=40"},
{"RNDIS拨号模式41 > AT+GTUSBMODE=41":"AT+GTUSBMODE=41"},
{"锁4G > AT+GTACT=2":"AT+GTACT=2"},
{"锁5G > AT+GTACT=14":"AT+GTACT=14"},
{"恢复自动搜索网络 > AT+GTACT=20":"AT+GTACT=20"},
{"查询当前连接的网络类型 > AT+PSRAT?":"AT+PSRAT?"},
{"查询载波聚合小区信息 > AT+GTCAINFO?":"AT+GTCAINFO?"},
{"查询模组IMEI > AT+GTSN=0,7":"AT+GTSN=0,7"},
{"更改模组IMEI > AT+GTSN=1,7,\"IMEI\"":"AT+GTSN=1,7,\"在此设置IMEI\""},
{"解锁FCC > AT+GTFCCLOCKMODE=0":"AT+GTFCCLOCKMODE=0"},
{"解除ESIM锁定 > AT+GTESIMCFG=0,0,0":"AT+GTESIMCFG=0,0,0"},
{"解除温控 > AT+GTTHERMAL=0":"AT+GTTHERMAL=0"},
{"获取当前温度 > AT+GTSENRDTEMP=0":"AT+GTSENRDTEMP=0"},
{"重启模组 > AT+CFUN=15":"AT+CFUN=15"}
]
},
"meig":{
"qualcomm":[
{"SIM卡状态上报 > AT^SIMSLOTURC=1":"AT^SIMSLOTURC=1"},
{"获取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=3":"AT^CELLINFO=3"},
{"查询当前拨号模式 > AT+SER?":"AT+SER?"},
{"QMI/GobiNet拨号模式 > AT+SER=1,1":"AT+SER=1,1"},
{"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=2,1":"AT+SER=2,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+TEMP":"AT+TEMP"},
{"重启模组 > AT+RESET":"AT+RESET"}
]
}
}
}

View File

@ -1,64 +0,0 @@
{
"quick_commands":[
{"****************通用****************":"ATI"},
{"模组信息 > ATI":"ATI"},
{"查询SIM卡状态 > AT+CPIN?":"AT+CPIN?"},
{"查询网络信号质量4G > AT+CSQ":"AT+CSQ"},
{"查询网络信号质量5G > AT+CESQ":"AT+CESQ"},
{"查询网络信息 > AT+COPS?":"AT+COPS?"},
{"查询PDP信息 > AT+CGDCONT?":"AT+CGDCONT?"},
{"查询PDP地址 > AT+CGPADDR":"AT+CGPADDR"},
{"最小功能模式 > AT+CFUN=0":"AT+CFUN=0"},
{"全功能模式 > AT+CFUN=1":"AT+CFUN=1"},
{"重启模组 > AT+CFUN=1,1":"AT+CFUN=1,1"},
{"****************移远****************":"ATI"},
{"SIM卡状态上报 > AT+QSIMSTAT?":"AT+QSIMSTAT?"},
{"设置当前使用的为卡1 > AT+QUIMSLOT=1":"AT+QUIMSLOT=1"},
{"设置当前使用的为卡2 > AT+QUIMSLOT=2":"AT+QUIMSLOT=2"},
{"查询网络信息 > AT+QNWINFO":"AT+QNWINFO"},
{"查询载波聚合参数 > AT+QCAINFO":"AT+QCAINFO"},
{"查询当前拨号模式 > AT+QCFG=\"usbnet\"":"AT+QCFG=\"usbnet\""},
{"QMI/GobiNet拨号 > AT+QCFG=\"usbnet\",0":"AT+QCFG=\"usbnet\",0"},
{"ECM拨号 > AT+QCFG=\"usbnet\",1":"AT+QCFG=\"usbnet\",1"},
{"MBIM拨号 > AT+QCFG=\"usbnet\",2":"AT+QCFG=\"usbnet\",2"},
{"RNDIS拨号 > AT+QCFG=\"usbnet\",3":"AT+QCFG=\"usbnet\",3"},
{"NCM拨号 > AT+QCFG=\"usbnet\",5":"AT+QCFG=\"usbnet\",5"},
{"锁4G > AT+QNWPREFCFG=\"mode_pref\",LTE":"AT+QNWPREFCFG=\"mode_pref\",LTE"},
{"锁5G > AT+QNWPREFCFG=\"mode_pref\",NR5G":"AT+QNWPREFCFG=\"mode_pref\",NR5G"},
{"锁5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"},
{"锁5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"},
{"恢复自动搜索网络 > AT+QNWPREFCFG=\"mode_pref\",AUTO":"AT+QNWPREFCFG=\"mode_pref\",AUTO"},
{"查询模组IMEI > AT+CGSN":"AT+CGSN"},
{"查询模组IMEI > AT+GSN":"AT+GSN"},
{"更改模组IMEI > AT+EGMR=1,7,\"IMEI\"":"AT+EGMR=1,7,\"在此设置IMEI\""},
{"获取模组温度 > AT+QTEMP":"AT+QTEMP"},
{"切换为USB通信端口 > AT+QCFG=\"data_interface\",0,0":"AT+QCFG=\"data_interface\",0,0"},
{"切换为PCIE通信端口 > AT+QCFG=\"data_interface\",1,0":"AT+QCFG=\"data_interface\",1,0"},
{"查看当前USB速率 > AT+QCFG=\"usbspeed\"":"AT+QCFG=\"usbspeed\""},
{"切换为USB2.0 > AT+QCFG=\"usbspeed\",\"20\"":"AT+QCFG=\"usbspeed\",\"20\""},
{"切换为USB3.1 Gen15Gbps > AT+QCFG=\"usbspeed\",\"311\"":"AT+QCFG=\"usbspeed\",\"311\""},
{"切换为USB3.1 Gen110Gbps > AT+QCFG=\"usbspeed\",\"312\"":"AT+QCFG=\"usbspeed\",\"312\""},
{"重置模组 > AT+QCFG=\"ResetFactory\"":"AT+QCFG=\"ResetFactory\""},
{"****************广和通****************":"ATI"},
{"设置当前使用的为卡1 > AT+GTDUALSIM=0":"AT+GTDUALSIM=0"},
{"设置当前使用的为卡2 > AT+GTDUALSIM=1":"AT+GTDUALSIM=1"},
{"ECM手动拨号 > AT+GTRNDIS=1,1":"AT+GTRNDIS=1,1"},
{"ECM拨号断开 > AT+GTRNDIS=0,1":"AT+GTRNDIS=0,1"},
{"查询当前端口模式 > AT+GTUSBMODE?":"AT+GTUSBMODE?"},
{"QMI/GobiNet拨号 > AT+GTUSBMODE=32":"AT+GTUSBMODE=32"},
{"ECM拨号 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"},
{"MBIM拨号 > AT+GTUSBMODE=30":"AT+GTUSBMODE=30"},
{"RNDIS拨号 > AT+GTUSBMODE=24":"AT+GTUSBMODE=24"},
{"NCM拨号 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"},
{"锁4G > AT+GTACT=2":"AT+GTACT=2"},
{"锁5G > AT+GTACT=14":"AT+GTACT=14"},
{"恢复自动搜索网络 > AT+GTACT=20":"AT+GTACT=20"},
{"查询当前连接的网络类型 > AT+PSRAT?":"AT+PSRAT?"},
{"查询模组IMEI > AT+CGSN?":"AT+CGSN?"},
{"查询模组IMEI > AT+GSN?":"AT+GSN?"},
{"更改模组IMEI > AT+GTSN=1,7,\"IMEI\"":"AT+GTSN=1,7,\"在此设置IMEI\""},
{"报告一次当前BBIC的温度 > AT+MTSM=1,6":"AT+MTSM=1,6"},
{"报告一次当前射频的温度 > AT+MTSM=1,7":"AT+MTSM=1,7"},
{"重置模组 > AT+CFUN=15":"AT+CFUN=15"}
]
}

View File

@ -7,6 +7,10 @@ SCRIPT_DIR="/usr/share/modem"
#预设
fibocom_presets()
{
#设置IPv6地址格式
at_command='AT+CGPIAF=1,0,0,0'
sh "${SCRIPT_DIR}/modem_at.sh" "$at_port" "$at_command"
#自动DHCP
at_command='AT+GTAUTODHCP=1'
sh "${SCRIPT_DIR}/modem_at.sh" "$at_port" "$at_command"
@ -270,6 +274,7 @@ fibocom_get_network_prefer()
# $2:网络偏好配置
fibocom_set_network_prefer()
{
local at_port="$1"
local network_prefer="$2"
#获取网络偏好数字
@ -306,7 +311,6 @@ fibocom_set_network_prefer()
esac
#设置模组
local at_port="$1"
at_command="AT+GTACT=$network_prefer_num"
sh ${SCRIPT_DIR}/modem_at.sh $at_port "$at_command"
}
@ -333,9 +337,16 @@ fibocom_get_temperature()
at_command="AT+MTSM=1,6"
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+MTSM: " | sed 's/+MTSM: //g' | sed 's/\r//g')
[ -z "$response" ] && {
#Fx160及以后型号
at_command="AT+GTLADC"
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "cpu" | awk -F' ' '{print $2}' | sed 's/\r//g')
response="${response:0:2}"
}
[ -z "$response" ] && {
#联发科平台
at_command="AT+GTSENRDTEMP=0"
at_command="AT+GTSENRDTEMP=1"
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+GTSENRDTEMP: " | awk -F',' '{print $2}' | sed 's/\r//g')
response="${response:0:2}"
}
@ -392,7 +403,7 @@ fibocom_base_info()
revision=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+CGMR: " | awk -F'"' '{print $2}')
#Mode拨号模式
mode=$(fibocom_get_mode $at_port | tr 'a-z' 'A-Z')
mode=$(fibocom_get_mode ${at_port} ${platform} | tr 'a-z' 'A-Z')
#Temperature温度
temperature=$(fibocom_get_temperature $at_port)
@ -525,7 +536,7 @@ fibocom_network_info()
[ -z "$network_type" ] && {
at_command='AT+COPS?'
rat_num=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+COPS:" | awk -F',' '{print $4}' | sed 's/\r//g')
local rat_num=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+COPS:" | awk -F',' '{print $4}' | sed 's/\r//g')
network_type=$(fibocom_get_rat ${rat_num})
}
@ -573,46 +584,36 @@ fibocom_get_band()
echo "$band"
}
#获取上行带宽
# $1:上行带宽数字
fibocom_get_ul_bandwidth()
#获取带宽
# $1:网络类型
# $2:带宽数字
fibocom_get_bandwidth()
{
local ul_bandwidth
case $1 in
"6") ul_bandwidth="1.4" ;;
"15"|"25"|"50"|"75"|"100") ul_bandwidth=$(( $1 / 5 )) ;;
esac
echo "$ul_bandwidth"
}
local network_type="$1"
local bandwidth_num="$2"
#获取下行带宽
# $1:下行带宽数字
fibocom_get_dl_bandwidth()
{
local dl_bandwidth
case $1 in
"6") ul_bandwidth="1.4" ;;
"15"|"25"|"50"|"75"|"100") ul_bandwidth=$(( $1 / 5 )) ;;
local bandwidth
case $network_type in
"LTE")
case $bandwidth_num in
"6") bandwidth="1.4" ;;
"15"|"25"|"50"|"75"|"100") bandwidth=$(( $bandwidth_num / 5 )) ;;
esac
;;
"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" ;;
esac
;;
esac
echo "$dl_bandwidth"
}
#获取NR下行带宽
# $1:下行带宽数字
fibocom_get_nr_dl_bandwidth()
{
local nr_dl_bandwidth
case $1 in
"0") nr_dl_bandwidth="5" ;;
"10"|"15"|"20"|"25"|"30"|"40"|"50"|"60"|"70"|"80"|"90"|"100"|"200"|"400") nr_dl_bandwidth="$1" ;;
esac
echo "$nr_dl_bandwidth"
echo "$bandwidth"
}
#获取信噪比
# $1:网络类型
# $2:信噪比数字
fibocom_get_sinr_num()
fibocom_get_sinr()
{
local sinr
case $1 in
@ -685,7 +686,6 @@ fibocom_cell_info()
{
debug "Fibocom cell info"
#RSRQRSRPSINR
at_command='AT+GTCCINFO?'
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command)
@ -714,9 +714,9 @@ fibocom_cell_info()
nr_band_num=$(echo "$response" | awk -F',' '{print $9}')
nr_band=$(fibocom_get_band "NR" ${nr_band_num})
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
nr_dl_bandwidth=$(fibocom_get_nr_dl_bandwidth ${nr_dl_bandwidth_num})
nr_dl_bandwidth=$(fibocom_get_bandwidth "NR" ${nr_dl_bandwidth_num})
nr_sinr_num=$(echo "$response" | awk -F',' '{print $11}')
nr_sinr=$(fibocom_get_sinr_num "NR" ${nr_sinr_num})
nr_sinr=$(fibocom_get_sinr "NR" ${nr_sinr_num})
nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
nr_rxlev=$(fibocom_get_rxlev "NR" ${nr_rxlev_num})
nr_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
@ -736,7 +736,7 @@ fibocom_cell_info()
endc_lte_band_num=$(echo "$response" | awk -F',' '{print $9}')
endc_lte_band=$(fibocom_get_band "LTE" ${endc_lte_band_num})
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
endc_lte_ul_bandwidth=$(fibocom_get_ul_bandwidth ${ul_bandwidth_num})
endc_lte_ul_bandwidth=$(fibocom_get_bandwidth "LTE" ${ul_bandwidth_num})
endc_lte_dl_bandwidth="$endc_lte_ul_bandwidth"
endc_lte_rssnr_num=$(echo "$response" | awk -F',' '{print $11}')
endc_lte_rssnr=$(fibocom_get_rssnr ${endc_lte_rssnr_num})
@ -756,9 +756,9 @@ fibocom_cell_info()
endc_nr_band_num=$(echo "$response" | awk -F',' '{print $9}')
endc_nr_band=$(fibocom_get_band "NR" ${endc_nr_band_num})
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
endc_nr_dl_bandwidth=$(fibocom_get_nr_dl_bandwidth ${nr_dl_bandwidth_num})
endc_nr_dl_bandwidth=$(fibocom_get_bandwidth "NR" ${nr_dl_bandwidth_num})
endc_nr_sinr_num=$(echo "$response" | awk -F',' '{print $11}')
endc_nr_sinr=$(fibocom_get_sinr_num "NR" ${endc_nr_sinr_num})
endc_nr_sinr=$(fibocom_get_sinr "NR" ${endc_nr_sinr_num})
endc_nr_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
endc_nr_rxlev=$(fibocom_get_rxlev "NR" ${endc_nr_rxlev_num})
endc_nr_rsrp_num=$(echo "$response" | awk -F',' '{print $13}')
@ -777,7 +777,7 @@ fibocom_cell_info()
lte_band_num=$(echo "$response" | awk -F',' '{print $9}')
lte_band=$(fibocom_get_band "LTE" ${lte_band_num})
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $10}')
lte_ul_bandwidth=$(fibocom_get_ul_bandwidth ${ul_bandwidth_num})
lte_ul_bandwidth=$(fibocom_get_bandwidth "LTE" ${ul_bandwidth_num})
lte_dl_bandwidth="$lte_ul_bandwidth"
lte_rssnr=$(echo "$response" | awk -F',' '{print $11}')
lte_rxlev_num=$(echo "$response" | awk -F',' '{print $12}')
@ -952,15 +952,17 @@ Fibocom_Cellinfo()
fi
}
#获取Fibocom模块信息
#获取广和通模组信息
# $1:AT串口
# $2:连接定义
# $2:平台
# $3:连接定义
get_fibocom_info()
{
debug "get fibocom info"
#设置AT串口
at_port="$1"
define_connect="$2"
platform="$2"
define_connect="$3"
#基本信息
fibocom_base_info

View File

@ -1,34 +0,0 @@
{
"quick_commands":[
{"模组信息 > ATI":"ATI"},
{"查询SIM卡状态 > AT+CPIN?":"AT+CPIN?"},
{"查询网络信号质量4G > AT+CSQ":"AT+CSQ"},
{"查询网络信号质量5G > AT+CESQ":"AT+CESQ"},
{"查询网络信息 > AT+COPS?":"AT+COPS?"},
{"查询PDP信息 > AT+CGDCONT?":"AT+CGDCONT?"},
{"查询PDP地址 > AT+CGPADDR":"AT+CGPADDR"},
{"最小功能模式 > AT+CFUN=0":"AT+CFUN=0"},
{"全功能模式 > AT+CFUN=1":"AT+CFUN=1"},
{"设置当前使用的为卡1 > AT+GTDUALSIM=0":"AT+GTDUALSIM=0"},
{"设置当前使用的为卡2 > AT+GTDUALSIM=1":"AT+GTDUALSIM=1"},
{"ECM手动拨号 > AT+GTRNDIS=1,1":"AT+GTRNDIS=1,1"},
{"ECM拨号断开 > AT+GTRNDIS=0,1":"AT+GTRNDIS=0,1"},
{"查询当前端口模式 > AT+GTUSBMODE?":"AT+GTUSBMODE?"},
{"QMI/GobiNet拨号 > AT+GTUSBMODE=32":"AT+GTUSBMODE=32"},
{"ECM拨号 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"},
{"MBIM拨号 > AT+GTUSBMODE=30":"AT+GTUSBMODE=30"},
{"RNDIS拨号 > AT+GTUSBMODE=24":"AT+GTUSBMODE=24"},
{"NCM拨号 > AT+GTUSBMODE=18":"AT+GTUSBMODE=18"},
{"锁4G > AT+GTACT=2":"AT+GTACT=2"},
{"锁5G > AT+GTACT=14":"AT+GTACT=14"},
{"恢复自动搜索网络 > AT+GTACT=20":"AT+GTACT=20"},
{"查询当前连接的网络类型 > AT+PSRAT?":"AT+PSRAT?"},
{"查询模组IMEI > AT+CGSN?":"AT+CGSN?"},
{"查询模组IMEI > AT+GSN?":"AT+GSN?"},
{"更改模组IMEI > AT+GTSN=1,7,\"IMEI\"":"AT+GTSN=1,7,\"在此设置IMEI\""},
{"报告一次当前BBIC的温度 > AT+MTSM=1,6":"AT+MTSM=1,6"},
{"报告一次当前射频的温度 > AT+MTSM=1,7":"AT+MTSM=1,7"},
{"重启模组 > AT+CFUN=1,1":"AT+CFUN=1,1"},
{"重置模组 > AT+CFUN=15":"AT+CFUN=15"}
]
}

View File

@ -0,0 +1,835 @@
#!/bin/sh
# Copyright (C) 2023 Siriling <siriling@qq.com>
#脚本目录
SCRIPT_DIR="/usr/share/modem"
#预设
meig_presets()
{
#关闭自动上报系统模式变化
at_command='AT^MODE=0'
sh "${SCRIPT_DIR}/modem_at.sh" "$at_port" "$at_command"
#关闭自动上报DS流量
at_command='AT^DSFLOWRPT=0,0,1'
sh "${SCRIPT_DIR}/modem_at.sh" "$at_port" "$at_command"
}
#获取DNS
# $1:AT串口
# $2:连接定义
meig_get_dns()
{
local at_port="$1"
local define_connect="$2"
[ -z "$define_connect" ] && {
define_connect="1"
}
local public_dns1_ipv4="223.5.5.5"
local public_dns2_ipv4="119.29.29.29"
local public_dns1_ipv6="2400:3200::1" #下一代互联网北京研究中心240C::6666阿里2400:3200::1腾讯2402:4e00::
local public_dns2_ipv6="2402:4e00::"
#获取DNS地址
at_command="AT+CGCONTRDP=${define_connect}"
local response=$(at ${at_port} ${at_command} | grep "+CGCONTRDP: " | grep -E '[0-9]+.[0-9]+.[0-9]+.[0-9]+' | sed -n '1p')
local ipv4_dns1=$(echo "${response}" | awk -F',' '{print $7}' | awk -F' ' '{print $1}')
[ -z "$ipv4_dns1" ] && {
ipv4_dns1="${public_dns1_ipv4}"
}
local ipv4_dns2=$(echo "${response}" | awk -F',' '{print $8}' | awk -F' ' '{print $1}')
[ -z "$ipv4_dns2" ] && {
ipv4_dns2="${public_dns2_ipv4}"
}
local ipv6_dns1=$(echo "${response}" | awk -F',' '{print $7}' | awk -F' ' '{print $2}')
[ -z "$ipv6_dns1" ] && {
ipv6_dns1="${public_dns1_ipv6}"
}
local ipv6_dns2=$(echo "${response}" | awk -F',' '{print $8}' | awk -F' ' '{print $2}' | sed 's/\r//g')
[ -z "$ipv6_dns2" ] && {
ipv6_dns2="${public_dns2_ipv6}"
}
dns="{
\"dns\":{
\"ipv4_dns1\":\"$ipv4_dns1\",
\"ipv4_dns2\":\"$ipv4_dns2\",
\"ipv6_dns1\":\"$ipv6_dns1\",
\"ipv6_dns2\":\"$ipv6_dns2\"
}
}"
echo "$dns"
}
#获取拨号模式
# $1:AT串口
# $2:平台
meig_get_mode()
{
local at_port="$1"
local platform="$2"
at_command="AT+SER?"
local mode_num=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+SER:" | sed 's/+SER: //g' | sed 's/\r//g')
if [ -z "$mode_num" ]; then
echo "unknown"
return
fi
#获取芯片平台
if [ -z "$platform" ]; then
local modem_number=$(uci -q get modem.@global[0].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
fi
local mode
case "$platform" in
"qualcomm")
case "$mode_num" in
"1") mode="qmi" ;; #-
# "1") mode="gobinet" ;;
"2") mode="ecm" ;;
"7") mode="mbim" ;;
"3") mode="rndis" ;;
"2") mode="ncm" ;;
*) mode="$mode_num" ;;
esac
;;
*)
mode="$mode_num"
;;
esac
echo "${mode}"
}
#设置拨号模式
# $1:AT串口
# $2:拨号模式配置
meig_set_mode()
{
local at_port="$1"
local mode_config="$2"
#获取芯片平台
local platform
local modem_number=$(uci -q get modem.@global[0].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_num
case "$platform" in
"qualcomm")
case "$mode_config" in
"qmi") mode_num="1" ;;
# "gobinet") mode_num="1" ;;
"ecm") mode_num="2" ;;
"mbim") mode_num="7" ;;
"rndis") mode_num="3" ;;
"ncm") mode_num="2" ;;
*) mode_num="1" ;;
esac
;;
*)
mode_num="1"
;;
esac
#设置模组
at_command="AT+SER=${mode_num},1"
sh ${SCRIPT_DIR}/modem_at.sh ${at_port} "${at_command}"
}
#获取网络偏好
# $1:AT串口
meig_get_network_prefer()
{
local at_port="$1"
at_command="AT^SYSCFGEX?"
local response=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "\^SYSCFGEX:" | awk -F'"' '{print $2}')
local network_prefer_3g="0";
local network_prefer_4g="0";
local network_prefer_5g="0";
#匹配不同的网络类型
local auto=$(echo "${response}" | grep "00")
if [ -n "$auto" ]; then
network_prefer_3g="1"
network_prefer_4g="1"
network_prefer_5g="1"
else
local wcdma=$(echo "${response}" | grep "02")
local lte=$(echo "${response}" | grep "03")
local nr=$(echo "${response}" | grep "04")
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
local network_prefer="{
\"network_prefer\":{
\"3G\":$network_prefer_3g,
\"4G\":$network_prefer_4g,
\"5G\":$network_prefer_5g
}
}"
echo "$network_prefer"
}
#设置网络偏好
# $1:AT串口
# $2:网络偏好配置
meig_set_network_prefer()
{
local at_port="$1"
local network_prefer="$2"
#获取网络偏好配置
local network_prefer_config
#获取选中的数量
local count=$(echo "$network_prefer" | grep -o "1" | wc -l)
#获取每个偏好的值
local network_prefer_3g=$(echo "$network_prefer" | jq -r '.["3G"]')
local network_prefer_4g=$(echo "$network_prefer" | jq -r '.["4G"]')
local network_prefer_5g=$(echo "$network_prefer" | jq -r '.["5G"]')
case "$count" in
"1")
if [ "$network_prefer_3g" = "1" ]; then
network_prefer_config="02"
elif [ "$network_prefer_4g" = "1" ]; then
network_prefer_config="03"
elif [ "$network_prefer_5g" = "1" ]; then
network_prefer_config="04"
fi
;;
"2")
if [ "$network_prefer_3g" = "1" ] && [ "$network_prefer_4g" = "1" ]; then
network_prefer_config="0302"
elif [ "$network_prefer_3g" = "1" ] && [ "$network_prefer_5g" = "1" ]; then
network_prefer_config="0402"
elif [ "$network_prefer_4g" = "1" ] && [ "$network_prefer_5g" = "1" ]; then
network_prefer_config="0403"
fi
;;
"3") network_prefer_config="00" ;;
*) network_prefer_config="00" ;;
esac
#设置模组
at_command='AT^SYSCFGEX="'${network_prefer_config}'",all,0,2,all,all,all,all,1'
sh ${SCRIPT_DIR}/modem_at.sh "${at_port}" "${at_command}"
}
#获取电压
# $1:AT串口
meig_get_voltage()
{
local at_port="$1"
# #Voltage电压
# at_command="AT+ADCREAD=0"
# local voltage=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+ADCREAD:" | awk -F' ' '{print $2}' | sed 's/\r//g')
# voltage=$(awk "BEGIN{ printf \"%.2f\", $voltage / 1000000 }" | sed 's/\.*0*$//')
# echo "${voltage}"
}
#获取温度
# $1:AT串口
meig_get_temperature()
{
local at_port="$1"
#Temperature温度
at_command="AT+TEMP"
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep 'TEMP: "cpu0-0-usr"' | awk -F'"' '{print $4}')
local temperature
if [ -n "$response" ]; then
temperature="${response}$(printf "\xc2\xb0")C"
fi
echo "${temperature}"
}
#获取连接状态
# $1:AT串口
# $2:连接定义
meig_get_connect_status()
{
local at_port="$1"
local define_connect="$2"
#默认值为1
[ -z "$define_connect" ] && {
define_connect="1"
}
at_command="AT+CGPADDR=${define_connect}"
local ipv4=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+CGPADDR: " | awk -F',' '{print $2}')
local not_ip="0.0.0.0"
#设置连接状态
local connect_status
if [ -z "$ipv4" ] || [[ "$ipv4" = *"$not_ip"* ]]; then
connect_status="disconnect"
else
connect_status="connect"
fi
echo "${connect_status}"
}
#基本信息
meig_base_info()
{
debug "meig base info"
#Name名称
at_command="AT+CGMM"
name=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+CGMM: " | awk -F': ' '{print $2}' | sed 's/\r//g')
#Manufacturer制造商
at_command="AT+CGMI"
manufacturer=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+CGMI: " | awk -F': ' '{print $2}' | sed 's/\r//g')
#Revision固件版本
at_command="AT+CGMR"
revision=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+CGMR: " | awk -F': ' '{print $2}' | sed 's/\r//g')
#Mode拨号模式
mode=$(meig_get_mode ${at_port} ${platform} | tr 'a-z' 'A-Z')
#Temperature温度
temperature=$(meig_get_temperature ${at_port})
}
#获取SIM卡状态
# $1:SIM卡状态标志
meig_get_sim_status()
{
local sim_status
case $1 in
"") sim_status="miss" ;;
*"ERROR"*) sim_status="miss" ;;
*"READY"*) sim_status="ready" ;;
*"SIM PIN"*) sim_status="MT is waiting SIM PIN to be given" ;;
*"SIM PUK"*) sim_status="MT is waiting SIM PUK to be given" ;;
*"PH-FSIM PIN"*) sim_status="MT is waiting phone-to-SIM card password to be given" ;;
*"PH-FSIM PIN"*) sim_status="MT is waiting phone-to-very first SIM card password to be given" ;;
*"PH-FSIM PUK"*) sim_status="MT is waiting phone-to-very first SIM card unblocking password to be given" ;;
*"SIM PIN2"*) sim_status="MT is waiting SIM PIN2 to be given" ;;
*"SIM PUK2"*) sim_status="MT is waiting SIM PUK2 to be given" ;;
*"PH-NET PIN"*) sim_status="MT is waiting network personalization password to be given" ;;
*"PH-NET PUK"*) sim_status="MT is waiting network personalization unblocking password to be given" ;;
*"PH-NETSUB PIN"*) sim_status="MT is waiting network subset personalization password to be given" ;;
*"PH-NETSUB PUK"*) sim_status="MT is waiting network subset personalization unblocking password to be given" ;;
*"PH-SP PIN"*) sim_status="MT is waiting service provider personalization password to be given" ;;
*"PH-SP PUK"*) sim_status="MT is waiting service provider personalization unblocking password to be given" ;;
*"PH-CORP PIN"*) sim_status="MT is waiting corporate personalization password to be given" ;;
*"PH-CORP PUK"*) sim_status="MT is waiting corporate personalization unblocking password to be given" ;;
*) sim_status="unknown" ;;
esac
echo "${sim_status}"
}
#SIM卡信息
meig_sim_info()
{
debug "meig sim info"
#SIM SlotSIM卡卡槽
at_command="AT^SIMSLOT?"
response=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "\^SIMSLOT:" | awk -F': ' '{print $2}' | awk -F',' '{print $2}')
if [ "$response" != "0" ]; then
sim_slot="1"
else
sim_slot="2"
fi
#IMEI国际移动设备识别码
at_command="AT+CGSN"
imei=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | sed -n '2p' | sed 's/\r//g')
#SIM StatusSIM状态
at_command="AT+CPIN?"
sim_status_flag=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+CPIN: ")
sim_status=$(meig_get_sim_status "$sim_status_flag")
if [ "$sim_status" != "ready" ]; then
return
fi
#ISP互联网服务提供商
at_command="AT+COPS?"
isp=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+COPS" | awk -F'"' '{print $2}')
# if [ "$isp" = "CHN-CMCC" ] || [ "$isp" = "CMCC" ]|| [ "$isp" = "46000" ]; then
# isp="中国移动"
# elif [ "$isp" = "CHN-UNICOM" ] || [ "$isp" = "UNICOM" ] || [ "$isp" = "46001" ]; then
# isp="中国联通"
# elif [ "$isp" = "CHN-CT" ] || [ "$isp" = "CT" ] || [ "$isp" = "46011" ]; then
# isp="中国电信"
# fi
#SIM NumberSIM卡号码手机号
at_command="AT+CNUM"
sim_number=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+CNUM: " | awk -F'"' '{print $2}')
[ -z "$sim_number" ] && {
sim_number=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+CNUM: " | awk -F'"' '{print $4}')
}
#IMSI国际移动用户识别码
at_command="AT+CIMI"
imsi=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#ICCID集成电路卡识别码
at_command="AT+ICCID"
iccid=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep -o "+ICCID:[ ]*[-0-9]\+" | grep -o "[-0-9]\{1,4\}")
}
#获取网络类型
# $1:网络类型数字
meig_get_rat()
{
local rat
case $1 in
"0"|"1"|"3"|"8") rat="GSM" ;;
"2"|"4"|"5"|"6"|"9"|"10") rat="WCDMA" ;;
"7") rat="LTE" ;;
"11"|"12") rat="NR" ;;
esac
echo "${rat}"
}
#获取信号强度指示4G
# $1:信号强度指示数字
meig_get_rssi()
{
local rssi
case $1 in
"99") rssi="unknown" ;;
* ) rssi=$((2 * $1 - 113)) ;;
esac
echo "$rssi"
}
#获取4G签约速率
# $1:AT响应
# $2:上行或下行标志
meig_get_lte_ambr()
{
local response="$1"
local flag="$2"
local ambr
case $flag in
"ul")
#使用awk拆分字符串
ambr=$(echo "$response" | awk -F',' '{
#使用split()函数将字符串拆分为数组
n = split($0, arr, ",")
#循环遍历每个值
for (i = 1; i <= n-2; i=i+2)
{
if (arr[i] != "0") {
tmp = arr[i]
}
else {
break
}
}
print tmp
}')
;;
"dl")
#使用awk拆分字符串
ambr=$(echo "$response" | awk -F',' '{
#使用split()函数将字符串拆分为数组
n = split($0, arr, ",")
#循环遍历每个值
for (i = 2; i <= n-2; i=i+2)
{
if (arr[i] != "0") {
tmp = arr[i]
}
else {
break
}
}
print tmp
}')
;;
* )
#使用awk拆分字符串
ambr=$(echo "$response" | awk -F',' '{
#使用split()函数将字符串拆分为数组
n = split($0, arr, ",")
#循环遍历每个值
for (i = 2; i <= n-2; i=i+2)
{
if (arr[i] != "0") {
tmp = arr[i]
}
else {
break
}
}
print tmp
}')
;;
esac
echo "$ambr"
}
#网络信息
meig_network_info()
{
debug "meig network info"
#Connect Status连接状态
connect_status=$(meig_get_connect_status ${at_port} ${define_connect})
if [ "$connect_status" != "connect" ]; then
return
fi
#Network Type网络类型
at_command="AT^SYSINFOEX"
network_type=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "\^SYSINFOEX:" | awk -F'"' '{print $4}')
[ -z "$network_type" ] && {
at_command='AT+COPS?'
local rat_num=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+COPS:" | awk -F',' '{print $4}' | sed 's/\r//g')
network_type=$(meig_get_rat ${rat_num})
}
#设置网络类型为5G时信号强度指示用RSRP代替
# at_command="AT+GTCSQNREN=1"
# sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command
#CSQ信号强度
at_command="AT+CSQ"
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+CSQ:" | sed 's/+CSQ: //g' | sed 's/\r//g')
#RSSI4G信号强度指示
# rssi_num=$(echo $response | awk -F',' '{print $1}')
# rssi=$(meig_get_rssi $rssi_num)
#BER4G信道误码率
# ber=$(echo $response | awk -F',' '{print $2}')
# #PER信号强度
# if [ -n "$csq" ]; then
# per=$(($csq * 100/31))"%"
# fi
#最大比特率,信道质量指示
at_command="AT^DSAMBR=${define_connect}"
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "\^DSAMBR:" | awk -F': ' '{print $2}')
at_command='AT+COPS?'
local rat_num=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+COPS:" | awk -F',' '{print $4}' | sed 's/\r//g')
local network_type_tmp=$(meig_get_rat ${rat_num})
case $network_type_tmp in
"LTE")
ambr_ul_tmp=$(meig_get_lte_ambr ${response} "ul")
ambr_dl_tmp=$(meig_get_lte_ambr ${response} "dl")
;;
"NR")
ambr_ul_tmp=$(echo "$response" | awk -F',' '{print $9}')
ambr_dl_tmp=$(echo "$response" | awk -F',' '{print $10}' | sed 's/\r//g')
;;
*)
ambr_ul_tmp=$(meig_get_lte_ambr ${response} "ul")
ambr_dl_tmp=$(meig_get_lte_ambr ${response} "dl")
;;
esac
#AMBR UL上行签约速率单位Mbps
ambr_ul=$(awk "BEGIN{ printf \"%.2f\", $ambr_ul_tmp / 1024 }" | sed 's/\.*0*$//')
#AMBR DL下行签约速率单位Mbps
ambr_dl=$(awk "BEGIN{ printf \"%.2f\", $ambr_dl_tmp / 1024 }" | sed 's/\.*0*$//')
# #速率统计
# at_command='AT^DSFLOWQRY'
# response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "\^DSFLOWRPT:" | sed 's/\^DSFLOWRPT: //g' | sed 's/\r//g')
# #当前上传速率单位Byte/s
# tx_rate=$(echo $response | awk -F',' '{print $1}')
# #当前下载速率单位Byte/s
# rx_rate=$(echo $response | awk -F',' '{print $2}')
}
#获取频段
# $1:网络类型
# $2:频段数字
meig_get_band()
{
local band
case $1 in
"WCDMA") band="$2" ;;
"LTE") band="$2" ;;
"NR") band="$2" ;;
esac
echo "$band"
}
#获取带宽
# $1:网络类型
# $2:带宽数字
meig_get_bandwidth()
{
local network_type="$1"
local bandwidth_num="$2"
local bandwidth
case $network_type in
"LTE") bandwidth=$(( $bandwidth_num / 5 )) ;;
"NR") bandwidth="$bandwidth_num" ;;
esac
echo "$bandwidth"
}
#获取参考信号接收功率
# $1:网络类型
# $2:参考信号接收功率数字
meig_get_rsrp()
{
local rsrp
case $1 in
"LTE") rsrp=$(($2-141)) ;;
"NR") rsrp=$(($2-157)) ;;
esac
echo "$rsrp"
}
#获取参考信号接收质量
# $1:网络类型
# $2:参考信号接收质量数字
meig_get_rsrq()
{
local rsrq
case $1 in
"LTE") rsrq=$(awk "BEGIN{ printf \"%.2f\", $2 * 0.5 - 20 }" | sed 's/\.*0*$//') ;;
"NR") rsrq=$(awk -v num="$2" "BEGIN{ printf \"%.2f\", (num+1) * 0.5 - 44 }" | sed 's/\.*0*$//') ;;
esac
echo "$rsrq"
}
#获取信噪比
# $1:信噪比数字
meig_get_sinr()
{
local sinr=$(awk "BEGIN{ printf \"%.2f\", $1 / 10 }" | sed 's/\.*0*$//')
echo "$sinr"
}
#小区信息
meig_cell_info()
{
debug "Meig cell info"
at_command="AT^CELLINFO=${define_connect}"
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "\^CELLINFO:" | sed 's/\^CELLINFO://')
local rat=$(echo "$response" | awk -F',' '{print $1}')
case $rat in
"5G")
network_mode="NR5G-SA Mode"
nr_duplex_mode=$(echo "$response" | awk -F',' '{print $2}')
nr_mcc=$(echo "$response" | awk -F',' '{print $3}')
nr_mnc=$(echo "$response" | awk -F',' '{print $4}')
nr_cell_id=$(echo "$response" | awk -F',' '{print $5}')
nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $6}')
nr_tac=$(echo "$response" | awk -F',' '{print $7}')
nr_band_num=$(echo "$response" | awk -F',' '{print $8}')
nr_band=$(meig_get_band "NR" ${nr_band_num})
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $9}')
nr_dl_bandwidth=$(meig_get_bandwidth "NR" ${nr_dl_bandwidth_num})
nr_scs=$(echo "$response" | awk -F',' '{print $10}')
nr_fr_type=$(echo "$response" | awk -F',' '{print $11}')
nr_dl_channel=$(echo "$response" | awk -F',' '{print $12}')
nr_ul_channel=$(echo "$response" | awk -F',' '{print $13}')
nr_rssi=$(echo "$response" | awk -F',' '{print $14}')
nr_rsrp=$(echo "$response" | awk -F',' '{print $15}')
nr_rsrq=$(echo "$response" | awk -F',' '{print $16}')
nr_sinr_num=$(echo "$response" | awk -F',' '{print $17}')
nr_sinr=$(meig_get_sinr ${nr_sinr_num})
nr_vonr=$(echo "$response" | awk -F',' '{print $18}' | sed 's/\r//g')
;;
"LTE-NR")
network_mode="EN-DC Mode"
#LTE
endc_lte_duplex_mode=$(echo "$response" | awk -F',' '{print $2}')
endc_lte_mcc=$(echo "$response" | awk -F',' '{print $3}')
endc_lte_mnc=$(echo "$response" | awk -F',' '{print $4}')
endc_lte_global_cell_id=$(echo "$response" | awk -F',' '{print $5}')
endc_lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $6}')
# endc_lte_eNBID=$(echo "$response" | awk -F',' '{print $7}')
endc_lte_cell_id=$(echo "$response" | awk -F',' '{print $8}')
endc_lte_tac=$(echo "$response" | awk -F',' '{print $9}')
endc_lte_band_num=$(echo "$response" | awk -F',' '{print $10}')
endc_lte_band=$(meig_get_band "LTE" ${endc_lte_band_num})
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $11}')
endc_lte_ul_bandwidth=$(meig_get_bandwidth "LTE" ${ul_bandwidth_num})
endc_lte_dl_bandwidth="$endc_lte_ul_bandwidth"
endc_lte_dl_channel=$(echo "$response" | awk -F',' '{print $12}')
endc_lte_ul_channel=$(echo "$response" | awk -F',' '{print $13}')
endc_lte_rssi=$(echo "$response" | awk -F',' '{print $14}')
endc_lte_rsrp=$(echo "$response" | awk -F',' '{print $15}')
endc_lte_rsrq=$(echo "$response" | awk -F',' '{print $16}')
endc_lte_sinr_num=$(echo "$response" | awk -F',' '{print $17}')
endc_lte_sinr=$(meig_get_sinr ${endc_lte_sinr_num})
endc_lte_rssnr=$(echo "$response" | awk -F',' '{print $18}')
# endc_lte_ue_category=$(echo "$response" | awk -F',' '{print $19}')
# endc_lte_pathloss=$(echo "$response" | awk -F',' '{print $20}')
# endc_lte_cqi=$(echo "$response" | awk -F',' '{print $21}')
endc_lte_tx_power=$(echo "$response" | awk -F',' '{print $22}')
# endc_lte_tm=$(echo "$response" | awk -F',' '{print $23}')
# endc_lte_qci=$(echo "$response" | awk -F',' '{print $24}')
# endc_lte_volte=$(echo "$response" | awk -F',' '{print $25}')
# endc_lte_ims_sms=$(echo "$response" | awk -F',' '{print $26}')
# endc_lte_sib2_plmn_r15_info_present=$(echo "$response" | awk -F',' '{print $27}')
# endc_lte_sib2_upr_layer_ind=$(echo "$response" | awk -F',' '{print $28}')
# endc_lte_restrict_dcnr=$(echo "$response" | awk -F',' '{print $29}')
#NR5G-NSA
endc_nr_mcc=$(echo "$response" | awk -F',' '{print $3}')
endc_nr_mnc=$(echo "$response" | awk -F',' '{print $4}')
endc_nr_global_cell_id=$(echo "$response" | awk -F',' '{print $5}')
endc_nr_physical_cell_id=$(echo "$response" | awk -F',' '{print $6}')
endc_nr_cell_id=$(echo "$response" | awk -F',' '{print $8}')
endc_nr_tac=$(echo "$response" | awk -F',' '{print $9}')
endc_nr_rsrp=$(echo "$response" | awk -F',' '{print $30}')
endc_nr_rsrq=$(echo "$response" | awk -F',' '{print $31}')
endc_nr_sinr_num=$(echo "$response" | awk -F',' '{print $32}')
endc_nr_sinr=$(meig_get_sinr ${endc_nr_sinr_num})
endc_nr_band_num=$(echo "$response" | awk -F',' '{print $33}')
endc_nr_band=$(meig_get_band "NR" ${endc_nr_band_num})
endc_nr_freq=$(echo "$response" | awk -F',' '{print $34}')
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $35}')
endc_nr_dl_bandwidth=$(meig_get_bandwidth "NR" ${nr_dl_bandwidth_num})
# endc_nr_pci=$(echo "$response" | awk -F',' '{print $36}')
endc_nr_scs=$(echo "$response" | awk -F',' '{print $37}' | sed 's/\r//g')
;;
"LTE"|"eMTC"|"NB-IoT")
network_mode="LTE Mode"
lte_duplex_mode=$(echo "$response" | awk -F',' '{print $2}')
lte_mcc=$(echo "$response" | awk -F',' '{print $3}')
lte_mnc=$(echo "$response" | awk -F',' '{print $4}')
lte_global_cell_id=$(echo "$response" | awk -F',' '{print $5}')
lte_physical_cell_id=$(echo "$response" | awk -F',' '{print $6}')
lte_eNBID=$(echo "$response" | awk -F',' '{print $7}')
lte_cell_id=$(echo "$response" | awk -F',' '{print $8}')
let_tac=$(echo "$response" | awk -F',' '{print $9}')
# lte_earfcn=$(echo "$response" | awk -F',' '{print $7}')
lte_band_num=$(echo "$response" | awk -F',' '{print $10}')
lte_band=$(meig_get_band "LTE" ${lte_band_num})
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $11}')
lte_ul_bandwidth=$(meig_get_bandwidth "LTE" ${ul_bandwidth_num})
lte_dl_bandwidth="$lte_ul_bandwidth"
lte_dl_channel=$(echo "$response" | awk -F',' '{print $12}')
lte_ul_channel=$(echo "$response" | awk -F',' '{print $13}')
lte_rssi=$(echo "$response" | awk -F',' '{print $14}')
lte_rsrp=$(echo "$response" | awk -F',' '{print $15}')
lte_rsrq=$(echo "$response" | awk -F',' '{print $16}')
lte_sinr_num=$(echo "$response" | awk -F',' '{print $17}')
lte_sinr=$(meig_get_sinr ${lte_sinr_num})
lte_rssnr=$(echo "$response" | awk -F',' '{print $18}')
# lte_ue_category=$(echo "$response" | awk -F',' '{print $19}')
# lte_pathloss=$(echo "$response" | awk -F',' '{print $20}')
# lte_cqi=$(echo "$response" | awk -F',' '{print $21}')
lte_tx_power=$(echo "$response" | awk -F',' '{print $22}')
# lte_tm=$(echo "$response" | awk -F',' '{print $23}')
# lte_qci=$(echo "$response" | awk -F',' '{print $24}')
# lte_volte=$(echo "$response" | awk -F',' '{print $25}')
# lte_ims_sms=$(echo "$response" | awk -F',' '{print $26}')
# lte_sib2_plmn_r15_info_present=$(echo "$response" | awk -F',' '{print $27}')
# lte_sib2_upr_layer_ind=$(echo "$response" | awk -F',' '{print $28}')
# lte_restrict_dcnr=$(echo "$response" | awk -F',' '{print $29}' | sed 's/\r//g')
;;
"WCDMA"|"UMTS")
network_mode="WCDMA Mode"
wcdma_mcc=$(echo "$response" | awk -F',' '{print $2}')
wcdma_mnc=$(echo "$response" | awk -F',' '{print $3}')
wcdma_global_cell_id=$(echo "$response" | awk -F',' '{print $4}')
wcdma_psc=$(echo "$response" | awk -F',' '{print $5}')
wcdma_NodeB=$(echo "$response" | awk -F',' '{print $6}')
wcdma_cell_id=$(echo "$response" | awk -F',' '{print $7}')
wcdma_lac=$(echo "$response" | awk -F',' '{print $8}')
wcdma_band_num=$(echo "$response" | awk -F',' '{print $9}')
wcdma_band=$(meig_get_band "WCDMA" ${wcdma_band_num})
wcdma_dl_channel=$(echo "$response" | awk -F',' '{print $10}')
wcdma_ul_channel=$(echo "$response" | awk -F',' '{print $11}')
wcdma_rssi=$(echo "$response" | awk -F',' '{print $12}')
wcdma_ecio=$(echo "$response" | awk -F',' '{print $13}')
# wcdma_sir=$(echo "$response" | awk -F',' '{print $14}')
wcdma_rscp=$(echo "$response" | awk -F',' '{print $15}' | sed 's/\r//g')
;;
"GSM")
network_mode="GSM Mode"
gsm_mcc=$(echo "$response" | awk -F',' '{print $3}')
gsm_mnc=$(echo "$response" | awk -F',' '{print $4}')
;;
esac
}
#获取美格模组信息
# $1:AT串口
# $2:平台
# $3:连接定义
get_meig_info()
{
debug "get meig info"
#设置AT串口
at_port="$1"
platform="$2"
define_connect="$3"
#基本信息
meig_base_info
#SIM卡信息
meig_sim_info
if [ "$sim_status" != "ready" ]; then
return
fi
#网络信息
meig_network_info
if [ "$connect_status" != "connect" ]; then
return
fi
#小区信息
meig_cell_info
}

View File

@ -6,6 +6,7 @@ SCRIPT_DIR="/usr/share/modem"
source "${SCRIPT_DIR}/quectel.sh"
source "${SCRIPT_DIR}/fibocom.sh"
source "${SCRIPT_DIR}/meig.sh"
# source "${SCRIPT_DIR}/simcom.sh"
#调试开关

View File

@ -4,9 +4,6 @@
#脚本目录
SCRIPT_DIR="/usr/share/modem"
source "${SCRIPT_DIR}/modem_debug.sh"
# source "${SCRIPT_DIR}/quectel.sh"
# source "${SCRIPT_DIR}/fibocom.sh"
# source "${SCRIPT_DIR}/simcom.sh"
#初值化数据结构
init_modem_info()
@ -370,9 +367,10 @@ get_modem_info()
debug "根据模组的制造商获取信息"
#更多信息获取
case $manufacturer in
"quectel") get_quectel_info "${at_port}" "${define_connect}" ;;
"fibocom") get_fibocom_info "${at_port}" "${define_connect}" ;;
"simcom") get_simcom_info "${at_port}" "${define_connect}" ;;
"quectel") get_quectel_info "${at_port}" "${platform}" "${define_connect}" ;;
"fibocom") get_fibocom_info "${at_port}" "${platform}" "${define_connect}" ;;
"meig") get_meig_info "${at_port}" "${platform}" "${define_connect}" ;;
"simcom") get_simcom_info "${at_port}" "${platform}" "${define_connect}" ;;
*) debug "未适配该模组" ;;
esac
@ -383,7 +381,8 @@ get_modem_info()
#获取模组数据信息
# $1:AT串口
# $2:制造商
# $3:连接定义
# $3:平台
# $4:连接定义
modem_info()
{
#初值化模组信息
@ -394,7 +393,8 @@ modem_info()
#获取模组信息
at_port="$1"
manufacturer="$2"
define_connect="$3"
platform="$3"
define_connect="$4"
debug "获取模组信息"
get_modem_info
@ -402,9 +402,6 @@ modem_info()
#整合模块信息
info_to_json
echo $modem_info
#移动网络联网检查
# checkMobileNetwork
}
modem_info "$1" "$2" "$3"
modem_info "$1" "$2" "$3" "$4"

View File

@ -86,6 +86,8 @@ gobinet_dial()
at_command='ATI'
elif [ "$manufacturer" = "fibocom" ]; then
at_command='AT$QCRMCALL=1,3'
elif [ "$manufacturer" = "meig" ]; then
at_command="ATI"
else
at_command='ATI'
fi
@ -119,6 +121,8 @@ ecm_dial()
at_command="AT+QNETDEVCTL=${define_connect},3,1"
elif [ "$manufacturer" = "fibocom" ]; then
at_command="AT+GTRNDIS=1,${define_connect}"
elif [ "$manufacturer" = "meig" ]; then
at_command="AT$QCRMCALL=1,1,${define_connect},2,1"
else
at_command='ATI'
fi
@ -157,7 +161,7 @@ rndis_dial()
sleep 3s
else
#拨号
ecm_dial "${at_port}" "${manufacturer}"
ecm_dial "${at_port}" "${manufacturer}" "${define_connect}"
fi
}
@ -223,7 +227,7 @@ modem_network_task()
#网络连接检查
local at_command="AT+CGPADDR=${define_connect}"
local ipv4=$(at ${at_port} ${at_command} | grep "+CGPADDR: " | awk -F'"' '{print $2}')
local ipv4=$(at ${at_port} ${at_command} | grep "+CGPADDR: " | awk -F',' '{print $2}' | sed 's/"//g')
if [ -z "$ipv4" ]; then

View File

@ -57,6 +57,14 @@
"define_connect":"1",
"modes":["qmi","gobinet","ecm","mbim","rndis","ncm"]
},
"rm505q-ae":{
"manufacturer_id":"2c7c",
"manufacturer":"quectel",
"platform":"qualcomm",
"data_interface":"usb",
"define_connect":"1",
"modes":["qmi","gobinet","ecm","mbim","rndis","ncm"]
},
"rm520n-cn":{
"manufacturer_id":"2c7c",
"manufacturer":"quectel",
@ -111,7 +119,7 @@
"platform":"qualcomm",
"data_interface":"usb",
"define_connect":"1",
"modes":["qmi","gobinet","ecm","mbim","rndis"]
"modes":["ecm","rndis","ncm"]
},
"srm825":{
"manufacturer_id":"2dee",
@ -119,7 +127,15 @@
"platform":"qualcomm",
"data_interface":"usb",
"define_connect":"1",
"modes":["qmi","gobinet","ecm","mbim","rndis"]
"modes":["ecm","rndis","ncm"]
},
"srm825n":{
"manufacturer_id":"2dee",
"manufacturer":"meig",
"platform":"qualcomm",
"data_interface":"usb",
"define_connect":"1",
"modes":["ecm","rndis","ncm"]
}
},
"pcie":{

View File

@ -394,6 +394,12 @@ retry_set_modem_config()
local at_command="AT+CGMM?"
local modem_name=$(at ${at_port} ${at_command} | grep "+CGMM: " | awk -F'"' '{print $2}' | tr 'A-Z' 'a-z')
#再一次获取模组名称
[ -z "$modem_name" ] && {
at_command="AT+CGMM"
modem_name=$(at ${at_port} ${at_command} | grep "+CGMM: " | awk -F': ' '{print $2}' | sed 's/\r//g' | tr 'A-Z' 'a-z')
}
#再一次获取模组名称
[ -z "$modem_name" ] && {
at_command="AT+CGMM"
@ -408,7 +414,7 @@ retry_set_modem_config()
#获取模组信息
local data_interface=$(uci -q get modem.modem${modem_no}.data_interface)
local modem_info=$(echo ${modem_support} | jq '.modem_support.'$data_interface'."'$modem_name'"')
[ -n "$modem_name" ] && [ "$modem_info" != "null" ] && {
#获取制造商

View File

@ -185,18 +185,18 @@ quectel_get_network_prefer()
local network_prefer_5g="0";
#匹配不同的网络类型
local auto=$(echo $response | grep "AUTO")
local auto=$(echo "${response}" | grep "AUTO")
if [ -n "$auto" ]; then
network_prefer_3g="1"
network_prefer_4g="1"
network_prefer_5g="1"
else
local wcdma=$(echo $response | grep "WCDMA")
local lte=$(echo $response | grep "LTE")
local nr=$(echo $response | grep "NR5G")
local wcdma=$(echo "${response}" | grep "WCDMA")
local lte=$(echo "${response}" | grep "LTE")
local nr=$(echo "${response}" | grep "NR5G")
if [ -n "$wcdma" ]; then
network_prefer_3g="1"
fi
fi
if [ -n "$lte" ]; then
network_prefer_4g="1"
fi
@ -220,6 +220,7 @@ quectel_get_network_prefer()
# $2:网络偏好配置
quectel_set_network_prefer()
{
local at_port="$1"
local network_prefer="$2"
#获取网络偏好配置
@ -256,7 +257,6 @@ quectel_set_network_prefer()
esac
#设置模组
local at_port="$1"
at_command='AT+QNWPREFCFG="mode_pref",'${network_prefer_config}
sh ${SCRIPT_DIR}/modem_at.sh "${at_port}" "${at_command}"
}
@ -269,7 +269,7 @@ quectel_get_voltage()
#Voltage电压
at_command="AT+CBC"
local voltage=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+CBC:" | awk -F',' '{print $3}' | sed 's/\r//g')
local voltage=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+CBC:" | awk -F',' '{print $3}' | sed 's/\r//g')
echo "${voltage}"
}
@ -281,14 +281,20 @@ quectel_get_temperature()
#Temperature温度
at_command="AT+QTEMP"
response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | sed -n '2p' | awk -F'"' '{print $4}')
local line=1
while true; do
response=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+QTEMP:" | sed -n "${line}p" | awk -F'"' '{print $4}')
[ $response -gt 0 ] && break
line=$((line+1))
done
local temperature
if [ -n "$response" ]; then
temperature="$response$(printf "\xc2\xb0")C"
temperature="${response}$(printf "\xc2\xb0")C"
fi
# response=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep "+QTEMP:")
# response=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+QTEMP:")
# QTEMP=$(echo $response | grep -o -i "+QTEMP: [0-9]\{1,3\}")
# if [ -z "$QTEMP" ]; then
# QTEMP=$(echo $response | grep -o -i "+QTEMP:[ ]\?\"XO[_-]THERM[_-][^,]\+,[\"]\?[0-9]\{1,3\}" | grep -o "[0-9]\{1,3\}")
@ -366,10 +372,10 @@ quectel_base_info()
# revision=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | sed -n '2p' | sed 's/\r//g')
#Mode拨号模式
mode=$(quectel_get_mode $at_port | tr 'a-z' 'A-Z')
mode=$(quectel_get_mode ${at_port} ${platform} | tr 'a-z' 'A-Z')
#Temperature温度
temperature=$(quectel_get_temperature $at_port)
temperature=$(quectel_get_temperature ${at_port})
}
#获取SIM卡状态
@ -448,6 +454,20 @@ quectel_sim_info()
# iccid=$(sh ${SCRIPT_DIR}/modem_at.sh $at_port $at_command | grep -o "+ICCID:[ ]*[-0-9]\+" | grep -o "[-0-9]\{1,4\}")
}
#获取网络类型
# $1:网络类型数字
quectel_get_rat()
{
local rat
case $1 in
"0"|"1"|"3"|"8") rat="GSM" ;;
"2"|"4"|"5"|"6"|"9"|"10") rat="WCDMA" ;;
"7") rat="LTE" ;;
"11"|"12") rat="NR" ;;
esac
echo "${rat}"
}
#获取信号强度指示
# $1:信号强度指示数字
quectel_get_rssi()
@ -472,10 +492,15 @@ quectel_network_info()
fi
#Network Type网络类型
# at_command="AT+COPS?"
at_command="AT+QNWINFO"
network_type=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+QNWINFO:" | awk -F'"' '{print $2}')
[ -z "$network_type" ] && {
at_command='AT+COPS?'
local rat_num=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+COPS:" | awk -F',' '{print $4}' | sed 's/\r//g')
network_type=$(quectel_get_rat ${rat_num})
}
#CSQ信号强度
at_command="AT+CSQ"
response=$(sh ${SCRIPT_DIR}/modem_at.sh ${at_port} ${at_command} | grep "+CSQ:" | sed 's/+CSQ: //g' | sed 's/\r//g')
@ -534,44 +559,33 @@ quectel_get_band()
echo "$band"
}
#UL_bandwidth
# $1:上行带宽数字
quectel_get_lte_ul_bandwidth()
#获取带宽
# $1:网络类型
# $2:带宽数字
quectel_get_bandwidth()
{
local ul_bandwidth
case $1 in
"0") ul_bandwidth="1.4" ;;
"1") ul_bandwidth="3" ;;
"2"|"3"|"4"|"5") ul_bandwidth=$((($1 - 1) * 5)) ;;
esac
echo "$ul_bandwidth"
}
local network_type="$1"
local bandwidth_num="$2"
#DL_bandwidth
# $1:下行带宽数字
quectel_get_lte_dl_bandwidth()
{
local dl_bandwidth
case $1 in
"0") dl_bandwidth="1.4" ;;
"1") dl_bandwidth="3" ;;
"2"|"3"|"4"|"5") dl_bandwidth=$((($1 - 1) * 5)) ;;
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 "$dl_bandwidth"
}
#NR_DL_bandwidth
# $1:下行带宽数字
quectel_get_nr_dl_bandwidth()
{
local nr_dl_bandwidth
case $1 in
"0"|"1"|"2"|"3"|"4"|"5") nr_dl_bandwidth=$((($1 + 1) * 5)) ;;
"6"|"7"|"8"|"9"|"10"|"11"|"12") nr_dl_bandwidth=$((($1 - 2) * 10)) ;;
"13") nr_dl_bandwidth="200" ;;
"14") nr_dl_bandwidth="400" ;;
esac
echo "$nr_dl_bandwidth"
echo "$bandwidth"
}
#获取NR子载波间隔
@ -649,9 +663,9 @@ quectel_cell_info()
endc_lte_freq_band_ind_num=$(echo "$lte" | awk -F',' '{print $8}')
endc_lte_freq_band_ind=$(quectel_get_band "LTE" $endc_lte_freq_band_ind_num)
ul_bandwidth_num=$(echo "$lte" | awk -F',' '{print $9}')
endc_lte_ul_bandwidth=$(quectel_get_lte_ul_bandwidth $ul_bandwidth_num)
endc_lte_ul_bandwidth=$(quectel_get_bandwidth "LTE" $ul_bandwidth_num)
dl_bandwidth_num=$(echo "$lte" | awk -F',' '{print $10}')
endc_lte_dl_bandwidth=$(quectel_get_lte_dl_bandwidth $dl_bandwidth_num)
endc_lte_dl_bandwidth=$(quectel_get_bandwidth "LTE" $dl_bandwidth_num)
endc_lte_tac=$(echo "$lte" | awk -F',' '{print $11}')
endc_lte_rsrp=$(echo "$lte" | awk -F',' '{print $12}')
endc_lte_rsrq=$(echo "$lte" | awk -F',' '{print $13}')
@ -671,7 +685,7 @@ quectel_cell_info()
endc_nr_band_num=$(echo "$nr5g_nsa" | awk -F',' '{print $9}')
endc_nr_band=$(quectel_get_band "NR" $endc_nr_band_num)
nr_dl_bandwidth_num=$(echo "$nr5g_nsa" | awk -F',' '{print $10}')
endc_nr_dl_bandwidth=$(quectel_get_nr_dl_bandwidth $nr_dl_bandwidth_num)
endc_nr_dl_bandwidth=$(quectel_get_bandwidth "NR" $nr_dl_bandwidth_num)
scs_num=$(echo "$nr5g_nsa" | awk -F',' '{print $16}' | sed 's/\r//g')
endc_nr_scs=$(quectel_get_scs $scs_num)
else
@ -691,7 +705,7 @@ quectel_cell_info()
nr_band_num=$(echo "$response" | awk -F',' '{print $11}')
nr_band=$(quectel_get_band "NR" $nr_band_num)
nr_dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $12}')
nr_dl_bandwidth=$(quectel_get_nr_dl_bandwidth $nr_dl_bandwidth_num)
nr_dl_bandwidth=$(quectel_get_bandwidth "NR" $nr_dl_bandwidth_num)
nr_rsrp=$(echo "$response" | awk -F',' '{print $13}')
nr_rsrq=$(echo "$response" | awk -F',' '{print $14}')
nr_sinr=$(echo "$response" | awk -F',' '{print $15}')
@ -710,9 +724,9 @@ quectel_cell_info()
lte_freq_band_ind_num=$(echo "$response" | awk -F',' '{print $10}')
lte_freq_band_ind=$(quectel_get_band "LTE" $lte_freq_band_ind_num)
ul_bandwidth_num=$(echo "$response" | awk -F',' '{print $11}')
lte_ul_bandwidth=$(quectel_get_lte_ul_bandwidth $ul_bandwidth_num)
lte_ul_bandwidth=$(quectel_get_bandwidth "LTE" $ul_bandwidth_num)
dl_bandwidth_num=$(echo "$response" | awk -F',' '{print $12}')
lte_dl_bandwidth=$(quectel_get_lte_dl_bandwidth $dl_bandwidth_num)
lte_dl_bandwidth=$(quectel_get_bandwidth "LTE" $dl_bandwidth_num)
lte_tac=$(echo "$response" | awk -F',' '{print $13}')
lte_rsrp=$(echo "$response" | awk -F',' '{print $14}')
lte_rsrq=$(echo "$response" | awk -F',' '{print $15}')
@ -1048,14 +1062,17 @@ Quectel_Cellinfo()
fi
}
#获取Quectel模块信息
#获取移远模组信息
# $1:AT串口
# $2:平台
# $3:连接定义
get_quectel_info()
{
debug "get quectel info"
#设置AT串口
at_port="$1"
define_connect="$2"
platform="$2"
define_connect="$3"
#基本信息
quectel_base_info

View File

@ -1,42 +0,0 @@
{
"quick_commands":[
{"模组信息 > ATI":"ATI"},
{"查询SIM卡状态 > AT+CPIN?":"AT+CPIN?"},
{"查询网络信号质量4G > AT+CSQ":"AT+CSQ"},
{"查询网络信号质量5G > AT+CESQ":"AT+CESQ"},
{"查询网络信息 > AT+COPS?":"AT+COPS?"},
{"查询PDP信息 > AT+CGDCONT?":"AT+CGDCONT?"},
{"查询PDP地址 > AT+CGPADDR":"AT+CGPADDR"},
{"最小功能模式 > AT+CFUN=0":"AT+CFUN=0"},
{"全功能模式 > AT+CFUN=1":"AT+CFUN=1"},
{"SIM卡状态上报 > AT+QSIMSTAT?":"AT+QSIMSTAT?"},
{"设置当前使用的为卡1 > AT+QUIMSLOT=1":"AT+QUIMSLOT=1"},
{"设置当前使用的为卡2 > AT+QUIMSLOT=2":"AT+QUIMSLOT=2"},
{"查询网络信息 > AT+QNWINFO":"AT+QNWINFO"},
{"查询SIM卡签约速率 > AT+QNWCFG=\"nr5g_ambr\"":"AT+QNWCFG=\"nr5g_ambr\""},
{"查询载波聚合参数 > AT+QCAINFO":"AT+QCAINFO"},
{"查询当前拨号模式 > AT+QCFG=\"usbnet\"":"AT+QCFG=\"usbnet\""},
{"QMI/GobiNet拨号 > AT+QCFG=\"usbnet\",0":"AT+QCFG=\"usbnet\",0"},
{"ECM拨号 > AT+QCFG=\"usbnet\",1":"AT+QCFG=\"usbnet\",1"},
{"MBIM拨号 > AT+QCFG=\"usbnet\",2":"AT+QCFG=\"usbnet\",2"},
{"RNDIS拨号 > AT+QCFG=\"usbnet\",3":"AT+QCFG=\"usbnet\",3"},
{"NCM拨号 > AT+QCFG=\"usbnet\",5":"AT+QCFG=\"usbnet\",5"},
{"锁4G > AT+QNWPREFCFG=\"mode_pref\",LTE":"AT+QNWPREFCFG=\"mode_pref\",LTE"},
{"锁5G > AT+QNWPREFCFG=\"mode_pref\",NR5G":"AT+QNWPREFCFG=\"mode_pref\",NR5G"},
{"锁5G NSA > AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-NSA"},
{"锁5G SA > AT+QNWPREFCFG=\"mode_pref\",NR5G-SA":"AT+QNWPREFCFG=\"mode_pref\",NR5G-SA"},
{"恢复自动搜索网络 > AT+QNWPREFCFG=\"mode_pref\",AUTO":"AT+QNWPREFCFG=\"mode_pref\",AUTO"},
{"查询模组IMEI > AT+CGSN":"AT+CGSN"},
{"查询模组IMEI > AT+GSN":"AT+GSN"},
{"更改模组IMEI > AT+EGMR=1,7,\"IMEI\"":"AT+EGMR=1,7,\"在此设置IMEI\""},
{"获取模组温度 > AT+QTEMP":"AT+QTEMP"},
{"切换为USB通信端口 > AT+QCFG=\"data_interface\",0,0":"AT+QCFG=\"data_interface\",0,0"},
{"切换为PCIE通信端口 > AT+QCFG=\"data_interface\",1,0":"AT+QCFG=\"data_interface\",1,0"},
{"查看当前USB速率 > AT+QCFG=\"usbspeed\"":"AT+QCFG=\"usbspeed\""},
{"切换为USB2.0 > AT+QCFG=\"usbspeed\",\"20\"":"AT+QCFG=\"usbspeed\",\"20\""},
{"切换为USB3.1 Gen15Gbps > AT+QCFG=\"usbspeed\",\"311\"":"AT+QCFG=\"usbspeed\",\"311\""},
{"切换为USB3.1 Gen110Gbps > AT+QCFG=\"usbspeed\",\"312\"":"AT+QCFG=\"usbspeed\",\"312\""},
{"重启模组 > AT+CFUN=1,1":"AT+CFUN=1,1"},
{"重置模组 > AT+QCFG=\"ResetFactory\"":"AT+QCFG=\"ResetFactory\""}
]
}