feat: modem soft reboot support
This commit is contained in:
parent
f21eb3b3e9
commit
40b3c450fb
@ -73,6 +73,10 @@ extend_prefix = s:taboption("advanced", Flag, "extend_prefix", translate("Extend
|
|||||||
extend_prefix.description = translate("Once checking, the prefix will be apply to lan zone")
|
extend_prefix.description = translate("Once checking, the prefix will be apply to lan zone")
|
||||||
extend_prefix.default = "0"
|
extend_prefix.default = "0"
|
||||||
|
|
||||||
|
soft_reboot = s:taboption("advanced", Flag, "soft_reboot", translate("Soft Reboot"))
|
||||||
|
soft_reboot.description = translate("enable modem soft reboot")
|
||||||
|
soft_reboot.default = "0"
|
||||||
|
|
||||||
-- 网络类型
|
-- 网络类型
|
||||||
pdp_type= s:taboption("advanced", ListValue, "pdp_type", translate("PDP Type"))
|
pdp_type= s:taboption("advanced", ListValue, "pdp_type", translate("PDP Type"))
|
||||||
pdp_type.default = "ipv4v6"
|
pdp_type.default = "ipv4v6"
|
||||||
|
@ -69,6 +69,9 @@ name.cfgvalue = function(t, n)
|
|||||||
return Value.cfgvalue(t, n) or "-"
|
return Value.cfgvalue(t, n) or "-"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
soft_reboot = s:option(Flag, "soft_reboot", translate("Soft Reboot"))
|
||||||
|
soft_reboot.default = "0"
|
||||||
|
|
||||||
-- PDP Context Index
|
-- PDP Context Index
|
||||||
define_connect = s:option(Value, "define_connect", translate("PDP Context Index"))
|
define_connect = s:option(Value, "define_connect", translate("PDP Context Index"))
|
||||||
define_connect.default = "1"
|
define_connect.default = "1"
|
||||||
|
@ -48,6 +48,9 @@ msgstr ""
|
|||||||
msgid "Once checking, the prefix will be apply to lan zone"
|
msgid "Once checking, the prefix will be apply to lan zone"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "enable modem soft reboot"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "PDP Type"
|
msgid "PDP Type"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -64,6 +64,9 @@ msgstr "扩展前缀"
|
|||||||
msgid "Once checking, the prefix will be apply to lan zone"
|
msgid "Once checking, the prefix will be apply to lan zone"
|
||||||
msgstr "启用后,该接口的前缀会被通告至Lan区域"
|
msgstr "启用后,该接口的前缀会被通告至Lan区域"
|
||||||
|
|
||||||
|
msgid "enable modem soft reboot"
|
||||||
|
msgstr "启用模组软重启"
|
||||||
|
|
||||||
msgid "PDP Type"
|
msgid "PDP Type"
|
||||||
msgstr "PDP类型"
|
msgstr "PDP类型"
|
||||||
|
|
||||||
|
@ -64,6 +64,9 @@ msgstr "扩展前缀"
|
|||||||
msgid "Once checking, the prefix will be apply to lan zone"
|
msgid "Once checking, the prefix will be apply to lan zone"
|
||||||
msgstr "启用后,该接口的前缀会被通告至Lan区域"
|
msgstr "启用后,该接口的前缀会被通告至Lan区域"
|
||||||
|
|
||||||
|
msgid "enable modem soft reboot"
|
||||||
|
msgstr "启用模组软重启"
|
||||||
|
|
||||||
msgid "PDP Type"
|
msgid "PDP Type"
|
||||||
msgstr "PDP类型"
|
msgstr "PDP类型"
|
||||||
|
|
||||||
|
17
luci/luci-app-qmodem/root/etc/init.d/qmodem_reboot
Normal file → Executable file
17
luci/luci-app-qmodem/root/etc/init.d/qmodem_reboot
Normal file → Executable file
@ -1,9 +1,7 @@
|
|||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
# Copyright (C) 2006 OpenWrt.org
|
|
||||||
USE_PROCD=1
|
|
||||||
|
|
||||||
START=95
|
START=95
|
||||||
STOP=0
|
STOP=0
|
||||||
|
USE_PROCD=1
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
:
|
:
|
||||||
@ -12,15 +10,13 @@ start_service() {
|
|||||||
stop_service() {
|
stop_service() {
|
||||||
procd_set_param timeout 30
|
procd_set_param timeout 30
|
||||||
config_load qmodem
|
config_load qmodem
|
||||||
config_foreach _reboot_usb modem-device
|
config_foreach _soft_reboot modem-device
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_reboot_usb() {
|
_soft_reboot() {
|
||||||
config_get data_interface $1 data_interface
|
config_get soft_reboot $1 soft_reboot
|
||||||
if [ "$data_interface" == "usb" ]; then
|
if [ "$soft_reboot" == "1" ]; then
|
||||||
config_get name $1 name
|
|
||||||
if [ "$name" == "fm350-gl" ]; then
|
|
||||||
config_get at_port $1 at_port
|
config_get at_port $1 at_port
|
||||||
response=$(tom_modem -d "$at_port" -o a -c "AT+CFUN=1,1")
|
response=$(tom_modem -d "$at_port" -o a -c "AT+CFUN=1,1")
|
||||||
retries=3
|
retries=3
|
||||||
@ -30,10 +26,9 @@ _reboot_usb() {
|
|||||||
retries=$((retries - 1))
|
retries=$((retries - 1))
|
||||||
done
|
done
|
||||||
max_retries=15
|
max_retries=15
|
||||||
while [ -e "/dev/$at_port" ] && [ $max_retries -gt 0 ]; do
|
while [ -e "$at_port" ] && [ $max_retries -gt 0 ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
max_retries=$((max_retries - 1))
|
max_retries=$((max_retries - 1))
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
@ -1,8 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (C) 2024 Tom <fjrcn@outlook.com>
|
# Copyright (C) 2024 Tom <fjrcn@outlook.com>
|
||||||
|
|
||||||
/etc/init.d/modeminit enable
|
/etc/init.d/qmodem_reboot enable
|
||||||
/etc/init.d/modem enable
|
|
||||||
|
|
||||||
uci -q batch <<-EOF >/dev/null
|
uci -q batch <<-EOF >/dev/null
|
||||||
delete ucitrack.@qmodem[-1]
|
delete ucitrack.@qmodem[-1]
|
||||||
|
@ -412,6 +412,7 @@ add()
|
|||||||
set qmodem.$section_name.path="$modem_path"
|
set qmodem.$section_name.path="$modem_path"
|
||||||
set qmodem.$section_name.data_interface="$slot_type"
|
set qmodem.$section_name.data_interface="$slot_type"
|
||||||
set qmodem.$section_name.enable_dial="1"
|
set qmodem.$section_name.enable_dial="1"
|
||||||
|
set qmodem.$section_name.soft_reboot="0"
|
||||||
set qmodem.$section_name.pdp_type="ip"
|
set qmodem.$section_name.pdp_type="ip"
|
||||||
set qmodem.$section_name.state="enabled"
|
set qmodem.$section_name.state="enabled"
|
||||||
set qmodem.$section_name.metric=$metric
|
set qmodem.$section_name.metric=$metric
|
||||||
|
Loading…
x
Reference in New Issue
Block a user