mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 09:54:06 +08:00
🌴 Sync 2026-03-05 23:51:42
This commit is contained in:
1 parent
97c049ed0a
commit
0acff03804
14253 files changed
+3893239
No files matched your search
@@ -0,0 +1,12 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#
|
||||
# Copyright (C) 2021-2022 ImmortalWrt.org
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
LUCI_TITLE:=LuCI for CPU Freq Setting
|
||||
LUCI_DEPENDS:=+cpufreq
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
@@ -0,0 +1,95 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only
|
||||
*
|
||||
* Copyright (C) 2022 ImmortalWrt.org
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
'require form';
|
||||
'require fs';
|
||||
'require uci';
|
||||
'require view';
|
||||
|
||||
return view.extend({
|
||||
load() {
|
||||
return Promise.all([
|
||||
uci.load('cpufreq'),
|
||||
L.resolveDefault(fs.exec_direct('/etc/init.d/cpufreq', [ 'get_policies' ], 'json'), {})
|
||||
]);
|
||||
},
|
||||
|
||||
render(data) {
|
||||
let m, s, o;
|
||||
|
||||
m = new form.Map('cpufreq', _('CPU Freq Settings'),
|
||||
_('Set CPU Scaling Governor to Max Performance or Balance Mode'));
|
||||
|
||||
s = m.section(form.NamedSection, 'cpufreq', 'settings');
|
||||
|
||||
if (Object.keys(data[1]).length === 0) {
|
||||
s.render = () => {
|
||||
this.handleSaveApply = null;
|
||||
this.handleSave = null;
|
||||
this.handleReset = null;
|
||||
|
||||
return E('div', { 'class': 'cbi-section warning' }, [
|
||||
E('h3', {}, _('Unsupported device!')),
|
||||
E('p', {}, _('Your device/kernel does not support CPU frequency scaling.'))
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
/* Mark user edited */
|
||||
let ss = m.section(form.NamedSection, 'global', 'settings');
|
||||
let so = ss.option(form.HiddenValue, 'set');
|
||||
so.load = (/* ... */) => { return 1 };
|
||||
so.readonly = true;
|
||||
so.rmempty = false;
|
||||
|
||||
for (let i in data[1]) {
|
||||
let index = data[1][i].index;
|
||||
s.tab(index, i, _('<h4>Apply for CPU %s.</h4>').format(data[1][i].cpus));
|
||||
|
||||
o = s.taboption(index, form.ListValue, 'governor' + index, _('CPU Scaling Governor'));
|
||||
for (let gov of data[1][i].governors)
|
||||
o.value(gov);
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.taboption(index, form.ListValue, 'minfreq' + index, _('Min Idle CPU Freq'));
|
||||
for (let freq of data[1][i].freqs)
|
||||
o.value(freq);
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.taboption(index, form.ListValue, 'maxfreq' + index, _('Max Turbo Boost CPU Freq'));
|
||||
for (let freq of data[1][i].freqs)
|
||||
o.value(freq);
|
||||
o.validate = function(section_id, value) {
|
||||
if (!section_id)
|
||||
return true;
|
||||
else if (value === null || value === '')
|
||||
return _('Expecting: %s').format('non-empty value');
|
||||
|
||||
let minfreq = this.map.lookupOption('minfreq' + index, section_id)[0].formvalue(section_id);
|
||||
if (parseInt(value) < parseInt(minfreq))
|
||||
return _('Max CPU Freq cannot be lower than Min CPU Freq.');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
o = s.taboption(index, form.Value, 'sdfactor' + index, _('CPU Switching Sampling rate'),
|
||||
_('The sampling rate determines how frequently the governor checks to tune the CPU (ms)'));
|
||||
o.datatype = 'range(1,100000)';
|
||||
o.default = '10';
|
||||
o.depends('governor' + index, 'ondemand');
|
||||
o.rmempty = false;
|
||||
|
||||
o = s.taboption(index, form.Value, 'upthreshold' + index, _('CPU Switching Threshold'),
|
||||
_('Kernel make a decision on whether it should increase the frequency (%)'));
|
||||
o.datatype = 'range(1,99)';
|
||||
o.default = '50';
|
||||
o.depends('governor' + index, 'ondemand');
|
||||
o.rmempty = false;
|
||||
}
|
||||
}
|
||||
|
||||
return m.render();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,68 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:49
|
||||
msgid "<h4>Apply for CPU %s.</h4>"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/root/usr/share/luci/menu.d/luci-app-cpufreq.json:3
|
||||
msgid "CPU Freq"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:23
|
||||
msgid "CPU Freq Settings"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:51
|
||||
msgid "CPU Scaling Governor"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:77
|
||||
msgid "CPU Switching Sampling rate"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:84
|
||||
msgid "CPU Switching Threshold"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:68
|
||||
msgid "Expecting: %s"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/root/usr/share/rpcd/acl.d/luci-app-cpufreq.json:3
|
||||
msgid "Grant access to CPUFreq configuration"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:85
|
||||
msgid "Kernel make a decision on whether it should increase the frequency (%)"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:72
|
||||
msgid "Max CPU Freq cannot be lower than Min CPU Freq."
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:61
|
||||
msgid "Max Turbo Boost CPU Freq"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:56
|
||||
msgid "Min Idle CPU Freq"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:24
|
||||
msgid "Set CPU Scaling Governor to Max Performance or Balance Mode"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:78
|
||||
msgid ""
|
||||
"The sampling rate determines how frequently the governor checks to tune the "
|
||||
"CPU (ms)"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:35
|
||||
msgid "Unsupported device!"
|
||||
msgstr ""
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:36
|
||||
msgid "Your device/kernel does not support CPU frequency scaling."
|
||||
msgstr ""
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
zh_Hans
|
||||
@@ -0,0 +1,75 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: zh-Hans\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:49
|
||||
msgid "<h4>Apply for CPU %s.</h4>"
|
||||
msgstr "<h4>应用于 CPU %s。</h4>"
|
||||
|
||||
#: applications/luci-app-cpufreq/root/usr/share/luci/menu.d/luci-app-cpufreq.json:3
|
||||
msgid "CPU Freq"
|
||||
msgstr "CPU 性能优化调节"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:23
|
||||
msgid "CPU Freq Settings"
|
||||
msgstr "CPU 性能优化调节设置"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:51
|
||||
msgid "CPU Scaling Governor"
|
||||
msgstr "CPU 工作模式"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:77
|
||||
msgid "CPU Switching Sampling rate"
|
||||
msgstr "CPU 切换周期"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:84
|
||||
msgid "CPU Switching Threshold"
|
||||
msgstr "CPU 切换频率触发阈值"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:68
|
||||
msgid "Expecting: %s"
|
||||
msgstr "请输入:%s"
|
||||
|
||||
#: applications/luci-app-cpufreq/root/usr/share/rpcd/acl.d/luci-app-cpufreq.json:3
|
||||
msgid "Grant access to CPUFreq configuration"
|
||||
msgstr "授予访问 CPUFreq 配置的权限"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:85
|
||||
msgid "Kernel make a decision on whether it should increase the frequency (%)"
|
||||
msgstr "当 CPU 占用率超过 (%) 的情况下触发内核切换频率"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:72
|
||||
msgid "Max CPU Freq cannot be lower than Min CPU Freq."
|
||||
msgstr "最大 CPU 频率不能低于最小 CPU 频率。"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:61
|
||||
msgid "Max Turbo Boost CPU Freq"
|
||||
msgstr "最大 Turbo Boost CPU 频率"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:56
|
||||
msgid "Min Idle CPU Freq"
|
||||
msgstr "待机 CPU 最小频率"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:24
|
||||
msgid "Set CPU Scaling Governor to Max Performance or Balance Mode"
|
||||
msgstr "设置路由器的 CPU 性能模式(高性能/均衡省电)"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:78
|
||||
msgid ""
|
||||
"The sampling rate determines how frequently the governor checks to tune the "
|
||||
"CPU (ms)"
|
||||
msgstr "CPU 检查切换的周期 (ms)。注意:过于频繁的切换频率会引起网络延迟抖动"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:35
|
||||
msgid "Unsupported device!"
|
||||
msgstr "不支持的设备!"
|
||||
|
||||
#: applications/luci-app-cpufreq/htdocs/luci-static/resources/view/cpufreq.js:36
|
||||
msgid "Your device/kernel does not support CPU frequency scaling."
|
||||
msgstr "您的 设备/内核 不支持 CPU 动态调频。"
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"admin/system/cpufreq": {
|
||||
"title": "CPU Freq",
|
||||
"order": 90,
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "cpufreq"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-cpufreq" ],
|
||||
"uci": { "cpufreq": true }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"luci-app-cpufreq": {
|
||||
"description": "Grant access to CPUFreq configuration",
|
||||
"read": {
|
||||
"file": {
|
||||
"/etc/init.d/cpufreq get_policies": [ "exec" ]
|
||||
},
|
||||
"uci": [ "cpufreq" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "cpufreq" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user