# weird DPMS problem.... HLP!!!   [SOLVED]

## SilveRo

Hi!!!

My Dell Inspiron 8600 doesn't turn off my lcd when I close the lid, so I added to the "Monitor" section of my XF86Config:

```
Option    "DPMS"    "true"
```

and I edited my /etc/acpi/default.sh:

```
#!/bin/sh

# Default acpi script that takes an entry for all actions

set $*

group=${1/\/*/}

action=${1/*\//}

case "$group" in

        button)

                case "$action" in

                        power)  /sbin/init 0

                                ;;

                        lid)

                                lidstate="`cat /proc/acpi/button/lid/LID/state | awk '{print $2}'`"

                                 case "$lidstate" in

                                         open)   /usr/X11R6/bin/xset -display :0.0 dpms force on

 #                                               logger "LCD panel is $lidstate"

                                                 ;;

                                         closed) /usr/X11R6/bin/xset -display :0.0 dpms force off

 #                                               logger "LCD panel is $lidstate"

                                                 ;;

                                esac

                                ;;

                        *)      logger "ACPI action $action is not defined"

                                ;;

                esac

                ;;

        *)

                logger "ACPI group $group / action $action is not defined"

                ;;

esac

```

Then, as normal user (not root) I did a /etc/init.d/acpid restart, and everything seemed to work ok, but when I restarted KDE, it stopped working, untill I restarted again acpid.

With the root account, the only difference is that if I exit KDE and I re-enter it, it's still working, and even though I have to restart acpid at least once, I can do it from the console (putting acpid in /etc/conf.d/local.start or adding it with 'rc-update add acpid default' doesn't work). 

I tried editing /etc/skel/.bash_profile, but with no success (uncommented one at the time):

```
# /etc/skel/.bash_profile:

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bash_profile,v 1.10 2002/11/18 19:39:22 azarah Exp $

azarah Exp $

#xhost +

#xhost +acpi

#xhost +root

#xhost +silvero

#xhost +`hostname`

#This file is sourced by bash when you log in interactively.

[ -f ~/.bashrc ] && . ~/.bashrc

```

Does anyone have any idea how to solve this problem? (I want the screen to turn off while in KDE, when I close the lcd lid, with a normal user account, without restarting acpid)

And BTW, is there any way to turn off the screen while in console, when closing the lid?

Any help or advice would be appreciated  =)

THXXX!!!

[edited]  => BTW, I'm using the nvidia.com official drivers.... (I don't know if this is important, but I'm posting it just in case....)

----------

## SilveRo

anybody?

=)

----------

## SilveRo

Here is the output of /var/log/acpid that I get closing and reopening the LCD lid.

failure (before acpid restart):

```
[Sat Apr 10 23:42:04 2004] received event "button/lid LID 00000080 0000003b"

[Sat Apr 10 23:42:04 2004] executing action "/etc/acpi/default.sh button/lid LID 00000080 0000003b"

[Sat Apr 10 23:42:04 2004] BEGIN HANDLER MESSAGES

Xlib: connection to ":0.0" refused by server

Xlib: No protocol specified

/usr/X11R6/bin/xset:  unable to open display ":0.0"

[Sat Apr 10 23:42:04 2004] END HANDLER MESSAGES

[Sat Apr 10 23:42:04 2004] action exited with status 1

[Sat Apr 10 23:42:04 2004] completed event "button/lid LID 00000080 0000003b"

[Sat Apr 10 23:42:05 2004] received event "button/lid LID 00000080 0000003c"

[Sat Apr 10 23:42:05 2004] executing action "/etc/acpi/default.sh button/lid LID 00000080 0000003c"

[Sat Apr 10 23:42:05 2004] BEGIN HANDLER MESSAGES

Xlib: connection to ":0.0" refused by server

Xlib: No protocol specified

/usr/X11R6/bin/xset:  unable to open display ":0.0"

[Sat Apr 10 23:42:05 2004] END HANDLER MESSAGES

[Sat Apr 10 23:42:05 2004] action exited with status 1

[Sat Apr 10 23:42:05 2004] completed event "button/lid LID 00000080 0000003c"
```

success (after acpid restart):

```
[Sat Apr 10 23:42:36 2004] exiting

[Sat Apr 10 23:42:37 2004] starting up

[Sat Apr 10 23:42:37 2004] 1 rule loaded

[Sat Apr 10 23:42:39 2004] received event "button/lid LID 00000080 0000003d"

[Sat Apr 10 23:42:39 2004] executing action "/etc/acpi/default.sh button/lid LID 00000080 0000003d"

[Sat Apr 10 23:42:39 2004] BEGIN HANDLER MESSAGES

[Sat Apr 10 23:42:39 2004] END HANDLER MESSAGES

[Sat Apr 10 23:42:39 2004] action exited with status 0

[Sat Apr 10 23:42:39 2004] completed event "button/lid LID 00000080 0000003d"

[Sat Apr 10 23:42:39 2004] received event "button/lid LID 00000080 0000003e"

[Sat Apr 10 23:42:39 2004] executing action "/etc/acpi/default.sh button/lid LID 00000080 0000003e"

[Sat Apr 10 23:42:39 2004] BEGIN HANDLER MESSAGES

[Sat Apr 10 23:42:39 2004] END HANDLER MESSAGES

[Sat Apr 10 23:42:39 2004] action exited with status 0

[Sat Apr 10 23:42:39 2004] completed event "button/lid LID 00000080 0000003e"
```

----------

## SilveRo

Just discovered something new: after I restart acpid, and the lid event starts working, if I exit the superuser mode in the Konsole, or I close it, it stops working.... so I have to always keep the console open to have it working....

----------

## SilveRo

I made it work permanently adding

 *Quote:*   

> xhost local:

 

to my .bashrc file.

Even when I close the konsole the setting remains, and the lcd turns off nicely when it should. I just have to figure out how to launch the command automatically at KDE startup, instead of having to open a konsole as soon as I start KDE, but I really don't mind, I always have open konsoles, and for the moment I leave one open when I log out so it opens up when I start KDE. 

Now I just have to get rid of this ugly xhost output that I get when I open a konsole: 

"non-network local connections being added to access control list"

If anyone knows how to make xhost not be verbose (how to make it silent), please drop me a post  =)

----------

## fideli

thanks a lot for the tip.  xhost local: worked perfectly.  i figured i didn't want it in the .bashrc either so i decided to try making a kde autostart file.  first i put in in my own ~/.kde3.2/Autostart dir, but it still came up in the taskbar for a few seconds.  so i put it in the global autostart dir.  here's the code if you prefer copy-paste as opposed to click-click  :Wink:  :

```

fideli $ cat /usr/kde/3.2/share/autostart/xhost.desktop

[Desktop Entry]

Comment=

Comment[en_US]=

Encoding=UTF-8

Exec=xhost local:

GenericName=

GenericName[en_US]=

Icon=exec

MimeType=

Name=

Name[en_US]=

Path=

StartupNotify=true

Terminal=false

TerminalOptions=

Type=Application

X-DCOP-ServiceType=

X-KDE-SubstituteUID=false

X-KDE-Username=

```

it works like a charm.  thanks a lot!

----------

## SilveRo

 *fideli wrote:*   

> thanks a lot for the tip.  xhost local: worked perfectly.  i figured i didn't want it in the .bashrc either so i decided to try making a kde autostart file.  first i put in in my own ~/.kde3.2/Autostart dir, but it still came up in the taskbar for a few seconds.  so i put it in the global autostart dir.  here's the code if you prefer copy-paste as opposed to click-click  :
> 
> ```
> 
> fideli $ cat /usr/kde/3.2/share/autostart/xhost.desktop
> ...

 

Great, I'm glad my post helped you out!!!

And by the way, your script is great, it works just fine, so now it's my time to thank you!!!

----------

## Kovid

You might want to change that to xhost +local:root for greater security. Also if you want it to be executed automatically put it into ~/.xprofile

----------

## SilveRo

 *Kovid wrote:*   

> You might want to change that to xhost +local:root for greater security. Also if you want it to be executed automatically put it into ~/.xprofile

 

Putting it in the Autostart dir makes it start every time I open KDE.

Thx for the security related tip, I was aware of it, and it is a good addon to this thread for anyone who reads it. 

Personally, I only have one user account on my laptop, mine, and I have all ports closed and the default policy set to DROP, so even though I am usually quite paranoid about these things, I ignored this security issue.

Once again, it is a good thing you pointed this out, I had forgotten to do it myself. 

THX    :Smile: 

----------

## Kovid

I guess the advantage of having it in .xprofile is that its not a kde specific solution. So that if in the future you decide to switch to some other WM, you wont have to find out how to autostart it again.

And just if you want xhost to produce no output just redirect it to the null device like so

```
xhost +local:root > /dev/null 
```

----------

## SilveRo

 *Kovid wrote:*   

> I guess the advantage of having it in .xprofile is that its not a kde specific solution. So that if in the future you decide to switch to some other WM, you wont have to find out how to autostart it again.
> 
> And just if you want xhost to produce no output just redirect it to the null device like so
> 
> ```
> ...

 

nice tip, thx    :Very Happy: 

----------

## I1

 *Kovid wrote:*   

> 
> 
> I guess the advantage of having it in .xprofile is that its not a kde specific solution. So that if in the future you decide to switch to some other WM, you wont have to find out how to autostart it again. 
> 
> And just if you want xhost to produce no output just redirect it to the null device like so 
> ...

 

And yet another possibility : put the above line in /etc/xprofile. This file will be executed by kdm, but using the account of the user logging in (this is necessary for executing xset commands). This makes it unnecessary to create a ~/.xprofile for every user on your machine  :Smile: 

----------

