hulk2nd wrote:
what im trying to say is, that these ac scripts only works after acpid has been started and they don't look immediatly after the state of the ac adapter. they only change something if the state changes.
If you write external scripts, you can explicitly call them at boot, though my example kinda sucks here...
With the ac_adapter, lets say your events has an entry that catchs ac_adaptor.* and calls /etc/acpi/script/ac_adaptor.sh
ac_adaptor.sh looks like this
Code: Select all
#!/bin/bash
#test for ac
grep 'on-line' /proc/acpi/ac_adapter/ACAD/state > /dev/null
if [ $? = 0 ]; then
#ac on vars
GAMMA=1.000
DPMS=600
THROTTLE=0
FREQ_MIN=66
FREQ_MAX=100
FREQ_NAME="performance"
else
#ac off vars
GAMMA=.666
DPMS=240
THROTTLE=1
FREQ_MIN=0
FREQ_MAX=0
FREQ_NAME="powersave"
fi
#check for X server
ps -A | grep X
if [ $? = 0 ]; then
#do display stuff
/usr/bin/X11/xgamma -d 0:0 -gamma $GAMMA
/usr/bin/X11/xset -d 0:0 dpms 0 0 $DPMS
fi
#check for root (does not work for acpid thus the comments)
#if [ $USER = root ]; then
#do root stuff
echo -n $THROTTLE > /proc/acpi/processor/CPU0/throttling
echo -n "0%$FREQ_MIN%$FREQ_MAX%$FREQ_NAME" > /proc/cpufreq
#fi
It works fine with acpid but at boot it gets kinda ugly! The problem is that (with my example) you need to call it with a privledged user after x has started, which rules out /etc/conf.d/local.start etc/X11/xinit/xinitrc and .kde/Autostart
One could execute it within local.start and link to it within the Autostart directory and enable all functionality but thats rather unelegant. You could also break up the individual parts in my example into 2 or more files executed at two or more times, but then you have twice as much to maintain when you change anything...in any case im not sure you need x or root stuff so...
TinheadNed wrote:Actually as I understand it, throttling isn't power saving, it's the percentage of time NOPs are sent to the CPU in an attempt to reduce power consumption and heat. It's not guaranteed to have any effect. The performance file contains true power management.
Check acpi.sourceforge.net for more information. I can't remember how to embed links off the top of my head
Thanks ned, I have problems with the performance entries in that using the 2.4 series ac kernels info says that I have them and the files are there but echoing to them gives me no change and debug messages. With the 2.6 series (tested with and without ac-patch), info lists that I do not have performance capibilities. In any case, I have compiled in the cpu-freq stuff as a viable alternative to the cpu/performance modifications (incedentally, my limit functions correctly only when I set throttling and leave performance unchanged, I think this is related to the performance errors).
For those who are interested in using cpu-freq in 2.4 series, the commands necessary are given above (the kernel docs cover writing only via the sys fs, and if i am correct, the sys fs cannot be compiled into a ac-source kernel), the commands seem to be squeemish about the values, [0-100] and do better with two distinct values, or perhaps it is my bios alone!
I noticed that severely throttling (>3 mabye) and setting cpu-fre q severly degrades proformance compared to setting cpu-freq alone, for instance at 12% and throttle of two (processor running ~400mhz) I get a subtle but noticable slowdown, for 12% and throttle of six I get a pentium 90 16mb of ram (I have one with half the ram and thus I am able to mentally benchmark)!