diff --git a/cpufreq/build.sh b/cpufreq/build.sh new file mode 100755 index 0000000..cbcfcc0 --- /dev/null +++ b/cpufreq/build.sh @@ -0,0 +1,30 @@ +#!/bin/sh + + +MODULE=cpufreq +VERSION=1.0 +TITLE=CPU频率设置 +DESCRIPTION='Intel CPU频率设置' +HOME_URL=Module_cpufreq.asp + +# Check and include base +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +if [ "$MODULE" == "" ]; then + echo "module not found" + exit 1 +fi + +if [ -f "$DIR/$MODULE/$MODULE/install.sh" ]; then + echo "install script not found" + exit 2 +fi + +# now include build_base.sh +. $DIR/../softcenter/build_base.sh + +# change to module directory +cd $DIR + +# do something here + +do_build_result diff --git a/cpufreq/config.json.js b/cpufreq/config.json.js new file mode 100644 index 0000000..4c1670a --- /dev/null +++ b/cpufreq/config.json.js @@ -0,0 +1,8 @@ +{ +"version":"1.0", +"md5":"e9ddf7d75daa25dc388ff5ef62407c6b", +"home_url":"Module_cpufreq.asp", +"title":"CPU频率设置", +"description":"Intel CPU频率设置", +"build_date":"2019-01-30_19:23:59" +} diff --git a/cpufreq/cpufreq.tar.gz b/cpufreq/cpufreq.tar.gz new file mode 100644 index 0000000..1ffa0c5 Binary files /dev/null and b/cpufreq/cpufreq.tar.gz differ diff --git a/cpufreq/cpufreq/bin/cpufreq-info b/cpufreq/cpufreq/bin/cpufreq-info new file mode 100755 index 0000000..6a65245 Binary files /dev/null and b/cpufreq/cpufreq/bin/cpufreq-info differ diff --git a/cpufreq/cpufreq/bin/cpufreq-set b/cpufreq/cpufreq/bin/cpufreq-set new file mode 100755 index 0000000..436c1eb Binary files /dev/null and b/cpufreq/cpufreq/bin/cpufreq-set differ diff --git a/cpufreq/cpufreq/install.sh b/cpufreq/cpufreq/install.sh new file mode 100644 index 0000000..1f8cf99 --- /dev/null +++ b/cpufreq/cpufreq/install.sh @@ -0,0 +1,25 @@ +#! /bin/sh + +export KSROOT=/jffs/softcenter +source $KSROOT/scripts/base.sh +find /jffs/softcenter/init.d/ -name "*cpufreq*" | xargs rm -rf +mkdir -p /jffs/softcenter/lib +cp -rf /tmp/cpufreq/bin/* /jffs/softcenter/bin/ +cp -rf /tmp/cpufreq/scripts/* /jffs/softcenter/scripts/ +cp -rf /tmp/cpufreq/webs/* /jffs/softcenter/webs/ +cp -rf /tmp/cpufreq/lib/* /jffs/softcenter/lib/ +cp -rf /tmp/cpufreq/res/* /jffs/softcenter/res/ +cp -rf /tmp/cpufreq/uninstall.sh /jffs/softcenter/scripts/uninstall_cpufreq.sh + +rm -fr /tmp/cpufreq* >/dev/null 2>&1 +chmod +x /jffs/softcenter/scripts/cpufreq*.sh +chmod +x /jffs/softcenter/scripts/uninstall_cpufreq.sh +[ ! -L "/jffs/softcenter/init.d/S99cpufreq.sh" ] && cp -rf /jffs/softcenter/scripts/cpufreq_config.sh /jffs/softcenter/init.d/S99cpufreq.sh + +dbus set cpufreq_version="1.0" +dbus set softcenter_module_cpufreq_version="1.0" +dbus set softcenter_module_cpufreq_description="Intel CPU频率设置" +dbus set softcenter_module_cpufreq_install=1 +dbus set softcenter_module_cpufreq_name=cpufreq +dbus set softcenter_module_cpufreq_title="CPU频率设置" + diff --git a/cpufreq/cpufreq/lib/libcpufreq.so b/cpufreq/cpufreq/lib/libcpufreq.so new file mode 100755 index 0000000..89e85fe Binary files /dev/null and b/cpufreq/cpufreq/lib/libcpufreq.so differ diff --git a/cpufreq/cpufreq/lib/libcpufreq.so.0 b/cpufreq/cpufreq/lib/libcpufreq.so.0 new file mode 100755 index 0000000..89e85fe Binary files /dev/null and b/cpufreq/cpufreq/lib/libcpufreq.so.0 differ diff --git a/cpufreq/cpufreq/lib/libcpufreq.so.0.0.0 b/cpufreq/cpufreq/lib/libcpufreq.so.0.0.0 new file mode 100755 index 0000000..89e85fe Binary files /dev/null and b/cpufreq/cpufreq/lib/libcpufreq.so.0.0.0 differ diff --git a/cpufreq/cpufreq/res/cpufreq_log.htm b/cpufreq/cpufreq/res/cpufreq_log.htm new file mode 100644 index 0000000..fd9be63 --- /dev/null +++ b/cpufreq/cpufreq/res/cpufreq_log.htm @@ -0,0 +1 @@ +<% nvram_dump("cpufreq.log",""); %> diff --git a/cpufreq/cpufreq/res/icon-cpufreq.png b/cpufreq/cpufreq/res/icon-cpufreq.png new file mode 100644 index 0000000..d31cb74 Binary files /dev/null and b/cpufreq/cpufreq/res/icon-cpufreq.png differ diff --git a/cpufreq/cpufreq/scripts/cpufreq_config.sh b/cpufreq/cpufreq/scripts/cpufreq_config.sh new file mode 100644 index 0000000..8e96338 --- /dev/null +++ b/cpufreq/cpufreq/scripts/cpufreq_config.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +eval `dbus export cpufreq` +start(){ +if [ "-n $cpufreq_set" ];then + [ "-z `echo ${LD_LIBRARY_PATH} |grep jffs`" ] && export LD_LIBRARY_PATH=/jffs/softcenter/lib:/lib:/usr/lib:/opt/lantiq/usr/lib:/opt/lantiq/usr/sbin/:/tmp/wireless/lantiq/usr/lib/:${LD_LIBRARY_PATH} + [ "$cpufreq_set" -gt "$cpufreq_max" ] && echo "$(date "+%F %T"): 频率设置错误" >> /tmp/cpufreq.log && exit 1 + [ "$cpufreq_set" -lt 150 ] && echo "$(date "+%F %T"): 频率设置错误" >> /tmp/cpufreq.log && exit 1 + if [ "$cpufreq_set" -eq 667 ] ;then + /jffs/softcenter/bin/cpufreq-set -f 666666 + else + /jffs/softcenter/bin/cpufreq-set -f ${cpufreq_set}MHz + fi + echo "$(date "+%F %T"): 已设置频率:${cpufreq_set}MHz" >> /tmp/cpufreq.log + /jffs/softcenter/scripts/cpufreq_status.sh +fi +} + +stop(){ +[ "-e /jffs/softcenter/init.d/S99cpufreq.sh" ] && rm -rf /jffs/softcenter/init.d/S99cpufreq.sh +} +restart() { + if [ "`dbus get cpufreq_enable`" == "1" ];then + [ "! -e /jffs/softcenter/init.d/S99cpufreq.sh" ] && cp -r /jffs/softcenter/scripts/cpufreq_config.sh /jffs/softcenter/init.d/S99cpufreq.sh + echo "$(date "+%F %T"): 已开启自动频率设置" >> /tmp/cpufreq.log + start + else + echo "$(date "+%F %T"): 插件未启用,已关闭自动频率设置" >> /tmp/cpufreq.log + stop + fi +} + +restart + diff --git a/cpufreq/cpufreq/scripts/cpufreq_status.sh b/cpufreq/cpufreq/scripts/cpufreq_status.sh new file mode 100644 index 0000000..730c0b4 --- /dev/null +++ b/cpufreq/cpufreq/scripts/cpufreq_status.sh @@ -0,0 +1,11 @@ +#!/bin/sh +[ "-z `echo ${LD_LIBRARY_PATH} |grep jffs`" ] && export LD_LIBRARY_PATH=/jffs/softcenter/lib:/lib:/usr/lib:/opt/lantiq/usr/lib:/opt/lantiq/usr/sbin/:/tmp/wireless/lantiq/usr/lib/:${LD_LIBRARY_PATH} +/jffs/softcenter/bin/cpufreq-info -c 0 > /tmp/cpufreq-info 2>&1 + +freq_cur=$(cat /tmp/cpufreq-info |grep 'current CPU' |awk '{printf $5}') +freq_max=$(cat /tmp/cpufreq-info |grep 'hardware limits' |awk '{printf $6}') + +dbus set cpufreq_cur=$freq_cur +dbus set cpufreq_max=$freq_max + + diff --git a/cpufreq/cpufreq/uninstall.sh b/cpufreq/cpufreq/uninstall.sh new file mode 100644 index 0000000..5948076 --- /dev/null +++ b/cpufreq/cpufreq/uninstall.sh @@ -0,0 +1,16 @@ +#!/bin/sh +eval `dbus export cpufreq_` +source /jffs/softcenter/scripts/base.sh + +sh /jffs/softcenter/scripts/cpufreq_config.sh stop + +find /jffs/softcenter/init.d/ -name "*cpufreq*" | xargs rm -rf +rm -rf /jffs/softcenter/bin/cpufreq-info +rm -rf /jffs/softcenter/bin/cpufreq-set +rm -rf /jffs/softcenter/res/icon-cpufreq.png +rm -rf /jffs/softcenter/scripts/cpufreq*.sh +rm -rf /jffs/softcenter/webs/Module_cpufreq.asp +rm -rf /jffs/softcenter/lib/libcpufreq.so +rm -rf /jffs/softcenter/lib/libcpufreq.so.0 +rm -rf /jffs/softcenter/lib/libcpufreq.so.0.0.0 +rm -f /jffs/softcenter/scripts/uninstall_cpufreq.sh diff --git a/cpufreq/cpufreq/webs/Module_cpufreq.asp b/cpufreq/cpufreq/webs/Module_cpufreq.asp new file mode 100644 index 0000000..13bfc7e --- /dev/null +++ b/cpufreq/cpufreq/webs/Module_cpufreq.asp @@ -0,0 +1,320 @@ + + +
+ + + + + + +