You are not logged in.

#1 2005-07-19 03:25:24

Pakman117
Member
Registered: 2005-07-01
Posts: 7

Blanking the screen when LID button is pressed

Hi, whenever I view /var/log/acpi, I see that it logs my lid button status.  When I try to add the monitor blank command to my /etc/apci/handler.sh script, though, it does not blank the monitor.  Here is my handler.sh:

        button/lid)
                #echo "LID switched!">/dev/tty5
                echo "LID switched!"
                if grep open /proc/acpi/button/lid/LID/state; then
                    #lid opened
                else
                    /usr/X11R6/bin/xset dpms force off
                fi
                ;;

Is there another place I should put that monitoring code or should I modify it somehow?

Offline

#2 2005-07-19 07:22:15

Karma XXL
Member
From: Budapest, Hungary
Registered: 2005-06-13
Posts: 91

Re: Blanking the screen when LID button is pressed

This is just an idea.. Try changing the blanking line to this:

DISPLAY=:0 /usr/X11R6/bin/xset dpms force off

Ailen:
Kernel: Linux 2.6.14-rc4-ck1 #1 PREEMPT
Built on: Mon Oct 17 14:51:37 CEST 2005
Hardware: Mobile AMD Sempron(tm) Processor 2800+ AuthenticAMD
WM: E17 snapshot 20051016

Offline

#3 2005-07-19 15:18:52

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Blanking the screen when LID button is pressed

Karma XXL wrote:

This is just an idea.. Try changing the blanking line to this:

DISPLAY=:0 /usr/X11R6/bin/xset dpms force off

you have a point with that.  However, the handler is going to be called as root, meaning you'll have to add "xhost +localhost" to allow any local user to access the x-server.

This, however, is a bad idea... but I guess it'd work... I just checked my handlers and they don't do any blanking, but my screen does blank when closed... maybe it's just my laptop hardware though.

Offline

#4 2005-07-19 21:57:43

Pakman117
Member
Registered: 2005-07-01
Posts: 7

Re: Blanking the screen when LID button is pressed

I did as you said phrakture and now my logs say:

BEGIN HANDLER MESSAGES
/usr/X11R6/bin/xset:   unable to open display " "
LID closed

I also tried it with DISPLAY=:0 and it said something to the effect of, "no DISPLAY=:0".  Any other ideas?  Thanks.

Offline

#5 2005-07-19 22:17:27

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Blanking the screen when LID button is pressed

are you running X?
xset requires a running X server...
if not, you can use "setterm" to force the consoles off (something like setterm -powersave on, IIRC)

with X, you should run something like:

DISPLAY=:0.0
/usr/X11R6/bin/xhost +localhost
/usr/X11R6/bin/xset dpms force off

There's tons of information out on google... just search for "monitor blank acpi"

Offline

#6 2005-07-20 00:29:58

Pakman117
Member
Registered: 2005-07-01
Posts: 7

Re: Blanking the screen when LID button is pressed

Yea I'm running Xorg.  If I do 'xset dpms force off' on the command line, my monitor will blank.  I've also tried those previous commands, handler.sh just can't seem to blank my monitor.

Offline

#7 2005-07-25 06:00:19

bravo90078
Member
Registered: 2005-04-22
Posts: 18

Re: Blanking the screen when LID button is pressed

Yeah I'm trying to get the same behaviour too..

cept I have one problem.. I don't have the /proc/acpi/button/lid. I'm guessing that's the main reason why the handler hasn't been working..

I tried making a workaround I just added another event file into /etc/acpi to pass off the even to a script that checks xset info but that doesn't work neither

#!/bin/bash
if xset -q | grep -q "Monitor is On"
then
  xset dpms force off
else
  xset dpms force on
fi

but that hasn't work neither.. any ideas? the command entered through cmdline does work though..

Offline

#8 2005-07-25 07:07:10

bravo90078
Member
Registered: 2005-04-22
Posts: 18

Re: Blanking the screen when LID button is pressed

I got it... I'm using a Dell Inspiron 5100 and apparently it has issues with ACPI..  I'm using the latest kernel so all you have to do is add the option "acpi_irq_balance" to ure bootloader and the it'll work... if you got an lower ver kernel you gotta patch it with a DSDT file and there's a how-to over at acpi.sourceforge.net

Offline

#9 2005-07-26 04:39:39

Pakman117
Member
Registered: 2005-07-01
Posts: 7

Re: Blanking the screen when LID button is pressed

Could you reveal a little bit more details about your solution?  I have kernel 2.6.12, do I need to patch anything into it?  Did you use your pevious code in your own event file like you commented before or did you just edit handler.sh?  Thanks.

Offline

#10 2005-07-26 08:41:20

bravo90078
Member
Registered: 2005-04-22
Posts: 18

Re: Blanking the screen when LID button is pressed

are you using the same laptop as me? well in my case.. I'm using grub btw.. I just went to /boot/grub and added the option "acpi_irq_balance" to my bootloader file menu.lst

# (0) Arch Linux
title  Arch Linux
root   (hd0,2)
kernel /boot/vmlinuz26 root=/dev/discs/disc0/part3 ro acpi_irq_balance

then I restarted... and the inspiron will start updating events in the /proc/acpi/events file again (apparently it wasnt doing that before)

again this was for my laptop... I wouldn't know if this would work for yours or even if the DSDT table update would.. you'd have to do some more reading over at acpi.sourceforge.net

EDIT: oh fergot... the acpid handler script worked fine afterwards, as did the one I wrote..  the root problem was the events file wasn't updated not the scripts themselves

Offline

#11 2005-07-28 22:07:50

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Blanking the screen when LID button is pressed

bam!
http://web.utk.edu/~rmahurin/inspiron51 … 0000000000

This script forces x off in a much more elegant way compared to the ones posted here.

Offline

#12 2005-07-29 01:29:42

Pakman117
Member
Registered: 2005-07-01
Posts: 7

Re: Blanking the screen when LID button is pressed

Wow, crazy, that worked.  Thanks man.

Offline

Board footer

Powered by FluxBB