1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 18:41:51 +00:00

Fix OpenMPTCProuter advanced settings

This commit is contained in:
Ycarus 2018-04-17 14:48:55 +02:00
parent 42ace5fe26
commit b9fa5733c5
5 changed files with 24 additions and 9 deletions

View file

@ -101,7 +101,9 @@ function settings_add()
ucic:save("openmptcprouter")
ucic:commit("openmptcprouter")
end
luci.sys.call("/etc/init.d/openmptcprouter restart >/dev/null 2>/dev/null")
-- Done, redirect
luci.http.redirect(luci.dispatcher.build_url("admin/system/openmptcprouter/settings"))
return

View file

@ -27,13 +27,13 @@
<div class="cbi-value">
<label class="cbi-value-title"><%:Minimum scaling CPU frequency%></label>
<div class="cbi-value-field">
<input type="text" name="scaling_min_freq" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("echo /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq")):match("%d+"))%>">
<input type="text" name="scaling_min_freq" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("cat /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq")):match("%d+"))%>">
</div>
</div>
<div class="cbi-value">
<label class="cbi-value-title"><%:Maximum scaling CPU frequency%></label>
<div class="cbi-value-field">
<input type="text" name="scaling_max_freq" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("echo /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq")):match("%d+"))%>">
<input type="text" name="scaling_max_freq" class="cbi-input-text" value="<%=tonumber((luci.sys.exec("cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq")):match("%d+"))%>">
</div>
</div>
<div class="cbi-value">
@ -41,11 +41,11 @@
<div class="cbi-value-field">
<select class="cbi-input-select" name="scaling_governor">
<%
governor=luci.sys.exec("cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor")
governor=luci.util.trim(luci.sys.exec("cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor"))
available_governors=luci.sys.exec("cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_governors")
for gov in string.gmatch(available_governors, "[^%s]+") do
%>
<option value="<%=gov%>" <% if governor == gov then %>selected="selected"<% end %>>
<option value="<%=gov%>" <% if governor == gov then %>selected="selected"<% end %>><%=gov%></option>
<%
end
%>

View file

@ -107,7 +107,11 @@
}
if (mArray.openmptcprouter.tun_service == false)
{
statusMessage += 'TUN service is not running';
statusMessage += 'TUN service is not running<br/>';
}
if (mArray.openmptcprouter.wan_addr == "")
{
statusMessage += 'No VPS IP address';
}
if(statusMessage !== "")

View file

@ -9,15 +9,21 @@ start_service() {
config_load openmptcprouter
config_get scaling_min_freq settings scaling_min_freq
[ -n "$scaling_min_freq" ] && {
echo $scaling_min_freq > /sys/devices/system/cpu/cpufreq/policy*/scaling_min_freq
for c in $(ls -d /sys/devices/system/cpu/cpufreq/policy[0-9]*); do
echo $scaling_min_freq > $c/scaling_min_freq
done
}
config_get scaling_max_freq settings scaling_max_freq
[ -n "$scaling_max_freq" ] && {
echo $scaling_max_freq > /sys/devices/system/cpu/cpufreq/policy*/scaling_max_freq
for c in $(ls -d /sys/devices/system/cpu/cpufreq/policy[0-9]*); do
echo $scaling_max_freq > $c/scaling_max_freq
done
}
config_get scaling_governor settings scaling_governor
[ -n "$scaling_governor" ] && {
echo $scaling_governor > /sys/devices/system/cpu/cpufreq/policy*/scaling_governor
for c in $(ls -d /sys/devices/system/cpu/cpufreq/policy[0-9]*); do
echo $scaling_governor > $c/scaling_governor
done
}
}

View file

@ -4,4 +4,7 @@ uci -q batch <<-EOF
add ucitrack openmptcprouter
set ucitrack.@openmptcprouter[-1].init=openmptcprouter
commit ucitrack
delete openmptcprouter.settings
set openmptcprouter.settings=openmptcprouter
commit openmptcprouter
EOF