diff --git a/luci/luci-app-qmodem-hc/Makefile b/luci/luci-app-qmodem-hc/Makefile index 90677e4..a8b294a 100644 --- a/luci/luci-app-qmodem-hc/Makefile +++ b/luci/luci-app-qmodem-hc/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-qmodem-hc LUCI_TITLE:=Luci qwrt modem sim switch LUCI_PKGARCH:=all -PKG_VERSION:=2.4.1 +PKG_VERSION:=2.7.0 PKG_LICENSE:=GPLv3 PKG_LINCESE_FILES:=LICENSE PKG_MAINTAINER:=Tom diff --git a/luci/luci-app-qmodem-mwan/Makefile b/luci/luci-app-qmodem-mwan/Makefile index aceab71..f8aea7a 100644 --- a/luci/luci-app-qmodem-mwan/Makefile +++ b/luci/luci-app-qmodem-mwan/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-qmodem-mwan LUCI_TITLE:=Luci qwrt modem mwan support LUCI_PKGARCH:=all -PKG_VERSION:=2.4.4 +PKG_VERSION:=2.7.0 PKG_LICENSE:=GPLv3 PKG_LINCESE_FILES:=LICENSE PKG_MAINTAINER:=Tom diff --git a/luci/luci-app-qmodem-sms/Makefile b/luci/luci-app-qmodem-sms/Makefile index f3390bc..4caa2a5 100644 --- a/luci/luci-app-qmodem-sms/Makefile +++ b/luci/luci-app-qmodem-sms/Makefile @@ -5,6 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-qmodem-sms LUCI_TITLE:=Luci qwrt modem sms support +PKG_VERSION:=2.7.0 LUCI_PKGARCH:=all PKG_VERSION:=1 PKG_LICENSE:=GPLv3 diff --git a/luci/luci-app-qmodem-ttl/Makefile b/luci/luci-app-qmodem-ttl/Makefile index ae01067..aca8a23 100644 --- a/luci/luci-app-qmodem-ttl/Makefile +++ b/luci/luci-app-qmodem-ttl/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-qmodem-ttl LUCI_TITLE:=Luci qwrt modem ttl support LUCI_PKGARCH:=all -PKG_VERSION:=1 +PKG_VERSION:=2.7.0 PKG_LICENSE:=GPLv3 PKG_LINCESE_FILES:=LICENSE PKG_MAINTAINER:=Tom diff --git a/luci/luci-app-qmodem/Makefile b/luci/luci-app-qmodem/Makefile index e789d8c..50366d3 100644 --- a/luci/luci-app-qmodem/Makefile +++ b/luci/luci-app-qmodem/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-qmodem LUCI_TITLE:=LuCI support for QWRT Modem LUCI_PKGARCH:=all -PKG_VERSION:=2.6.2 +PKG_VERSION:=2.7.0 PKG_LICENSE:=GPLv3 PKG_LINCESE_FILES:=LICENSE PKG_MAINTAINER:=Tom diff --git a/luci/luci-app-qmodem/luasrc/controller/qmodem.lua b/luci/luci-app-qmodem/luasrc/controller/qmodem.lua index d1b23df..b97fa15 100644 --- a/luci/luci-app-qmodem/luasrc/controller/qmodem.lua +++ b/luci/luci-app-qmodem/luasrc/controller/qmodem.lua @@ -30,6 +30,7 @@ function index() --Qmodem设置 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", "modem_config"}, cbi("qmodem/modem_config")).leaf = true end --[[ diff --git a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_overview.lua b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_overview.lua index 4a910c9..f6f2c5b 100644 --- a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_overview.lua +++ b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/dial_overview.lua @@ -50,6 +50,9 @@ end o = s:option(DummyValue, "state", translate("Modem Status")) o.cfgvalue = function(t, n) + if Value.cfgvalue(t,n) == nil then + return translate("Unknown") + end return translate(Value.cfgvalue(t, n):upper() or "-") end diff --git a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/modem_config.lua b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/modem_config.lua new file mode 100644 index 0000000..ffe9f63 --- /dev/null +++ b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/modem_config.lua @@ -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 diff --git a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/settings.lua b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/settings.lua index ac6a0d8..56212e4 100644 --- a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/settings.lua +++ b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/settings.lua @@ -65,4 +65,52 @@ default_alias.cfgvalue = function(t, n) return alias 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 diff --git a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/slot_config.lua b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/slot_config.lua index 2b5c547..acd3b88 100644 --- a/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/slot_config.lua +++ b/luci/luci-app-qmodem/luasrc/model/cbi/qmodem/slot_config.lua @@ -1,7 +1,7 @@ m = Map("qmodem", translate("Slot Configuration")) 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:value("usb", translate("USB")) diff --git a/luci/luci-app-qmodem/luasrc/view/qmodem/modem_config_add.htm b/luci/luci-app-qmodem/luasrc/view/qmodem/modem_config_add.htm new file mode 100644 index 0000000..57d9e5b --- /dev/null +++ b/luci/luci-app-qmodem/luasrc/view/qmodem/modem_config_add.htm @@ -0,0 +1,16 @@ +
+ <% if self.invalid_cts then -%> +
<%:Invalid%>
+ <%- end %> + +
+ + +
+ +
diff --git a/luci/luci-app-qmodem/po/template/qmodem.po b/luci/luci-app-qmodem/po/template/qmodem.po index 2a59784..db1621e 100644 --- a/luci/luci-app-qmodem/po/template/qmodem.po +++ b/luci/luci-app-qmodem/po/template/qmodem.po @@ -546,3 +546,134 @@ msgstr "" msgid "Clear AT Command" 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频段" diff --git a/luci/luci-app-qmodem/po/zh-cn/qmodem.po b/luci/luci-app-qmodem/po/zh-cn/qmodem.po index 78f9678..68ccb8a 100644 --- a/luci/luci-app-qmodem/po/zh-cn/qmodem.po +++ b/luci/luci-app-qmodem/po/zh-cn/qmodem.po @@ -568,3 +568,140 @@ msgstr "清空AT端口" msgid "Clear AT Command" 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 "请选择" diff --git a/luci/luci-app-qmodem/po/zh_Hans/qmodem.po b/luci/luci-app-qmodem/po/zh_Hans/qmodem.po index 78f9678..68ccb8a 100644 --- a/luci/luci-app-qmodem/po/zh_Hans/qmodem.po +++ b/luci/luci-app-qmodem/po/zh_Hans/qmodem.po @@ -568,3 +568,140 @@ msgstr "清空AT端口" msgid "Clear AT Command" 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 "请选择" diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/generic.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/generic.sh index d7678a5..164fbdb 100755 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/generic.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/generic.sh @@ -453,3 +453,12 @@ _add_disabled_features() { 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 +} diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/modem_ctrl.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/modem_ctrl.sh index b492b19..d949178 100755 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/modem_ctrl.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/modem_ctrl.sh @@ -117,46 +117,96 @@ json_init json_add_object result json_close_object case $method in - "get_at_cfg") - get_at_cfg - exit + "base_info") + cache_file="/tmp/cache_$1_$2" + 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") json_select result 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" 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_imei") get_imei ;; - "set_imei") - set_imei $3 + "get_lockband") + get_lockband ;; "get_mode") get_mode ;; - "set_mode") - set_mode $3 + "get_neighborcell") + get_neighborcell ;; "get_network_prefer") get_network_prefer ;; - "set_network_prefer") - set_network_prefer $3 + "get_reboot_caps") + get_reboot_caps + exit ;; - "get_lockband") - get_lockband + "get_sms") + get_sms 10 /tmp/cache_sms_$2 + exit ;; - "set_lockband") - set_lockband $3 + "info") + cache_file="/tmp/cache_$1_$2" + try_cache 10 $cache_file get_info ;; - "get_neighborcell") - get_neighborcell + "network_info") + cache_file="/tmp/cache_$1_$2" + try_cache 10 $cache_file network_info ;; "send_at") cmd=$(echo "$3" | jq -r '.at') @@ -171,51 +221,18 @@ case $method in json_add_string status "0" fi ;; - "set_neighborcell") - set_neighborcell $3 - ;; - "set_sms_storage") - set_sms_storage $3 - ;; - "base_info") - cache_file="/tmp/cache_$1_$2" - try_cache 10 $cache_file base_info - ;; - "sim_info") - cache_file="/tmp/cache_$1_$2" - 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_raw_pdu") + cmd=$3 + [ -n "$sms_at_port" ] && at_port=$sms_at_port + 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 ;; "send_sms") cmd_json=$3 @@ -233,45 +250,27 @@ case $method in fi json_close_object ;; - "send_raw_pdu") - cmd=$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 + "set_imei") + set_imei $3 ;; - "delete_sms") - json_select result - 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 + "set_lockband") + set_lockband $3 ;; - "get_disabled_features") - json_add_array disabled_features - #从vendor文件中读取对vendor禁用的功能 - vendor_get_disabled_features - get_modem_disabled_features - get_global_disabled_features - json_close_array + "set_mode") + set_mode $3 + ;; + "set_neighborcell") + set_neighborcell $3 + ;; + "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 json_dump diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/modem_scan.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/modem_scan.sh index ef4d1a1..44548bb 100755 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/modem_scan.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/modem_scan.sh @@ -311,6 +311,8 @@ add() #section name is replace slot .:- with _ section_name=$(echo $slot | sed 's/[\.:-]/_/g') 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 "usb") scan_usb_slot_interfaces $slot diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/modem_util.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/modem_util.sh index 0a54a74..f8c3675 100755 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/modem_util.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/modem_util.sh @@ -19,7 +19,9 @@ fastat() local atcmd="${new_str/\"/\"}" #过滤空行 # 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() diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/fibocom.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/fibocom.sh index 5428788..2b734ae 100755 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/fibocom.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/fibocom.sh @@ -1,7 +1,13 @@ #!/bin/sh # Copyright (C) 2023 Siriling - +# Copyright (C) 2025 Fujr +_Vendor="fibocom" +_Author="Siriling Fujr" +_Maintainer="Fujr " source /usr/share/qmodem/generic.sh + + + debug_subject="fibocom_ctrl" #获取拨号模式 # $1:AT串口 diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/quectel.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/quectel.sh index 664e8f1..2d15772 100755 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/quectel.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/quectel.sh @@ -1,5 +1,9 @@ #!/bin/sh - +# Copyright (C) 2023 Siriling +# Copyright (C) 2025 Fujr +_Vendor="quectel" +_Author="Siriling,Fujr" +_Maintainer="Fujr " source /usr/share/qmodem/generic.sh debug_subject="quectel_ctrl" #return raw data diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/sierra.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/sierra.sh index b6f360a..d68dbbc 100644 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/sierra.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/sierra.sh @@ -1,5 +1,8 @@ #!/bin/sh - +# Copyright (C) 2025 Fujr +_Vendor="sierra" +_Author="Fujr" +_Maintainer="Fujr " source /usr/share/qmodem/generic.sh debug_subject="quectel_ctrl" function unlock_advance(){ diff --git a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh index afcebd1..5fb57a9 100644 --- a/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh +++ b/luci/luci-app-qmodem/root/usr/share/qmodem/vendor/simcom.sh @@ -1,5 +1,8 @@ #!/bin/sh - +# Copyright (C) 2025 sfwtw +_Vendor="simcom" +_Author="sfwtw" +_Maintainer="sfwtw " source /usr/share/qmodem/generic.sh debug_subject="quectel_ctrl" #return raw data