# $Id$ extra_cpufreq_governor () { local cpu=$1 show_tab_header $(translate_label "${_HWSUPP_CPUFREQ_GOV}") no echo "" local governor=`cat /sys/devices/system/cpu/${cpu}/cpufreq/scaling_governor` local available=`cat /sys/devices/system/cpu/${cpu}/cpufreq/scaling_available_governors` for g in performance ondemand conservative powersave userspace do if echo $available | grep -q $g then if [ "${governor}" = "${g}" ] then local label=$(translate_label "${_HWSUPP_CPUFREQ_ACTIVE}") echo "" else local label=$(translate_label "${_HWSUPP_CPUFREQ_ACTIVATE}") echo -n "" fi fi done echo "
${g}$label
${g}" echo -n "" echo "
$label
" show_tab_footer } extra_cpufreq_setspeed () { local cpu=$1 local governor=`cat /sys/devices/system/cpu/${cpu}/cpufreq/scaling_governor` if [ "${governor}" = "userspace" ] then show_tab_header $(translate_label "${_HWSUPP_CPUFREQ_FREQ}") no echo "" local label=$(translate_label "${_HWSUPP_CPUFREQ_MHZ}") echo "" local freq=`cat /sys/devices/system/cpu/${cpu}/cpufreq/scaling_setspeed` local available=`cat /sys/devices/system/cpu/${cpu}/cpufreq/scaling_available_frequencies` for f in ${available} do if [ "${freq}" = "${f}" ] then local label=$(translate_label "${_HWSUPP_CPUFREQ_ACTIVE}") echo "" else local label=$(translate_label "${_HWSUPP_CPUFREQ_ACTIVATE}") echo -n "" fi done echo "
${label}
$((${f} / 1000))$label
$((${f} / 1000))" echo -n "" echo "
$label
" show_tab_footer fi } extra_cpufreq_stat_line () { echo "" echo "$(($1 / 1000))" echo "$2" echo "" } extra_cpufreq_stat () { local cpu=$1 if [ -e /sys/devices/system/cpu/${cpu}/cpufreq/stats/time_in_state ] then local ts=`cat /sys/devices/system/cpu/${cpu}/cpufreq/stats/time_in_state` show_tab_header $(translate_label "${_HWSUPP_CPUFREQ_STAT}") no echo "" local label=$(translate_label "${_HWSUPP_CPUFREQ_MHZ}") echo "" local label=$(translate_label "${_HWSUPP_CPUFREQ_TIME}") echo "" echo "${ts}" | while read line do extra_cpufreq_stat_line $line done echo "
${label}${label}
" show_tab_footer fi } extra_cpufreq_trans_head () { local label=$(translate_label "${_HWSUPP_CPUFREQ_TO}") echo "${label}" local label=$(translate_label "${_HWSUPP_CPUFREQ_FROM}") echo "${label}" for i in $* do echo "$(($i / 1000))" done echo "" } extra_cpufreq_trans_line () { local freq=`echo $1 | cut -d: -f1` local val=`echo $1 | cut -d: -f2` echo "" echo "$(($freq / 1000))" for i in $val do echo "$i" done echo "" } extra_cpufreq_trans () { local cpu=$1 if [ -e /sys/devices/system/cpu/${cpu}/cpufreq/stats/trans_table ] then local trans=`cat /sys/devices/system/cpu/${cpu}/cpufreq/stats/trans_table | sed '1,1d'` show_tab_header $(translate_label "${_HWSUPP_CPUFREQ_TRANS}") no echo "" echo "${trans}" | sed '1q' | cut -d: -f2 | while read line do extra_cpufreq_trans_head "$line" done echo "${trans}" | sed '1,1d' | while read line do extra_cpufreq_trans_line "$line" done echo "
" show_tab_footer fi } extra_cpufreq () { cpus=`ls /sys/bus/cpu/devices | sed 's/cpu//g'` : ${FORM_sub:=cpu0} : ${FORM_command:=} local sub_list="" for cpu in $cpus do sub_label=$(translate_label "${_HWSUPP_RC_CPU} ${cpu}") if [ "$FORM_sub" = "cpu${cpu}" ] then sub_list=`echo "$sub_list $sub_label no"` else sub_list=`echo "$sub_list $sub_label $myname?action=$FORM_action&sub=cpu${cpu}"` fi done show_tab_header $sub_list case $FORM_command in governor) if [ -n $FORM_activate ] then echo $FORM_activate > /sys/devices/system/cpu/${FORM_sub}/cpufreq/scaling_governor fi ;; setspeed) if [ -n $FORM_activate ] then echo $FORM_activate > /sys/devices/system/cpu/${FORM_sub}/cpufreq/scaling_setspeed fi ;; esac extra_cpufreq_governor ${FORM_sub} extra_cpufreq_setspeed ${FORM_sub} extra_cpufreq_stat ${FORM_sub} extra_cpufreq_trans ${FORM_sub} show_tab_footer } # _oOo_