If I unplug my laptop from the AC adapter, I will get ACPI errors like these ...
Isso foi sugerido em: " Adaptador AC ACPI conectado / desligado não reconhecido ".
rzepaczyk - My handler.sh:
# Default acpi script that takes an entry for all actions
minspeed='cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq'
maxspeed='cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq'
setspeed1="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
setspeed2="/sys/devices/system/cpu/cpu1/cpufreq/scaling_setspeed"
setspeed3="/sys/devices/system/cpu/cpu2/cpufreq/scaling_setspeed"
setspeed4="/sys/devices/system/cpu/cpu3/cpufreq/scaling_setspeed"
set $*
case "$1" in
button/power)
#echo "PowerButton pressed!">/dev/tty5
case "$2" in
PBTN|PWRF) logger "PowerButton pressed: $2" ;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
button/sleep)
case "$2" in
SLPB) echo -n mem >/sys/power/state ;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
ac_adapter)
case "$2" in
AC*|ACAD*|ADP0*|AD*)
case "$4" in
00000000)
echo -n $minspeed >$setspeed1
echo -n $minspeed >$setspeed2
echo -n $minspeed >$setspeed3
echo -n $minspeed >$setspeed4
#/etc/laptop-mode/laptop-mode start
;;
00000001)
echo -n $maxspeed >$setspeed1
echo -n $maxspeed >$setspeed2
echo -n $maxspeed >$setspeed3
echo -n $maxspeed >$setspeed4
#/etc/laptop-mode/laptop-mode stop
;;
esac
;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
battery)
case "$2" in
BAT0)
case "$4" in
00000000) #echo "offline" >/dev/tty5
;;
00000001) #echo "online" >/dev/tty5
;;
esac
;;
CPU0)
;;
*) logger "ACPI action undefined: $2" ;;
esac
;;
button/lid)
case "$3" in
close)
#echo "LID closed!">/dev/tty5
;;
open)
#echo "LID opened!">/dev/tty5
;;
esac
;;
*)
logger "ACPI group/action undefined: $1 / $2"
;;
esac
What I'm trying to do is to set cpu governor to ondemand when adapter is plugged in and powersave when adapter is unplugged. I saw that actions are undefined so I assumed that acpi is not recognizing actions (even with this:
ac_adapter)
case "$2" in
AC*|ACAD*|ADP0*|AD*)
)
entries in handler.sh .
Raynman - Looks like they are handled. acpi_listen shows ac_adapter events in addition to the undefined events that showed up in the log. These are handled by the case in your last quote. Then you have another case statement on $4 to distinguish between plugging (00000001) and unplugging (00000000). If you replace those echo statements by a call to cpufreq-set (or whatever else you can think of), it should work.
rzepaczyk - It's working, thanks for your help.