You are not logged in.

#1 2008-03-03 22:07:55

Reasons
Member
From: Washington
Registered: 2007-11-04
Posts: 572

/etc/acpi/handlers.sh (screen lock and suspend)

I'm trying to lock my screen with gnome-screensaver on suspend, but it doesn't. The script works as a normal user, but when run as root, like acpid would, I get:

/etc/acpi/actions/sleep.sh 
** Message: Failed to connect to the D-BUS daemon: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

The script is:

#!/bin/bash

sleep 1 &&
gnome-screensaver-command -l &&
sleep 3 &&
sudo pm-suspend --quirk-s3-bios --quirk-s3-mode &&
exit

/etc/acpi

#!/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)
        case "$2" in
            SLPB) echo -n mem >/sys/power/state ;;
            *)    logger "ACPI action undefined: $2" ;;
        esac
        ;;
    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
        #gnome-screensaver-command -l
                #pm-suspend --quirk-s3-bios --quirk-s3-mode
        action=/etc/acpi/actions/sleep.sh
        ;;
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

Offline

Board footer

Powered by FluxBB