Gentoo Archives: gentoo-user

From: BRM <bm_witness@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Laptop Lid Close...
Date: Mon, 26 Jan 2009 18:01:19
Message-Id: 845545.62755.qm@web65406.mail.ac4.yahoo.com
In Reply to: Re: [gentoo-user] Laptop Lid Close... by Gregory SACRE
1 Cool. Thanks. That looks like it should solve the issue.
2
3 Ben
4
5
6
7 ----- Original Message ----
8 From: Gregory SACRE <gregory.sacre@×××××.com>
9 To: gentoo-user@l.g.o
10 Sent: Monday, January 26, 2009 11:32:32 AM
11 Subject: Re: [gentoo-user] Laptop Lid Close...
12
13 I've googled a bit and found these two things:
14
15 [1] http://bugs.gentoo.org/175464
16 [2] https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/51591
17
18 They both refer to problems with hald and acpid entering in conflict.
19 Check if you are using hald. If you are, try stopping it and starting
20 acpid to see if it still gives you the problem.
21
22 Concerning the fact that the script isn't called, you have to check in
23 your /etc/acpi/event/default. Make sure that you have lines such as:
24
25 event=.*
26 action=/etc/acpi/default.sh %e
27
28 Basically, it says that for any event handled by acpi, launch
29 /etc/acpi/default.sh.
30 And in /etc/acpi/default.sh, check for the "lid" event. It should look
31 like this:
32
33 [...]
34 case "$group" in
35 [...]
36 lid)
37 /etc/acpi/screen_off.sh > /tmp/screen_off 2>&1
38 [...]
39
40 where screen_off.sh is the script I sent you in my previous mail.
41
42
43 HTH,
44
45 Greg
46
47 On Sat, Jan 24, 2009 at 4:58 AM, BRM <bm_witness@×××××.com> wrote:
48 > For some reason, the script is not getting called when I press the button.
49 >
50 > 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.
51 >
52 > I know kacpid is running...but I don't think acpid is...at least, when I tried /etc/init.d/acpid start it complained:
53 >
54 > * Starting acpid ...
55 > acpid: can't open /proc/acpi/event: Device or resource busy
56 >
57 > Ben
58 >
59 >
60 >
61 > ----- Original Message ----
62 > From: Gregory SACRE <gregory.sacre@×××××.com>
63 > To: gentoo-user@l.g.o
64 > Sent: Friday, January 23, 2009 2:57:31 PM
65 > Subject: Re: [gentoo-user] Laptop Lid Close...
66 >
67 > This is the script I am using. It is spawned by the default.sh from /etc/acpi:
68 >
69 > -------------------------- SCRIPT START --------------------------
70 > # default display on current host
71 > export XAUTHORITY="/home/<your_user>/.Xauthority"
72 > DISPLAY=:0.0
73 >
74 > # find out if monitor is on
75 > STATUS=`cat /proc/acpi/button/lid/LID0/state`
76 > logger "monitor: $STATUS"
77 >
78 > # find out if DPMS is enabled
79 > DPMS=`xset -display $DISPLAY -q | grep -e 'DPMS is'`
80 > logger "dpms: $DPMS"
81 >
82 > # enable DPMS if disabled
83 > if [ "$DPMS" == " DPMS is Disabled" ]
84 > then
85 > logger "Enabling DPMS ..."
86 > xset -display $DISPLAY +dpms
87 > fi
88 >
89 > if [ `echo $STATUS | grep -i closed | wc -l` -eq 1 ]
90 > then
91 > logger "[`date`] Turning display OFF"
92 > xset -display $DISPLAY dpms force off
93 > else
94 > logger "[`date`] Turning display ON" # shows up in log
95 > xset -display $DISPLAY dpms force on # turn monitor on
96 > xset -display $DISPLAY s activate # un-blank monitor
97 > fi
98 >
99 > #clean up
100 > unset STATUS
101 > unset DPMS
102 >
103 > # comment this line out if you're manually running this script from a
104 > shell (put a # in front of it)
105 > unset DISPLAY
106 >
107 > exit 0
108 > -------------------------- SCRIPT STOP --------------------------
109 >
110 > Change the <your_user> variable.
111 > I had also to set xscreensaver to switch off my monitor instead of
112 > blanking it, because I think (not sure) that xscreensaver was
113 > switching on my monitor when it was supposed to start the screensaver
114 > (as after a while, my monitor was switched back on, and as I didn't
115 > see that happening since my xscreensaver modification, I can only
116 > assume that was the problem).
117 >
118 >
119 > HTH,
120 >
121 > Greg
122 >
123 >
124 > On Fri, Jan 23, 2009 at 8:14 AM, Joshua Murphy <poisonbl@×××××.com> wrote:
125 >> On Thu, Jan 22, 2009 at 8:24 PM, BRM <bm_witness@×××××.com> wrote:
126 >>> 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.
127 >>>
128 >>> 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.
129 >>>
130 >>> 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.
131 >>>
132 >>> Any how...I'd really like to get this working.
133 >>>
134 >>> TIA,
135 >>>
136 >>> Ben
137 >>
138 >> In...
139 >> /etc/acpi/default.sh
140 >>
141 >> there's a comment (with commented code you can use following it)...
142 >> # if your laptop doesnt turn on/off the display via hardware
143 >> # switch and instead just generates an acpi event, you can force
144 >> # X to turn off the display via dpms. note you will have to run
145 >> # 'xhost +local:0' so root can access the X DISPLAY.
146 >>
147 >> if radeontool or something will allow you to disable the display even
148 >> when you aren't in X, or without proper access to the display (like
149 >> xset requires) you might be able to even escape needing that xhost
150 >> setting. No way of testing it at all myself though.
151 >>
152 >> --
153 >> Poison [BLX]
154 >> Joshua M. Murphy
155 >>
156 >>
157 >
158 >

Replies

Subject Author
Re: [gentoo-user] Laptop Lid Close... BRM <bm_witness@×××××.com>