You are not logged in.

#1 2007-09-02 13:52:52

krishnarao
Member
Registered: 2007-05-19
Posts: 33

Problem with acpid script execution

hi!,
Presently I'm using Don't Panic with pm-utils, cpufreqd and acpid on  a thinkpad x31.
I've put various scripts in /etc/acpid/events to handle sleep and hibernate button (Fn).
Pm-utils is working like a charm and as root I can suspend using pm-suspend and pm-hibernate.
when I press the combination of fn-f4 (for suspend) it is picked up by acpid as on (/var/log/acpig.log) but the laptop doesn't sleep or suspend. How can I ensure that the acpi scripts are run as root.
Thanks.

Offline

#2 2007-09-02 21:20:41

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Problem with acpid script execution

Just a shot in the dark, but you may want to check the event label for the SLEEP Button in the acpid scripts.  The instructions are in the acpid wiki here: http://wiki.archlinux.org/index.php/Acpid#Configuration

Basically, the default scripts assume the button is labeled SLPB, but some machines identify it differently... for example, my Dell Inspiron 6400 identifies the sleep button as SBTN instead.

Hope this helps!


thayer williams ~ cinderwick.ca

Offline

#3 2007-09-02 22:56:51

krishnarao
Member
Registered: 2007-05-19
Posts: 33

Re: Problem with acpid script execution

I've checked all that and still no resolution
Extract from /var/log/acpid.log
Sep  2 20:45:03 kpad31 acpid: received event "ibm/hotkey HKEY 00000080 00001004"
Sep  2 20:45:03 kpad31 acpid: notifying client 6439[0:0]
Sep  2 20:45:03 kpad31 acpid: client has disconnected
Sep  2 20:45:03 kpad31 acpid: notifying client 6439[0:0]
Sep  2 20:45:03 kpad31 acpid: completed event "ibm/hotkey HKEY 00000080 00001004"
this hotkey is same as sleep button
/etc/acpi/events/sleep has
#!/bin/bash
event=(button/sleep|ibm/hotkey HKEY 00000080 00001004)
#action=/etc/acpi/actions/sleep.sh
action=sudo /usr/sbin/pm-suspend

Just in a console sudo /usr/sbin/pm-suspend executes a perfect suspend-to-ram

Offline

#4 2007-09-02 23:04:42

krishnarao
Member
Registered: 2007-05-19
Posts: 33

Re: Problem with acpid script execution

I've removed the #!/bin/bash line.
Even the power button doesn't start a shutdown.
/etc/acpi/events/power is as follows:
event=(button/power PWRF 00000080 00000002)
#action=/etc/acpi/actions/hibernate.sh
action=/sbin/halt

tail /var/log/acpid.log on power button pressing
Sep  3 00:02:56 kpad31 acpid: received event "button/power PWRF 00000080 00000001"
Sep  3 00:02:56 kpad31 acpid: notifying client 5289[0:0]
Sep  3 00:02:56 kpad31 acpid: completed event "button/power PWRF 00000080 00000001"

I edited /etc/acpi/events/power to
/etc/acpi/events/power is as follows:
event=(button/power)
#action=/etc/acpi/actions/hibernate.sh
action=/sbin/halt
still no joy.

Offline

#5 2007-09-02 23:18:40

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Problem with acpid script execution

I don't own a Thinkpad so I don't know if there are special circumstances you are trying to address, but is there any reason you aren't using the default /etc/acpi/handler.sh script to perform these basic steps?  I mean, the scripts are already there, in the right format and everything... for example, to suspend with pm-utils all that you would need to do is change the command under button/sleep from this:

echo -n mem >/sys/power/state

to this:

/usr/sbin/pm-suspend

PS: acpid and pm-utils are always run as root... there's no need for sudo prefixes.

Last edited by thayer.w (2007-09-02 23:20:18)


thayer williams ~ cinderwick.ca

Offline

#6 2007-09-02 23:22:09

krishnarao
Member
Registered: 2007-05-19
Posts: 33

Re: Problem with acpid script execution

switched back to powersave as I never had a problem with it
just added
/usr/sbin/radeontool light off
to /usr/lib/powersave/scripts/prepare_suspend_to_ram
and it works like a charm
PM-utils is useless!

Offline

#7 2007-09-02 23:23:15

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Problem with acpid script execution

Just to clarify... here's a snippet from my own /etc/acpi/handler.sh:

button/sleep)
    case "$2" in
        SBTN)
            #echo -n mem >/sys/power/state
            /usr/sbin/pm-suspend
            ;;
        *)    logger "ACPI action undefined: $2" ;;
    esac
    ;;

As you can see, I simply commented the existing line and inserted the pm-suspend command.  I also changed the label of the function to SBTN, since that is how my notebook identifies the Fn+Esc (Standby) hotkey.


thayer williams ~ cinderwick.ca

Offline

#8 2007-09-02 23:25:54

krishnarao
Member
Registered: 2007-05-19
Posts: 33

Re: Problem with acpid script execution

echo -n mem fails to turn the backlight off
and in my defense I initially tried using handler.sh which is as follows
#!/bin/sh
# Default acpi script that takes an entry for all actions

# NOTE: This is a 2.6-centric script.  If you use 2.4.x, you'll have to
#       modify it to not use /sys

minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

set $*

case "$1" in
        button/power)
                #echo "PowerButton pressed!">/dev/tty5
                case "$2" in
                        PWRF)   logger "PowerButton pressed: $2" ;;
                        *)    logger "ACPI action undefined: $2" ;;
                esac
                ;;
#       button/sleep)
        ibm/hotkey HKEY 00000080 00001004)
                case "$2" in
                        SLPB) /usr/sbin/pm-suspend
#                       SLPB) echo -n mem >/sys/power/state ;;
                        *)    logger "ACPI action undefined: $2" ;;
                esac
#               /usr/sbin/pm-suspend
                ;;
        ac_adapter)
                case "$2" in
                        AC)
                                       case "$4" in
                                        00000000)
                                                echo -n $minspeed >$setspeed
                                                #/etc/laptop-mode/laptop-mode start
                                        ;;
                                        00000001)
                                                echo -n $maxspeed >$setspeed
                                                #/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)
                #echo "LID switched!">/dev/tty5
                ;;
        *)      logger "ACPI group/action undefined: $1 / $2"
        ;;

        ibm/hotkey HKEY 00000080 0000100c)
#                case "$2" in
#                SLPB) /usr/sbin/pm-hibernate
#               #SLPB) echo -n mem >/sys/power/state ;;
#                *)    logger "ACPI action undefined: $2" ;;
#                esac
                /usr/sbin/pm-hibernate
                ;;

esac

Offline

#9 2007-09-02 23:27:00

krishnarao
Member
Registered: 2007-05-19
Posts: 33

Re: Problem with acpid script execution

By the way my sleep button was always identified as SLPB
Sorry for my ignorance, I have practically no knowledge of scripts and whatever tweaking I've done is by trial and error.
I sincerely hope that powersave remains active and I feel that it's much better than pm-utils.

Last edited by krishnarao (2007-09-02 23:32:08)

Offline

#10 2007-09-02 23:41:52

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Problem with acpid script execution

I understand where you're coming from, and I don't have a lot of scripting knowledge either (I have no idea if your customized handler.sh would work as is or not).  But, unless someone else is picking up powersave, it's already dead.  The OpenSUSE developers created and maintained it, however they have since released pm-utils as its official replacement.

Last edited by thayer.w (2007-09-02 23:42:04)


thayer williams ~ cinderwick.ca

Offline

#11 2007-09-05 20:53:28

krishnarao
Member
Registered: 2007-05-19
Posts: 33

Re: Problem with acpid script execution

Got it working with pm-utils
I've used scripts from here ( http://www2.informatik.hu-berlin.de/~pi … ntoo_T43/) and have removed hander.sh
Works ok except for backlight FnF3 is set to trigger this script
#!/bin/sh
# 2006-03-07 <pille@struction.de>
#
# acpi called script to toogle radeon backlight
#
# DEPENDS radeontool

RADEONTOOL=`which radeontool`

# get current backlight state
${RADEONTOOL} light |fgrep "The radeon backlight looks on"
if [ $? == 0 ]; then
    logger -t "$0" "backlight is on. switching it off."
    ${RADEONTOOL} light off
else
    logger -t "$0" "backlight is off. switching it on."
    ${RADEONTOOL} light on
fi

When called by itself this script turns the backlight off but not with the combination key.

Offline

Board footer

Powered by FluxBB