LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 08-06-2005, 09:09 PM   #1
gradedcheese
Member
 
Registered: Nov 2003
Posts: 59

Rep: Reputation: 15
modifying ACPI scripts?


I have Ubuntu 5.04 on my IBM ThinkPad T22, which was set up with ACPI. When the alptop is on my desk, it's connected to an external monitor and I switch the ThinkPad to use only that monitor as the display. I then want to close the lid and set the laptop aside, but the closing of the lid causes ACPI to shut off all screens and locks X.

There don't seem to be any ACPI-related configuration programs included so I started looking at the scripts in /etc/acpi. It knows when the AC adapter is plugged in and when the lid is closed it runs this script:

Code:
#!/bin/sh

. /usr/share/acpi-support/power-funcs

getXuser;

grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
        . /usr/share/acpi-support/screenblank
        echo `fgconsole` > $LIDSTATE
        chvt 12
else
        grep -q off-line /proc/acpi/ac_adapter/*/state
        if [ $? = 1 ]
        then
                su - $user -c "xscreensaver-command -unthrottle"
        fi
        chvt `cat $LIDSTATE`
        su - $user -c "xscreensaver-command -deactivate"
fi

[ -x /etc/acpi/local/lid.sh.post ] && /etc/acpi/local/lid.sh.post
Can I modify this to make do something like "if the lid is closed and the AC adapter is not plugged in (ie: on battery), turn off the screen. Otherwise, do nothing"? -- I think that at least this way the hardware will shut off the built-in screen but the external monitor will keep working fine. If so, how would I go about doing it?

And, perhaps a better question: any assugestions for how to set this stuff up the way I need it to work?

Thanks.
 
Old 09-15-2005, 05:21 PM   #2
six6
Member
 
Registered: Jun 2004
Location: In Adamantine Chains and penal Fire
Distribution: Debian Sarge & Ubuntu Breezy
Posts: 107

Rep: Reputation: 16
I suppose you've managed to figure this out over the course of the last month without a post (!), but if not, here's what's happening (as related to the lid):

We're checking to see if /proc/acpi/button/lid/LID/state says "open" or "closed". If it's closed, we run /usr/share/acpi-support/screenblank (which locks the screen via xscreensaver), otherwise we wake the computer back up.

If you want to disable xscreensaver from locking the computer, just move the screenblank script to somewhere else, or comment out the line about "xscreensaver --lock".
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VPN: Debian Scripts -> Mandriva 2006 Scripts Undefined Mandriva 0 11-30-2005 12:10 PM
ACPI scripts ? dimgr Linux - Laptop and Netbook 2 01-04-2005 06:56 PM
Am I modifying the startup scripts correctly? BajaNick Linux - General 3 07-04-2004 01:26 PM
acpi (no /proc/acpi)??? JimDog Linux - Newbie 2 01-25-2004 12:14 AM
kernel 2.4.20 & acpi-20021212-2.4.20.diff => no /proc/acpi Tinkster Linux - Software 5 03-24-2003 01:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration