luci-app-cpufreq: do not set default value on first installed
This commit is contained in:
parent
6572adc184
commit
33836ed06f
@ -10,7 +10,7 @@ LUCI_TITLE:=LuCI for CPU Freq Setting
|
||||
LUCI_DEPENDS:=@(arm||aarch64)
|
||||
PKG_NAME:=luci-app-cpufreq
|
||||
PKG_VERSION:=1
|
||||
PKG_RELEASE:=5
|
||||
PKG_RELEASE:=6
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ for _, e in ipairs(governor_array) do
|
||||
if e ~= "" then governor:value(translate(e,string.upper(e))) end
|
||||
end
|
||||
|
||||
minfreq = s:option(ListValue, "minifreq", translate("Min Idle CPU Freq"))
|
||||
minfreq = s:option(ListValue, "minfreq", translate("Min Idle CPU Freq"))
|
||||
for _, e in ipairs(freq_array) do
|
||||
if e ~= "" then minfreq:value(e) end
|
||||
end
|
||||
|
||||
@ -22,6 +22,12 @@ msgstr "Ondemand 自动平衡模式"
|
||||
msgid "performance"
|
||||
msgstr "Performance 高性能模式(降低游戏转发延迟)"
|
||||
|
||||
msgid "powersave"
|
||||
msgstr "Powersave 省电模式"
|
||||
|
||||
msgid "schedutil"
|
||||
msgstr "Schedutil 自动平衡模式"
|
||||
|
||||
msgid "CPU Freq from 48000 to 716000 (Khz)"
|
||||
msgstr "CPU 频率范围为 48000 到 716000 (Khz)"
|
||||
|
||||
@ -41,5 +47,4 @@ msgid "CPU Switching Sampling rate"
|
||||
msgstr "CPU 切换周期"
|
||||
|
||||
msgid "The sampling rate determines how frequently the governor checks to tune the CPU (ms)"
|
||||
msgstr "CPU 检查切换的周期 (ms) 。注意:过于频繁的切换频率会引起网络延迟抖动"
|
||||
|
||||
msgstr "CPU 检查切换的周期 (ms)。注意:过于频繁的切换频率会引起网络延迟抖动"
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
|
||||
config settings 'cpufreq'
|
||||
option maxfreq '716000'
|
||||
option governor ''
|
||||
option minfreq ''
|
||||
option maxfreq ''
|
||||
option upthreshold '50'
|
||||
option factor '10'
|
||||
option minifreq '300000'
|
||||
option governor 'ondemand'
|
||||
|
||||
|
||||
@ -1,27 +1,24 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=50
|
||||
|
||||
NAME=cpufreq
|
||||
|
||||
uci_get_by_type() {
|
||||
local ret=$(uci get $NAME.@$1[0].$2 2>/dev/null)
|
||||
echo ${ret:=$3}
|
||||
}
|
||||
NAME="cpufreq"
|
||||
|
||||
start()
|
||||
{
|
||||
config_load cpufreq
|
||||
local governor=$(uci_get_by_type settings governor ondemand)
|
||||
local minifreq=$(uci_get_by_type settings minifreq 48000)
|
||||
local maxfreq=$(uci_get_by_type settings maxfreq 716000)
|
||||
local upthreshold=$(uci_get_by_type settings upthreshold 50)
|
||||
local factor=$(uci_get_by_type settings factor 10)
|
||||
config_get "governor" "${NAME}" "governor"
|
||||
config_get "minfreq" "${NAME}" "minfreq"
|
||||
config_get "maxfreq" "${NAME}" "maxfreq"
|
||||
config_get "upthreshold" "${NAME}" "upthreshold" "50"
|
||||
config_get "factor" "${NAME}" "factor" "10"
|
||||
|
||||
echo $governor > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
|
||||
echo $minifreq > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq
|
||||
echo $maxfreq > /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
|
||||
if [ "$governor" == "ondemand" ]; then
|
||||
echo $upthreshold > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
|
||||
echo $factor > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor
|
||||
[ -z "${governor}" ] && exit 0
|
||||
|
||||
echo "${governor}" > "/sys/devices/system/cpu/cpufreq/policy0/scaling_governor"
|
||||
echo "${minfreq}" > "/sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq"
|
||||
echo "${maxfreq}" > "/sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq"
|
||||
if [ "${governor}" = "ondemand" ]; then
|
||||
echo "${upthreshold}" > "/sys/devices/system/cpu/cpufreq/ondemand/up_threshold"
|
||||
echo "${factor}" > "/sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor"
|
||||
fi
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user