You are not logged in.

#1 2011-10-08 18:08:49

mofro
Member
Registered: 2011-09-21
Posts: 3

Easier suspend

Ever since I installed linux I always had trouble getting the computer to suspend (also happened with ubuntu and debian), but now I have finally found a way to get my computer to suspend properly
i have to run the command:

sudo s2ram --force --acpi_sleep 2

Anyway, does anyone know of a way I can do this without having to add all the extra detail, or even just integrate it to the gui, also what does acpi_sleep actually mean?

Last edited by mofro (2011-10-08 18:10:47)

Offline

#2 2011-10-08 20:20:21

Stebalien
Member
Registered: 2010-04-27
Posts: 1,237
Website

Re: Easier suspend

1. You can use an alias. Add the following to your ~/.bashrc and run suspend when you want to suspend.

alias suspend="sudo s2ram --force --acpi_sleep 2"

2. Install acpi (if you don't have it already) and edit /etc/acpi/handler.sh.
  To get the sleep/suspend button working, change line 23 from

            SLPB)   echo -n mem >/sys/power/state ;;

to

            SLPB)   s2ram --force --acpi_sleep 2 ;;

To have your computer suspend when you close the lid and are on battery power, add the following under 'button/lid)'

        if [ -n "$(cat /proc/acpi/ac_adapter/AC/state|grep off-line)" -a -n "$(cat /proc/acpi/button/lid/LID/state|grep closed)" ]; then
            pm-suspend
        fi

Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

#3 2011-10-08 20:31:28

SS4
Member
From: !Rochford, Essex
Registered: 2010-12-05
Posts: 699

Re: Easier suspend

To add to Stebalien's option 1 you can grant your user permission to run that command without needing a password by adding the following to your sudoers file (with visudo)

user ALL=NOPASSWD:/usr/sbin/s2ram

Replace user with your username

Last edited by SS4 (2011-10-08 20:32:09)


Rauchen verboten

Offline

#4 2011-10-10 19:27:10

mofro
Member
Registered: 2011-09-21
Posts: 3

Re: Easier suspend

thanks guys, I used option 1 and it worked, for option 2, do I replace what's underneath 'button/lid' or do I just paste it underneath whats already there?

Offline

#5 2011-10-10 22:07:21

Stebalien
Member
Registered: 2010-04-27
Posts: 1,237
Website

Re: Easier suspend

mofro wrote:

thanks guys, I used option 1 and it worked, for option 2, do I replace what's underneath 'button/lid' or do I just paste it underneath whats already there?

Post your handler.sh.


Steven [ web : git ]
GPG:  327B 20CE 21EA 68CF A7748675 7C92 3221 5899 410C
Do not email: honeypot@stebalien.com

Offline

Board footer

Powered by FluxBB