You are not logged in.

#1 2012-01-31 21:34:11

rzepaczyk
Member
Registered: 2010-12-23
Posts: 74

ACPI AC adapter plugging in/off not recognized

Hi!

I got problem with events handling in acpi, it does not recognize any action connected with ac adapter plugging in/off. here is tail -f /var/log/messages.log:

Jan 31 22:32:29 localhost logger: ACPI action undefined: PNP0C0A:00
Jan 31 22:32:41 localhost logger: ACPI group/action undefined: processor / LNXCPU:00
Jan 31 22:32:41 localhost logger: ACPI group/action undefined: processor / LNXCPU:01
Jan 31 22:32:41 localhost kernel: [ 8350.696824] EXT4-fs (sda5): re-mounted. Opts: commit=600
Jan 31 22:32:41 localhost kernel: [ 8351.053848] EXT4-fs (sda6): re-mounted. Opts: commit=600
Jan 31 22:32:42 localhost logger: ACPI action undefined: PNP0C0A:00
Jan 31 22:32:45 localhost logger: ACPI group/action undefined: processor / LNXCPU:00
Jan 31 22:32:45 localhost logger: ACPI group/action undefined: processor / LNXCPU:01
Jan 31 22:32:46 localhost kernel: [ 8355.361473] EXT4-fs (sda5): re-mounted. Opts: commit=0
Jan 31 22:32:46 localhost kernel: [ 8355.463075] EXT4-fs (sda6): re-mounted. Opts: commit=0
Jan 31 22:32:46 localhost logger: ACPI action undefined: PNP0C0A:00

any ideas?

Offline

#2 2012-01-31 21:49:59

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: ACPI AC adapter plugging in/off not recognized

rzepaczyk wrote:

any ideas?

A few, but you leave me guessing. Could you be a bit more precise? Those messages show some events being generated. Are these related to the adapter? If so, you just need to add handlers for them, see the acpid wiki. Also, events which are being handled usually don't generate log messages; to see all events you should try acpi_listen as mentioned in the wiki (this will also show all parts, as in the wiki example, because the log doesn't show which group the undefined action PNP0C0A:00 belongs to).

Offline

#3 2012-01-31 22:03:29

rzepaczyk
Member
Registered: 2010-12-23
Posts: 74

Re: ACPI AC adapter plugging in/off not recognized

 Jan 31 22:32:29 localhost logger: ACPI action undefined: PNP0C0A:00
Jan 31 22:32:41 localhost logger: ACPI group/action undefined: processor / LNXCPU:00
Jan 31 22:32:41 localhost logger: ACPI group/action undefined: processor / LNXCPU:01
Jan 31 22:32:41 localhost kernel: [ 8350.696824] EXT4-fs (sda5): re-mounted. Opts: commit=600
Jan 31 22:32:41 localhost kernel: [ 8351.053848] EXT4-fs (sda6): re-mounted. Opts: commit=600

are related to unplugging adapter

Jan 31 22:32:42 localhost logger: ACPI action undefined: PNP0C0A:00
Jan 31 22:32:45 localhost logger: ACPI group/action undefined: processor / LNXCPU:00
Jan 31 22:32:45 localhost logger: ACPI group/action undefined: processor / LNXCPU:01
Jan 31 22:32:46 localhost kernel: [ 8355.361473] EXT4-fs (sda5): re-mounted. Opts: commit=0
Jan 31 22:32:46 localhost kernel: [ 8355.463075] EXT4-fs (sda6): re-mounted. Opts: commit=0

those are related to plugging back adapter.
acpi_listen shows:

processor LNXCPU:00 00000081 00000000
processor LNXCPU:01 00000081 00000000
ac_adapter ACPI0003:00 00000080 00000000
battery PNP0C0A:00 00000080 00000001
processor LNXCPU:00 00000081 00000000
processor LNXCPU:01 00000081 00000000
ac_adapter ACPI0003:00 00000080 00000001
battery PNP0C0A:00 00000080 00000001

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)

Offline

#4 2012-01-31 22:16:06

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: ACPI AC adapter plugging in/off not recognized

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.

Last edited by Raynman (2012-01-31 22:16:35)

Offline

#5 2012-01-31 22:46:13

rzepaczyk
Member
Registered: 2010-12-23
Posts: 74

Re: ACPI AC adapter plugging in/off not recognized

it's working, thanks for your help

Offline

Board footer

Powered by FluxBB