diff --git a/package/lean/luci-app-cpufreq/Makefile b/package/lean/luci-app-cpufreq/Makefile index f16c75f97d..f7a1440565 100644 --- a/package/lean/luci-app-cpufreq/Makefile +++ b/package/lean/luci-app-cpufreq/Makefile @@ -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 diff --git a/package/lean/luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua b/package/lean/luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua index 0101624acb..78fc09ec2f 100644 --- a/package/lean/luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua +++ b/package/lean/luci-app-cpufreq/luasrc/model/cbi/cpufreq.lua @@ -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 diff --git a/package/lean/luci-app-cpufreq/po/zh_Hans/cpufreq.po b/package/lean/luci-app-cpufreq/po/zh_Hans/cpufreq.po index af33725879..53e8d04b6d 100644 --- a/package/lean/luci-app-cpufreq/po/zh_Hans/cpufreq.po +++ b/package/lean/luci-app-cpufreq/po/zh_Hans/cpufreq.po @@ -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)。注意:过于频繁的切换频率会引起网络延迟抖动" diff --git a/package/lean/luci-app-cpufreq/root/etc/config/cpufreq b/package/lean/luci-app-cpufreq/root/etc/config/cpufreq index 0443dc7706..0e7eaede33 100644 --- a/package/lean/luci-app-cpufreq/root/etc/config/cpufreq +++ b/package/lean/luci-app-cpufreq/root/etc/config/cpufreq @@ -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' diff --git a/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq b/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq index 2a47466b9a..00379ca22b 100755 --- a/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq +++ b/package/lean/luci-app-cpufreq/root/etc/init.d/cpufreq @@ -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 }