This commit is contained in:
fujr 2024-11-29 01:20:01 +08:00
parent 66dd105c25
commit 0dd7dc46ad
5 changed files with 21 additions and 6 deletions

View File

@ -12,7 +12,6 @@ s.addremove = false
o = s:option(Flag, "enable_dial", translate("Enable Dial")..translate("(Global)")) o = s:option(Flag, "enable_dial", translate("Enable Dial")..translate("(Global)"))
o.rmempty = false o.rmempty = false
o = s:option(Button, "reload_dial", translate("Restart Dial Service")) o = s:option(Button, "reload_dial", translate("Restart Dial Service"))
o.inputstyle = "apply" o.inputstyle = "apply"
o.write = function() o.write = function()
@ -29,6 +28,13 @@ o = s:option(Flag, "enable_dial", translate("Enable Dial"))
o.width = "5%" o.width = "5%"
o.rmempty = false o.rmempty = false
restart_btn = s:option(Button, "_redial", translate("ReDial"))
restart_btn.inputstyle = "remove"
function restart_btn.write(self, section)
sys.call("/etc/init.d/qmodem_network redial "..section.." > /dev/null 2>&1")
luci.http.redirect(d.build_url("admin", "modem", "qmodem", "dial_overview"))
end
o = s:option(DummyValue, "name", translate("Modem Model")) o = s:option(DummyValue, "name", translate("Modem Model"))
o.cfgvalue = function(t, n) o.cfgvalue = function(t, n)
local name = (Value.cfgvalue(t, n) or "") local name = (Value.cfgvalue(t, n) or "")
@ -80,6 +86,8 @@ function remove_btn.write(self, section)
end end
-- 添加模块拨号日志 -- 添加模块拨号日志
m:append(Template("qmodem/dial_overview")) m:append(Template("qmodem/dial_overview"))
m.on_after_commit = function(self)
sys.call("/etc/init.d/qmodem_network reload > /dev/null 2>&1")
end
return m return m

View File

@ -130,6 +130,9 @@ msgstr "模组别名"
msgid "Modem Status" msgid "Modem Status"
msgstr "模组状态" msgstr "模组状态"
msgid "ReDial"
msgstr "重拨"
msgid "Remove Modem" msgid "Remove Modem"
msgstr "移除模组" msgstr "移除模组"

View File

@ -130,6 +130,9 @@ msgstr "模组别名"
msgid "Modem Status" msgid "Modem Status"
msgstr "模组状态" msgstr "模组状态"
msgid "ReDial"
msgstr "重拨"
msgid "Remove Modem" msgid "Remove Modem"
msgstr "移除模组" msgstr "移除模组"

View File

@ -37,6 +37,7 @@ reload_service()
{ {
force_stop=0 force_stop=0
mkdir -p $MODEM_RUNDIR mkdir -p $MODEM_RUNDIR
sleep 1
update_modem update_modem
} }
@ -49,7 +50,7 @@ update_modem(){
dial() dial()
{ {
_dial $1 rc_procd _dial $1
} }
hang() hang()
@ -79,9 +80,9 @@ _update_modem()
fi fi
data=$(_procd_ubus_call list | jq -r ".$service.instances.modem_$1") data=$(_procd_ubus_call list | jq -r ".$service.instances.modem_$1")
[ "$data" == "null" ] && current_status=0 || current_status=1 [ "$data" == "null" ] && current_status=0 || current_status=1
logger -t qmodem_network "current:$current_status;target:$target " logger -t qmodem_network "cfg:$1 current:$current_status;target:$target "
if [ "$current_status" != "$target" ];then if [ "$current_status" != "$target" ];then
[ "$target" -eq 1 ] && _dial $1 || _hang $1 [ "$target" -eq 1 ] && dial $1 || hang $1
logger -t qmodem_network "update modem cfg: $1 dial:$target" logger -t qmodem_network "update modem cfg: $1 dial:$target"
fi fi
} }

View File

@ -683,7 +683,7 @@ qmi_dial()
fi fi
cmd_line="$cmd_line -f $log_file" cmd_line="$cmd_line -f $log_file"
m_debug "dialing $cmd_line" m_debug "dialing $cmd_line"
$cmd_line exec $cmd_line
} }