Gentoo Archives: gentoo-user

From: BRM <bm_witness@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Laptop Lid Close...
Date: Thu, 29 Jan 2009 15:50:28
Message-Id: 997830.19555.qm@web65403.mail.ac4.yahoo.com
In Reply to: Re: [gentoo-user] Laptop Lid Close... by BRM
1 Just following up - for anyone searching the archives - the bug report mentioned below did solve the problem.
2
3 When I had added the acpid to the default run-level, I had not restarted hald before starting it, thus the script didn't get called.
4
5 Any how...it now works excellently. I use radeontool to turn off the screen, and it works without having to know about X.
6 I also send out a message via D-Bus to the KDE Desktop to initiate the screen saver on close, and turn it off on open. (I ignore the password side of the screen saver, but you can honor that too if you like).
7
8 Thanks for the help all!
9
10 Ben
11
12
13
14 ----- Original Message ----
15 From: BRM <bm_witness@×××××.com>
16 To: gentoo-user@l.g.o
17 Sent: Monday, January 26, 2009 12:59:55 PM
18 Subject: Re: [gentoo-user] Laptop Lid Close...
19
20 Cool. Thanks. That looks like it should solve the issue.
21
22 Ben
23
24
25
26 ----- Original Message ----
27 From: Gregory SACRE <gregory.sacre@×××××.com>
28 To: gentoo-user@l.g.o
29 Sent: Monday, January 26, 2009 11:32:32 AM
30 Subject: Re: [gentoo-user] Laptop Lid Close...
31
32 I've googled a bit and found these two things:
33
34 [1] http://bugs.gentoo.org/175464
35 [2] https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/51591
36
37 They both refer to problems with hald and acpid entering in conflict.
38 Check if you are using hald. If you are, try stopping it and starting
39 acpid to see if it still gives you the problem.
40
41 Concerning the fact that the script isn't called, you have to check in
42 your /etc/acpi/event/default. Make sure that you have lines such as:
43
44 event=.*
45 action=/etc/acpi/default.sh %e
46
47 Basically, it says that for any event handled by acpi, launch
48 /etc/acpi/default.sh.
49 And in /etc/acpi/default.sh, check for the "lid" event. It should look
50 like this:
51
52 [...]
53 case "$group" in
54 [...]
55 lid)
56 /etc/acpi/screen_off.sh > /tmp/screen_off 2>&1
57 [...]
58
59 where screen_off.sh is the script I sent you in my previous mail.
60
61
62 HTH,
63
64 Greg
65
66 On Sat, Jan 24, 2009 at 4:58 AM, BRM <bm_witness@×××××.com> wrote:
67 > For some reason, the script is not getting called when I press the button.
68 >
69 > That is not to say that the system doesn't recognize it - if I set KDE to put the system in stand-by when the lid is closed, it very well will. But as I said earlier, that's not what I want - I just want to turn on/off the monitor.
70 >
71 > I know kacpid is running...but I don't think acpid is...at least, when I tried /etc/init.d/acpid start it complained:
72 >
73 > * Starting acpid ...
74 > acpid: can't open /proc/acpi/event: Device or resource busy
75 >
76 > Ben
77 >
78 >
79 >
80 > ----- Original Message ----
81 > From: Gregory SACRE <gregory.sacre@×××××.com>
82 > To: gentoo-user@l.g.o
83 > Sent: Friday, January 23, 2009 2:57:31 PM
84 > Subject: Re: [gentoo-user] Laptop Lid Close...
85 >
86 > This is the script I am using. It is spawned by the default.sh from /etc/acpi:
87 >
88 > -------------------------- SCRIPT START --------------------------
89 > # default display on current host
90 > export XAUTHORITY="/home/<your_user>/.Xauthority"
91 > DISPLAY=:0.0
92 >
93 > # find out if monitor is on
94 > STATUS=`cat /proc/acpi/button/lid/LID0/state`
95 > logger "monitor: $STATUS"
96 >
97 > # find out if DPMS is enabled
98 > DPMS=`xset -display $DISPLAY -q | grep -e 'DPMS is'`
99 > logger "dpms: $DPMS"
100 >
101 > # enable DPMS if disabled
102 > if [ "$DPMS" == " DPMS is Disabled" ]
103 > then
104 > logger "Enabling DPMS ..."
105 > xset -display $DISPLAY +dpms
106 > fi
107 >
108 > if [ `echo $STATUS | grep -i closed | wc -l` -eq 1 ]
109 > then
110 > logger "[`date`] Turning display OFF"
111 > xset -display $DISPLAY dpms force off
112 > else
113 > logger "[`date`] Turning display ON" # shows up in log
114 > xset -display $DISPLAY dpms force on # turn monitor on
115 > xset -display $DISPLAY s activate # un-blank monitor
116 > fi
117 >
118 > #clean up
119 > unset STATUS
120 > unset DPMS
121 >
122 > # comment this line out if you're manually running this script from a
123 > shell (put a # in front of it)
124 > unset DISPLAY
125 >
126 > exit 0
127 > -------------------------- SCRIPT STOP --------------------------
128 >
129 > Change the <your_user> variable.
130 > I had also to set xscreensaver to switch off my monitor instead of
131 > blanking it, because I think (not sure) that xscreensaver was
132 > switching on my monitor when it was supposed to start the screensaver
133 > (as after a while, my monitor was switched back on, and as I didn't
134 > see that happening since my xscreensaver modification, I can only
135 > assume that was the problem).
136 >
137 >
138 > HTH,
139 >
140 > Greg
141 >
142 >
143 > On Fri, Jan 23, 2009 at 8:14 AM, Joshua Murphy <poisonbl@×××××.com> wrote:
144 >> On Thu, Jan 22, 2009 at 8:24 PM, BRM <bm_witness@×××××.com> wrote:
145 >>> I'm running a Dell D600, and I've located a number of tools for it but I am not seeing anything related to when I close the lid. Since I got Gentoo running on it, the Monitor continues running when I close the lid.
146 >>>
147 >>> I've found several sources for doing something as an ACPI event, which seems to be the right method. I can toggle the button with the lid open and cat /etc/acpi/button/lid/LID/state and see it change between 'open' and 'closed'; and I know I could write myself a little script do something like calling radeontool to turn off the backlight, but I'd like to find a more official method.
148 >>>
149 >>> I mostly run KDE 3.5 (I'll go to KDE4 when I can...once portage 2.2 comes out and all), but I didn't see anything for a 'turn off monitor on lid close' setting (preferrably root controlled so that it affects all users). The only thing I can find is a the standby/suspend/shutdown/logoff, system performance, and CPU throttling. I don't really want to do any of that - just put the monitor into stand-by, not necessarily the whole system.
150 >>>
151 >>> Any how...I'd really like to get this working.
152 >>>
153 >>> TIA,
154 >>>
155 >>> Ben
156 >>
157 >> In...
158 >> /etc/acpi/default.sh
159 >>
160 >> there's a comment (with commented code you can use following it)...
161 >> # if your laptop doesnt turn on/off the display via hardware
162 >> # switch and instead just generates an acpi event, you can force
163 >> # X to turn off the display via dpms. note you will have to run
164 >> # 'xhost +local:0' so root can access the X DISPLAY.
165 >>
166 >> if radeontool or something will allow you to disable the display even
167 >> when you aren't in X, or without proper access to the display (like
168 >> xset requires) you might be able to even escape needing that xhost
169 >> setting. No way of testing it at all myself though.
170 >>
171 >> --
172 >> Poison [BLX]
173 >> Joshua M. Murphy
174 >>
175 >>
176 >
177 >