12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- #!/bin/sh
- #BK got this from http://murga-linux.com/puppy/viewtopic.php?t=55417&start=15
- # but added test for /proc/acpi, bios-date, processor-manufacturer.
- # added extra code provided by pakt.
- #100603 gamble, any CPU >=2007 can handle acpi-cpufreq, or it will fail to load.
- #101014 improve test for older computers, and fix menu --well no probably not the latter.
- #101114 rerwin: refine usage of dmidecode.
- #disable freq scaling for older computers...
- #[ ! -d /proc/acpi ] && FLAGEXIT='yes'
- if [ ! -d /proc/acpi ];then #101114
- FLAGEXIT='yes'
- else
- [ `dmidecode -s "bios-release-date" | cut -f 3 -d '/' | rev | cut -c 1,2 | rev` -lt 7 ] && FLAGEXIT='yes' #<2006 100603: <2007 101014
- fi
- if [ "$FLAGEXIT" = "yes" ];then #101014
- # if [ -f /usr/share/applications/cpu_freq.desktop ];then
- # rm -f /usr/share/applications/cpu_freq.desktop
- # fixmenus
- # #[ "`pidof jwm`" != "" ] && jwm -restart #ideally should do this, but with any luck user will look at this item after next boot.
- # fi
- exit
- fi
- #INTEL='p4-clockmod speedstep-centrino speedstep-ich'
- #VIA='longhaul e_powersaver'
- #CYRIX='gx-suspmod'
- FREQMODS="acpi-cpufreq"
- case "$1" in
- start)
- #CPUMAN="`dmidecode -s 'processor-manufacturer' | tr '[A-Z]' '[a-z]' | cut -f 1 -d ' '`"
- #case $CPUMAN in
- # intel) FREQMODS="${INTEL} acpi-cpufreq" ;;
- # via) FREQMODS="${VIA} acpi-cpufreq" ;;
- # cyrix) FREQMODS="${CYRIX} acpi-cpufreq" ;;
- #esac
- for ONEMOD in $FREQMODS
- do
- modprobe $ONEMOD
- if [ $? -eq 0 ];then
- modprobe cpufreq_ondemand
- if [ $? -eq 0 ];then
- for CPUNUM in `ls -1 /sys/devices/system/cpu/ | grep 'cpu[0-9]' | tr '\n' ' '`
- do
- echo ondemand >/sys/devices/system/cpu/$CPUNUM/cpufreq/scaling_governor
- done
- #echo > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
- #echo > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
- #echo > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
- #echo > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
- break
- else
- rmmod $ONEMOD
- fi
- fi
- done
- ;;
- esac
|