Previously, I wrote about installing Ubuntu Intrepid Ibex beta in my eeePC 900 here.
In the “Processor scaling” section of that post, I mentioned about setting the CPU governor to “ondemand” upon boot up. A better solution would be to set the cpu governor to “performance” if booting with AC power, and “ondemand” if booting with with battery power. However, I have not found a working fix for this at the time.
Now, I finally have an hour or so to tinkering and found a workaround.
Remove previous CPU governor setting in sysfs.conf
First, remove the previous change we made to sysfs.conf, which set the CPU governor to “ondemand” upon boot up.
Edit /etc/sysfs.conf with root privilege:
gksudo gedit /etc/sysfs.conf
Comment out or remove this line:
devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand
Add AC power detection to rc.local
Edit /etc/rc.local with root privilege:
gksudo gedit /etc/rc.local
Add these lines to the file just before the “exit 0″ line:
AC_STATE=`cat /proc/acpi/ac_adapter/AC0/state | cut -c26-` if [ "$AC_STATE" = "on-line" ] ; then /usr/bin/cpufreq-selector -g performance else /usr/bin/cpufreq-selector -g ondemand fi
Results
Now, the CPU frequency scaling is working fully as desired. When booting, the script in rc.local will check the AC power state. It will then set the CPU governor to “ondemand” if the eeePC is running in battery mode, or to “performance” if the eeePC is running in AC power mode.
Additionally, the scripts in the previous post will toggle this CPU governor when you unplug and plug the AC power.

Post a Comment