luci-app-qmodem: allow users to manually add devices via Web UI

Note: This change may lead to unexpected behavior in certain configurations.
This commit is contained in:
fujr 2025-04-03 16:38:37 +08:00
parent 8bb42936ea
commit 7afbeba939
22 changed files with 730 additions and 108 deletions

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem-hc PKG_NAME:=luci-app-qmodem-hc
LUCI_TITLE:=Luci qwrt modem sim switch LUCI_TITLE:=Luci qwrt modem sim switch
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_VERSION:=2.4.1 PKG_VERSION:=2.7.0
PKG_LICENSE:=GPLv3 PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com> PKG_MAINTAINER:=Tom <fjrcn@outlook.com>

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem-mwan PKG_NAME:=luci-app-qmodem-mwan
LUCI_TITLE:=Luci qwrt modem mwan support LUCI_TITLE:=Luci qwrt modem mwan support
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_VERSION:=2.4.4 PKG_VERSION:=2.7.0
PKG_LICENSE:=GPLv3 PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com> PKG_MAINTAINER:=Tom <fjrcn@outlook.com>

View File

@ -5,6 +5,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem-sms PKG_NAME:=luci-app-qmodem-sms
LUCI_TITLE:=Luci qwrt modem sms support LUCI_TITLE:=Luci qwrt modem sms support
PKG_VERSION:=2.7.0
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_VERSION:=1 PKG_VERSION:=1
PKG_LICENSE:=GPLv3 PKG_LICENSE:=GPLv3

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem-ttl PKG_NAME:=luci-app-qmodem-ttl
LUCI_TITLE:=Luci qwrt modem ttl support LUCI_TITLE:=Luci qwrt modem ttl support
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_VERSION:=1 PKG_VERSION:=2.7.0
PKG_LICENSE:=GPLv3 PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com> PKG_MAINTAINER:=Tom <fjrcn@outlook.com>

View File

@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-qmodem PKG_NAME:=luci-app-qmodem
LUCI_TITLE:=LuCI support for QWRT Modem LUCI_TITLE:=LuCI support for QWRT Modem
LUCI_PKGARCH:=all LUCI_PKGARCH:=all
PKG_VERSION:=2.6.2 PKG_VERSION:=2.7.0
PKG_LICENSE:=GPLv3 PKG_LICENSE:=GPLv3
PKG_LINCESE_FILES:=LICENSE PKG_LINCESE_FILES:=LICENSE
PKG_MAINTAINER:=Tom <fjrcn@outlook.com> PKG_MAINTAINER:=Tom <fjrcn@outlook.com>

View File

@ -30,6 +30,7 @@ function index()
--Qmodem设置 --Qmodem设置
entry({"admin", "modem", "qmodem", "settings"}, cbi("qmodem/settings"), luci.i18n.translate("QModem Settings"),100).leaf = true entry({"admin", "modem", "qmodem", "settings"}, cbi("qmodem/settings"), luci.i18n.translate("QModem Settings"),100).leaf = true
entry({"admin", "modem", "qmodem", "slot_config"}, cbi("qmodem/slot_config")).leaf = true entry({"admin", "modem", "qmodem", "slot_config"}, cbi("qmodem/slot_config")).leaf = true
entry({"admin", "modem", "qmodem", "modem_config"}, cbi("qmodem/modem_config")).leaf = true
end end
--[[ --[[

View File

@ -50,6 +50,9 @@ end
o = s:option(DummyValue, "state", translate("Modem Status")) o = s:option(DummyValue, "state", translate("Modem Status"))
o.cfgvalue = function(t, n) o.cfgvalue = function(t, n)
if Value.cfgvalue(t,n) == nil then
return translate("Unknown")
end
return translate(Value.cfgvalue(t, n):upper() or "-") return translate(Value.cfgvalue(t, n):upper() or "-")
end end

View File

@ -0,0 +1,120 @@
m = Map("qmodem", translate("Modem Configuration"))
m.redirect = luci.dispatcher.build_url("admin", "modem", "qmodem","settings")
s = m:section(NamedSection, arg[1], "modem-device", "")
local slot_name = arg[1]
local pcie_slots = io.popen("ls /sys/bus/pci/devices/")
local pcie_slot_list = {}
for line in pcie_slots:lines() do
table.insert(pcie_slot_list, line)
end
pcie_slots:close()
local usb_slots = io.popen("ls /sys/bus/usb/devices/")
local usb_slot_list = {}
for line in usb_slots:lines() do
if not line:match("usb%d+") then
table.insert(usb_slot_list, line)
end
end
usb_slots:close()
is_fixed_device = s:option(Flag, "is_fixed_device", translate("Fixed Device"))
is_fixed_device.description = translate("If the device is fixed, it will not be update when the device is connected or disconnected.")
is_fixed_device.default = "0"
path = s:option(ListValue, "slot", translate("Slot Path"))
local usb_match_slot = {}
for i,v in ipairs(usb_slot_list) do
local uci_name = v:gsub("%.", "_"):gsub(":", "_"):gsub("-", "_")
if uci_name == slot_name then
usb_match_slot[uci_name] = v
path:value("/sys/bus/usb/devices/"..v.."/",v.."[usb]")
end
end
local pcie_match_slot = {}
for i,v in ipairs(pcie_slot_list) do
local uci_name = v:gsub("%.", "_"):gsub(":", "_"):gsub("-", "_")
if uci_name == slot_name then
pcie_match_slot[uci_name] = v
path:value("/sys/bus/pci/devices/"..v.."/",v.."[pcie]")
end
end
data_interface = s:option(ListValue, "data_interface", translate("Interface Type"))
data_interface:value("usb", translate("USB"))
data_interface:value("pcie", translate("PCIe"))
alias = s:option(Value, "alias", translate("Alias"))
alias.description = translate("Alias for the modem, used for identification.")
alias.rmempty = true
alias.default = ""
alias.placeholder = translate("Enter alias name")
name = s:option(Value, "name", translate("Modem Model"))
name.cfgvalue = function(t, n)
local name = (Value.cfgvalue(t, n) or "-")
return name
end
define_connect = s:option(Value, "define_connect", translate("PDP Context Index"))
define_connect.default = "1"
manufacturer = s:option(ListValue, "manufacturer", translate("Manufacturer"))
manufacturer:value("quectel", "Quectel")
manufacturer:value("simcom", "Simcom")
manufacturer:value("sierra", "Sierra Wireless")
manufacturer:value("fibocom", "Fibocom")
platform = s:option(Value, "platform", translate("Platform"))
platform:value("lte", "lte")
platform:value("lte12","lte12")
platform:value("qualcomm", "qualcomm")
platform:value("mediatek", "mediatek")
platform:value("unisoc", "unisoc")
platform:value("intel", "intel")
at_port = s:option(Value, "at_port", translate("AT Port"))
at_port.description = translate("AT command port for modem communication.")
modes = s:option(DynamicList, "modes", translate("Supported Modes"))
modes:value("ecm", "ECM")
modes:value("mbim", "MBIM")
modes:value("qmi", "QMI")
modes:value("ncm", "NCM")
enabled = s:option(Flag, "enabled", translate("Enable"))
enabled.default = "1"
wcdma_band = s:option(Value, "wcdma_band", translate("WCDMA Band"))
wcdma_band.description = translate("WCDMA band configuration, e.g., 1/2/3")
wcdma_band.placeholder = translate("Enter WCDMA band")
lte_band = s:option(Value, "lte_band", translate("LTE Band"))
lte_band.description = translate("LTE band configuration, e.g., 1/2/3")
lte_band.placeholder = translate("Enter LTE band")
nsa_band = s:option(Value, "nsa_band", translate("NSA Band"))
nsa_band.description = translate("NSA band configuration, e.g., 1/2/3")
nsa_band.placeholder = translate("Enter NSA band")
sa_band = s:option(Value, "sa_band", translate("SA Band"))
sa_band.description = translate("SA band configuration, e.g., 1/2/3")
sa_band.placeholder = translate("Enter SA band")
f = function(t, n)
if Value.cfgvalue(t, n) == nil then
return "null"
else
return Value.cfgvalue(t, n)
end
end
wcdma_band.cfgvalue = f
lte_band.cfgvalue = f
nsa_band.cfgvalue = f
sa_band.cfgvalue = f
return m

View File

@ -65,4 +65,52 @@ default_alias.cfgvalue = function(t, n)
return alias return alias
end end
s = m:section(TypedSection, "modem-device", translate("Modem Config List"))
s.addremove = true
s.template = "cbi/tblsection"
s.template_addremove = "qmodem/modem_config_add"
s.extedit = d.build_url("admin", "modem", "qmodem", "modem_config", "%s")
s.sectionhead = translate("Config Name")
local pcie_slots = io.popen("ls /sys/bus/pci/devices/")
local pcie_slot_list = {}
for line in pcie_slots:lines() do
table.insert(pcie_slot_list, line)
end
pcie_slots:close()
local usb_slots = io.popen("ls /sys/bus/usb/devices/")
local usb_slot_list = {}
for line in usb_slots:lines() do
if not line:match("usb%d+") then
table.insert(usb_slot_list, line)
end
end
usb_slots:close()
local avalibale_name_list = {}
for i,v in ipairs(pcie_slot_list) do
local uci_name = v:gsub("%.", "_"):gsub(":", "_"):gsub("-", "_")
avalibale_name_list[uci_name] = v.."[pcie]"
end
for i,v in ipairs(usb_slot_list) do
local uci_name = v:gsub("%.", "_"):gsub(":", "_"):gsub("-", "_")
avalibale_name_list[uci_name] = v.."[usb]"
end
s.avalibale_name = avalibale_name_list
slot_type = s:option(DummyValue, "name", translate("Modem Model"))
slot_type.cfgvalue = function(t, n)
local name = translate(Value.cfgvalue(t, n) or "-")
return name:upper()
end
slot_path = s:option(DummyValue, "slot", translate("Slot Path"))
slot_path.cfgvalue = function(t, n)
local path = (Value.cfgvalue(t, n) or "-")
return path
end
default_alias = s:option(DummyValue, "alias", translate("Alias"))
default_alias.cfgvalue = function(t, n)
local alias = (Value.cfgvalue(t, n) or "-")
return alias
end
return m return m

View File

@ -1,7 +1,7 @@
m = Map("qmodem", translate("Slot Configuration")) m = Map("qmodem", translate("Slot Configuration"))
m.redirect = luci.dispatcher.build_url("admin", "modem", "qmodem","settings") m.redirect = luci.dispatcher.build_url("admin", "modem", "qmodem","settings")
s = m:section(NamedSection, arg[1], "modem-device", "") s = m:section(NamedSection, arg[1], "modem-slot", "")
slot_type = s:option(ListValue, "type", translate("Slot Type")) slot_type = s:option(ListValue, "type", translate("Slot Type"))
slot_type:value("usb", translate("USB")) slot_type:value("usb", translate("USB"))

View File

@ -0,0 +1,16 @@
<div class="cbi-section-create cbi-tblsection-create">
<% if self.invalid_cts then -%>
<div class="cbi-section-error"><%:Invalid%></div>
<%- end %>
<div>
<select type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>.<%=section%>" data-type="uciname" data-optional="true" onchange="cbi_validate_named_section_add(this)"/>
<option value=""><%:Please Select%></option>
<% for uci_name, display_name in pairs(self.avalibale_name) do -%>
<option value="<%=uci_name%>"><%=display_name%></option>
<% end -%>
</select>
</div>
<input class="btn cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" disabled="" />
</div>

View File

@ -546,3 +546,134 @@ msgstr ""
msgid "Clear AT Command" msgid "Clear AT Command"
msgstr "" msgstr ""
# view/qmodem/modem_config.htm
msgid "Fixed Device"
msgstr "固定设备"
msgid "If the device is fixed, it will not be update when the device is connected or disconnected."
msgstr "如果设备是固定的,则在设备连接或断开时不会更新。"
msgid "Slot Path"
msgstr "插槽路径"
msgid "Interface Type"
msgstr "接口类型"
msgid "USB"
msgstr "USB"
msgid "PCIe"
msgstr "PCIe"
msgid "Alias"
msgstr "别名"
msgid "Alias for the modem, used for identification."
msgstr "调制解调器的别名,用于标识。"
msgid "Enter alias name"
msgstr "输入别名"
msgid "Modem Model"
msgstr "调制解调器型号"
msgid "PDP Context Index"
msgstr "PDP上下文序号"
msgid "Manufacturer"
msgstr "制造商"
msgid "Quectel"
msgstr "移远"
msgid "Simcom"
msgstr "芯讯通Simcom"
msgid "Sierra Wireless"
msgstr "Sierra无线"
msgid "Fibocom"
msgstr "广和通"
msgid "Platform"
msgstr "平台"
msgid "lte"
msgstr "LTE"
msgid "lte12"
msgstr "LTE12"
msgid "qualcomm"
msgstr "高通"
msgid "mediatek"
msgstr "联发科"
msgid "unisoc"
msgstr "紫光展锐"
msgid "intel"
msgstr "英特尔"
msgid "AT Port"
msgstr "AT端口"
msgid "AT command port for modem communication."
msgstr "用于调制解调器通信的AT命令端口。"
msgid "Supported Modes"
msgstr "支持的模式"
msgid "ECM"
msgstr "ECM"
msgid "MBIM"
msgstr "MBIM"
msgid "QMI"
msgstr "QMI"
msgid "NCM"
msgstr "NCM"
msgid "Enable"
msgstr "启用"
msgid "WCDMA Band"
msgstr "WCDMA频段"
msgid "WCDMA band configuration, e.g., 1/2/3"
msgstr "WCDMA频段配置例如1/2/3"
msgid "Enter WCDMA band"
msgstr "输入WCDMA频段"
msgid "LTE Band"
msgstr "LTE频段"
msgid "LTE band configuration, e.g., 1/2/3"
msgstr "LTE频段配置例如1/2/3"
msgid "Enter LTE band"
msgstr "输入LTE频段"
msgid "NSA Band"
msgstr "NSA频段"
msgid "NSA band configuration, e.g., 1/2/3"
msgstr "NSA频段配置例如1/2/3"
msgid "Enter NSA band"
msgstr "输入NSA频段"
msgid "SA Band"
msgstr "SA频段"
msgid "SA band configuration, e.g., 1/2/3"
msgstr "SA频段配置例如1/2/3"
msgid "Enter SA band"
msgstr "输入SA频段"

View File

@ -568,3 +568,140 @@ msgstr "清空AT端口"
msgid "Clear AT Command" msgid "Clear AT Command"
msgstr "清空AT命令" msgstr "清空AT命令"
# view/qmodem/modem_config.htm
msgid "Fixed Device"
msgstr "固定设备"
msgid "If the device is fixed, it will not be update when the device is connected or disconnected."
msgstr "如果设备是固定的,则在设备连接或断开时不会更新。"
msgid "Slot Path"
msgstr "插槽路径"
msgid "Interface Type"
msgstr "接口类型"
msgid "USB"
msgstr "USB"
msgid "PCIe"
msgstr "PCIe"
msgid "Alias"
msgstr "别名"
msgid "Alias for the modem, used for identification."
msgstr "调制解调器的别名,用于标识。"
msgid "Enter alias name"
msgstr "输入别名"
msgid "Modem Model"
msgstr "调制解调器型号"
msgid "PDP Context Index"
msgstr "PDP上下文序号"
msgid "Manufacturer"
msgstr "制造商"
msgid "Quectel"
msgstr "移远"
msgid "Simcom"
msgstr "芯讯通Simcom"
msgid "Sierra Wireless"
msgstr "Sierra无线"
msgid "Fibocom"
msgstr "广和通"
msgid "Platform"
msgstr "平台"
msgid "lte"
msgstr "LTE"
msgid "lte12"
msgstr "LTE12"
msgid "qualcomm"
msgstr "高通"
msgid "mediatek"
msgstr "联发科"
msgid "unisoc"
msgstr "紫光展锐"
msgid "intel"
msgstr "英特尔"
msgid "AT Port"
msgstr "AT端口"
msgid "AT command port for modem communication."
msgstr "用于调制解调器通信的AT命令端口。"
msgid "Supported Modes"
msgstr "支持的模式"
msgid "ECM"
msgstr "ECM"
msgid "MBIM"
msgstr "MBIM"
msgid "QMI"
msgstr "QMI"
msgid "NCM"
msgstr "NCM"
msgid "Enable"
msgstr "启用"
msgid "WCDMA Band"
msgstr "WCDMA频段"
msgid "WCDMA band configuration, e.g., 1/2/3"
msgstr "WCDMA频段配置例如1/2/3"
msgid "Enter WCDMA band"
msgstr "输入WCDMA频段"
msgid "LTE Band"
msgstr "LTE频段"
msgid "LTE band configuration, e.g., 1/2/3"
msgstr "LTE频段配置例如1/2/3"
msgid "Enter LTE band"
msgstr "输入LTE频段"
msgid "NSA Band"
msgstr "NSA频段"
msgid "NSA band configuration, e.g., 1/2/3"
msgstr "NSA频段配置例如1/2/3"
msgid "Enter NSA band"
msgstr "输入NSA频段"
msgid "SA Band"
msgstr "SA频段"
msgid "SA band configuration, e.g., 1/2/3"
msgstr "SA频段配置例如1/2/3"
msgid "Enter SA band"
msgstr "输入SA频段"
msgid "Modem Config List"
msgstr "模组配置列表"
msgid "Please Select"
msgstr "请选择"

View File

@ -568,3 +568,140 @@ msgstr "清空AT端口"
msgid "Clear AT Command" msgid "Clear AT Command"
msgstr "清空AT命令" msgstr "清空AT命令"
# view/qmodem/modem_config.htm
msgid "Fixed Device"
msgstr "固定设备"
msgid "If the device is fixed, it will not be update when the device is connected or disconnected."
msgstr "如果设备是固定的,则在设备连接或断开时不会更新。"
msgid "Slot Path"
msgstr "插槽路径"
msgid "Interface Type"
msgstr "接口类型"
msgid "USB"
msgstr "USB"
msgid "PCIe"
msgstr "PCIe"
msgid "Alias"
msgstr "别名"
msgid "Alias for the modem, used for identification."
msgstr "调制解调器的别名,用于标识。"
msgid "Enter alias name"
msgstr "输入别名"
msgid "Modem Model"
msgstr "调制解调器型号"
msgid "PDP Context Index"
msgstr "PDP上下文序号"
msgid "Manufacturer"
msgstr "制造商"
msgid "Quectel"
msgstr "移远"
msgid "Simcom"
msgstr "芯讯通Simcom"
msgid "Sierra Wireless"
msgstr "Sierra无线"
msgid "Fibocom"
msgstr "广和通"
msgid "Platform"
msgstr "平台"
msgid "lte"
msgstr "LTE"
msgid "lte12"
msgstr "LTE12"
msgid "qualcomm"
msgstr "高通"
msgid "mediatek"
msgstr "联发科"
msgid "unisoc"
msgstr "紫光展锐"
msgid "intel"
msgstr "英特尔"
msgid "AT Port"
msgstr "AT端口"
msgid "AT command port for modem communication."
msgstr "用于调制解调器通信的AT命令端口。"
msgid "Supported Modes"
msgstr "支持的模式"
msgid "ECM"
msgstr "ECM"
msgid "MBIM"
msgstr "MBIM"
msgid "QMI"
msgstr "QMI"
msgid "NCM"
msgstr "NCM"
msgid "Enable"
msgstr "启用"
msgid "WCDMA Band"
msgstr "WCDMA频段"
msgid "WCDMA band configuration, e.g., 1/2/3"
msgstr "WCDMA频段配置例如1/2/3"
msgid "Enter WCDMA band"
msgstr "输入WCDMA频段"
msgid "LTE Band"
msgstr "LTE频段"
msgid "LTE band configuration, e.g., 1/2/3"
msgstr "LTE频段配置例如1/2/3"
msgid "Enter LTE band"
msgstr "输入LTE频段"
msgid "NSA Band"
msgstr "NSA频段"
msgid "NSA band configuration, e.g., 1/2/3"
msgstr "NSA频段配置例如1/2/3"
msgid "Enter NSA band"
msgstr "输入NSA频段"
msgid "SA Band"
msgstr "SA频段"
msgid "SA band configuration, e.g., 1/2/3"
msgstr "SA频段配置例如1/2/3"
msgid "Enter SA band"
msgstr "输入SA频段"
msgid "Modem Config List"
msgstr "模组配置列表"
msgid "Please Select"
msgstr "请选择"

View File

@ -453,3 +453,12 @@ _add_disabled_features()
{ {
json_add_string "" "$1" json_add_string "" "$1"
} }
_copyright()
{
json_add_object "copyright"
json_add_string "Vendor" "${_Vendor}"
json_add_string "Author" "${_Author}"
json_add_string "Maintainer" "${_Maintainer}"
json_close_object
}

View File

@ -117,46 +117,96 @@ json_init
json_add_object result json_add_object result
json_close_object json_close_object
case $method in case $method in
"get_at_cfg") "base_info")
get_at_cfg cache_file="/tmp/cache_$1_$2"
exit try_cache 10 $cache_file base_info
;;
"cell_info")
cache_file="/tmp/cache_$1_$2"
try_cache 10 $cache_file cell_info
;; ;;
"clear_dial_log") "clear_dial_log")
json_select result json_select result
log_file="/var/run/qmodem/${config_section}_dir/dial_log" log_file="/var/run/qmodem/${config_section}_dir/dial_log"
[ -f $log_file ] && echo "" > $log_file && json_add_string status "1" || json_add_string status "0" [ -f $log_file ] && echo "" > $log_file && json_add_string status "1" || json_add_string status "0"
json_close_object json_close_object
;; ;;
"delete_sms")
json_select result
index=$3
[ -n "$sms_at_port" ] && at_port=$sms_at_port
for i in $index; do
tom_modem -d $at_port -o d -i $i
touch /tmp/cache_sms_$2
if [ "$?" == 0 ]; then
json_add_string status "1"
json_add_string "index$i" "tom_modem -d $at_port -o d -i $i"
else
json_add_string status "0"
fi
done
json_close_object
rm -rf /tmp/cache_sms_$2
;;
"do_reboot")
reboot_method=$(echo $3 |jq -r '.method')
echo $3 > /tmp/555/reboot
case $reboot_method in
"hard")
hard_reboot
;;
"soft")
soft_reboot
;;
esac
;;
"get_at_cfg")
get_at_cfg
exit
;;
"get_copyright")
_copyright
;;
"get_disabled_features")
json_add_array disabled_features
vendor_get_disabled_features
get_modem_disabled_features
get_global_disabled_features
json_close_array
;;
"get_dns") "get_dns")
get_dns get_dns
;; ;;
"get_imei") "get_imei")
get_imei get_imei
;; ;;
"set_imei") "get_lockband")
set_imei $3 get_lockband
;; ;;
"get_mode") "get_mode")
get_mode get_mode
;; ;;
"set_mode") "get_neighborcell")
set_mode $3 get_neighborcell
;; ;;
"get_network_prefer") "get_network_prefer")
get_network_prefer get_network_prefer
;; ;;
"set_network_prefer") "get_reboot_caps")
set_network_prefer $3 get_reboot_caps
exit
;; ;;
"get_lockband") "get_sms")
get_lockband get_sms 10 /tmp/cache_sms_$2
exit
;; ;;
"set_lockband") "info")
set_lockband $3 cache_file="/tmp/cache_$1_$2"
try_cache 10 $cache_file get_info
;; ;;
"get_neighborcell") "network_info")
get_neighborcell cache_file="/tmp/cache_$1_$2"
try_cache 10 $cache_file network_info
;; ;;
"send_at") "send_at")
cmd=$(echo "$3" | jq -r '.at') cmd=$(echo "$3" | jq -r '.at')
@ -171,51 +221,18 @@ case $method in
json_add_string status "0" json_add_string status "0"
fi fi
;; ;;
"set_neighborcell") "send_raw_pdu")
set_neighborcell $3 cmd=$3
;; [ -n "$sms_at_port" ] && at_port=$sms_at_port
"set_sms_storage") res=$(tom_modem -d $at_port -o s -p "$cmd")
set_sms_storage $3 json_select result
;; if [ "$?" == 0 ]; then
"base_info") json_add_string status "1"
cache_file="/tmp/cache_$1_$2" json_add_string cmd "tom_modem -d $at_port -o s -p \"$cmd\""
try_cache 10 $cache_file base_info json_add_string "res" "$res"
;; else
"sim_info") json_add_string status "0"
cache_file="/tmp/cache_$1_$2" fi
try_cache 10 $cache_file sim_info
;;
"cell_info")
cache_file="/tmp/cache_$1_$2"
try_cache 10 $cache_file cell_info
;;
"network_info")
cache_file="/tmp/cache_$1_$2"
try_cache 10 $cache_file network_info
;;
"info")
cache_file="/tmp/cache_$1_$2"
try_cache 10 $cache_file get_info
;;
"get_sms")
get_sms 10 /tmp/cache_sms_$2
exit
;;
"get_reboot_caps")
get_reboot_caps
exit
;;
"do_reboot")
reboot_method=$(echo $3 |jq -r '.method')
echo $3 > /tmp/555/reboot
case $reboot_method in
"hard")
hard_reboot
;;
"soft")
soft_reboot
;;
esac
;; ;;
"send_sms") "send_sms")
cmd_json=$3 cmd_json=$3
@ -233,45 +250,27 @@ case $method in
fi fi
json_close_object json_close_object
;; ;;
"send_raw_pdu") "set_imei")
cmd=$3 set_imei $3
[ -n "$sms_at_port" ] && at_port=$sms_at_port
#res=$(sms_tool_q -d $at_port send_raw_pdu "$cmd" )
res=$(tom_modem -d $at_port -o s -p "$cmd")
json_select result
if [ "$?" == 0 ]; then
json_add_string status "1"
json_add_string cmd "tom_modem -d $at_port -o s -p \"$cmd\""
json_add_string "res" "$res"
else
json_add_string status "0"
fi
;; ;;
"delete_sms") "set_lockband")
json_select result set_lockband $3
index=$3
[ -n "$sms_at_port" ] && at_port=$sms_at_port
for i in $index; do
# sms_tool_q -d $at_port delete $i > /dev/null
tom_modem -d $at_port -o d -i $i
touch /tmp/cache_sms_$2
if [ "$?" == 0 ]; then
json_add_string status "1"
json_add_string "index$i" "tom_modem -d $at_port -o d -i $i"
else
json_add_string status "0"
fi
done
json_close_object
rm -rf /tmp/cache_sms_$2
;; ;;
"get_disabled_features") "set_mode")
json_add_array disabled_features set_mode $3
#从vendor文件中读取对vendor禁用的功能 ;;
vendor_get_disabled_features "set_neighborcell")
get_modem_disabled_features set_neighborcell $3
get_global_disabled_features ;;
json_close_array "set_network_prefer")
set_network_prefer $3
;;
"set_sms_storage")
set_sms_storage $3
;;
"sim_info")
cache_file="/tmp/cache_$1_$2"
try_cache 10 $cache_file sim_info
;; ;;
esac esac
json_dump json_dump

View File

@ -311,6 +311,8 @@ add()
#section name is replace slot .:- with _ #section name is replace slot .:- with _
section_name=$(echo $slot | sed 's/[\.:-]/_/g') section_name=$(echo $slot | sed 's/[\.:-]/_/g')
is_exist=$(uci -q get qmodem.$section_name) is_exist=$(uci -q get qmodem.$section_name)
is_fixed_device=$(uci -q get qmodem.@qmodem[0].fixed_device)
[ -n "$is_fixed_device" ] && [ "$is_fixed_device" == "1" ] && return
case $slot_type in case $slot_type in
"usb") "usb")
scan_usb_slot_interfaces $slot scan_usb_slot_interfaces $slot

View File

@ -19,7 +19,9 @@ fastat()
local atcmd="${new_str/\"/\"}" local atcmd="${new_str/\"/\"}"
#过滤空行 #过滤空行
# sms_tool_q -t 1 -d $at_port at "$atcmd" # sms_tool_q -t 1 -d $at_port at "$atcmd"
tom_modem -d $at_port -o a -c "$atcmd" -t 1 local at_port_num=${at_port##ttyUSB}
sendat "$at_port_num" "$atcmd"
#tom_modem -d $at_port -o a -c "$atcmd" -t 1
} }
log2file() log2file()

View File

@ -1,7 +1,13 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2023 Siriling <siriling@qq.com> # Copyright (C) 2023 Siriling <siriling@qq.com>
# Copyright (C) 2025 Fujr <fjrcn@outlook.com>
_Vendor="fibocom"
_Author="Siriling Fujr"
_Maintainer="Fujr <fjrcn@outlook.com>"
source /usr/share/qmodem/generic.sh source /usr/share/qmodem/generic.sh
debug_subject="fibocom_ctrl" debug_subject="fibocom_ctrl"
#获取拨号模式 #获取拨号模式
# $1:AT串口 # $1:AT串口

View File

@ -1,5 +1,9 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2023 Siriling <siriling@qq.com>
# Copyright (C) 2025 Fujr <fjrcn@outlook.com>
_Vendor="quectel"
_Author="Siriling,Fujr"
_Maintainer="Fujr <fjrcn@outlook.com>"
source /usr/share/qmodem/generic.sh source /usr/share/qmodem/generic.sh
debug_subject="quectel_ctrl" debug_subject="quectel_ctrl"
#return raw data #return raw data

View File

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2025 Fujr <fjrcn@outlook.com>
_Vendor="sierra"
_Author="Fujr"
_Maintainer="Fujr <fjrcn@outlook.com>"
source /usr/share/qmodem/generic.sh source /usr/share/qmodem/generic.sh
debug_subject="quectel_ctrl" debug_subject="quectel_ctrl"
function unlock_advance(){ function unlock_advance(){

View File

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
# Copyright (C) 2025 sfwtw
_Vendor="simcom"
_Author="sfwtw"
_Maintainer="sfwtw <unkown>"
source /usr/share/qmodem/generic.sh source /usr/share/qmodem/generic.sh
debug_subject="quectel_ctrl" debug_subject="quectel_ctrl"
#return raw data #return raw data