You are not logged in.

#1 2012-06-22 22:43:57

Starfall
Member
From: /home/
Registered: 2011-05-24
Posts: 209
Website

[SOLVED] Help needed with suspend2ram with acpid lid script

Hello smile

I'm hoping someone can help with this, I'm obviously configuing something incorrectly.

I wish to have my machine suspend to ram upon closing the lid, which I've managed to acomplish with pm-utils and acpid.

Here's my lm-lid.sh from /etc/acpi/actions:

#! /bin/sh

# lid button pressed/released event handler

#/usr/sbin/laptop_mode auto

/usr/sbin/pm-suspend

As you can see; I have commented out the penultimate line, this is what was present in the file as default, this didn't cause the machine to do anything, so I added the bottom line to call pm-suspend.

My machine suspends fine, however, upon waking again, it resumes for about 3 seconds, then suspends again... after which it wakes up fine.

So esentially I have to wake it up twice.

I'm sure it's probably something stupid I'm doing, I'd just appreciate any words on this that may help!

Last edited by Starfall (2012-06-23 23:31:00)


Visit my blog and my DeviatArt page

Offline

#2 2012-06-23 12:31:58

LoBo3268715
Member
From: WI, USA
Registered: 2012-02-23
Posts: 34

Re: [SOLVED] Help needed with suspend2ram with acpid lid script

Hi Starfall, I'm no expert here but what does your /etc/acpi/handler.sh look like? I never had to add "/usr/sbin/pm-suspend" to my lm_lid.sh

 #!/bin/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`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

set $*

case "$1" in
    button/power)
        #echo "PowerButton pressed!">/dev/tty5
        case "$2" in
            PBTN|PWRF)
                logger "PowerButton pressed: $2"
                poweroff
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    button/sleep)
        case "$2" in
            SLPB|SBTN)
                echo -n mem >/sys/power/state
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    ac_adapter)
        case "$2" in
            AC|ACAD|ADP0)
                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)
                        logger 'Battery online'
                        ;;
                    00000001)
                        logger 'Battery offline'
                        ;;
                esac
                ;;
            CPU0)
                ;;
            *)  logger "ACPI action undefined: $2" ;;
        esac
        ;;
    button/lid)
        case "$3" in
            close)
                logger 'LID closed'
                /usr/sbin/pm-suspend      <<<<<<<<<<<<<<<<<<<<<< I put it here
                ;;
            open)
                logger 'LID opened'
                ;;
            *)
                logger "ACPI action undefined: $3"
                ;;
    esac
    ;;
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

# vim:set ts=4 sw=4 ft=sh et: 

Last edited by LoBo3268715 (2012-06-23 12:33:00)


"Linux. A big, bad, scary computer operating system known only by people with neck beards."

Offline

#3 2012-06-23 23:30:43

Starfall
Member
From: /home/
Registered: 2011-05-24
Posts: 209
Website

Re: [SOLVED] Help needed with suspend2ram with acpid lid script

LoBo3268715 wrote:

Hi Starfall, I'm no expert here but what does your /etc/acpi/handler.sh look like? I never had to add "/usr/sbin/pm-suspend" to my lm_lid.sh

 #!/bin/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`
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"

set $*

case "$1" in
    button/power)
        #echo "PowerButton pressed!">/dev/tty5
        case "$2" in
            PBTN|PWRF)
                logger "PowerButton pressed: $2"
                poweroff
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    button/sleep)
        case "$2" in
            SLPB|SBTN)
                echo -n mem >/sys/power/state
                ;;
            *)
                logger "ACPI action undefined: $2"
                ;;
        esac
        ;;
    ac_adapter)
        case "$2" in
            AC|ACAD|ADP0)
                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)
                        logger 'Battery online'
                        ;;
                    00000001)
                        logger 'Battery offline'
                        ;;
                esac
                ;;
            CPU0)
                ;;
            *)  logger "ACPI action undefined: $2" ;;
        esac
        ;;
    button/lid)
        case "$3" in
            close)
                logger 'LID closed'
                /usr/sbin/pm-suspend      <<<<<<<<<<<<<<<<<<<<<< I put it here
                ;;
            open)
                logger 'LID opened'
                ;;
            *)
                logger "ACPI action undefined: $3"
                ;;
    esac
    ;;
    *)
        logger "ACPI group/action undefined: $1 / $2"
        ;;
esac

# vim:set ts=4 sw=4 ft=sh et: 

Awesome! It works perfectly! big_smile

Thanks very much LoBo3268715!


Visit my blog and my DeviatArt page

Offline

Board footer

Powered by FluxBB