Gentoo Archives: gentoo-user

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

Replies

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