Gentoo Archives: gentoo-user

From: "Sebastian Günther" <samson@××××××××××××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Bash and ACPI issue - laptop lid
Date: Thu, 12 Mar 2009 12:13:37
Message-Id: 20090312121332.GB7039@marvin.heimnetz.local
In Reply to: [gentoo-user] Bash and ACPI issue - laptop lid by Saphirus Sage
1 * Saphirus Sage (saphirus497@×××××.com) [12.03.09 00:53]:
2 > I've been trying to setup my laptop to enter ACPI S3 (suspend to ram)
3 > when I close the lid. I currently have the scripts setup as such:
4 > /etc/acpi/events/lid
5 > event=button[ /]lid.*
6 > action=/etc/acpi/actions/lid.sh
7
8 Looks normal.
9
10 > /etc/acpi/actions/lid.sh
11 > #!/bin/bash
12 Maybe a
13 sleep 1
14 will help with your issue (or more secs...)
15 > for i in $(cat /proc/acpi/button/lid/LID/state | grep -o closed); do
16 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 This only has elements when the lid is closed, so the do
18 block will only be exexuted, if the lid is closed.
19 > if [ $i = "closed" ]; then
20 ^^^^^^^^^^^^^^^^^^^^^^^^^^
21 Therefor this is totally pointless, because we only come to
22 this point if the lid is closed and thus $i is always == "closed"
23 > /usr/sbin/pm-suspend
24 > fi
25 > if [ $i != "closed" ]; then
26 > sleep 5
27 > fi
28 This whole block will never ever be reached, so you can easily erase it.
29
30 > done
31
32 > The issue I've run into is that this will cause my laptop to suspend to
33 > the RAM upon any change in the lid state, irregardless of if it is open
34 > or closed. I tried to be more specific by utilizing the suffix of the
35 > event, but it's incremental, which is a bit beyond my abilities. Any
36 > suggestions to make this suspend only when the lid is closed?
37 >
38
39 You should test if your Desktop Environment does the suspending for you.
40 Then you have to tweak there, to get the behaviour you want.
41
42 HTH
43 Sebastian
44
45 --
46 " Religion ist das Opium des Volkes. " Karl Marx
47
48 SEB@STI@N GÜNTHER mailto:samson@××××××××××××××××.de