SOLVED: Disabling laptop lid-close action

Need help with peripherals or devices?
Post Reply
Message
Author
Chili.Willy
Posts: 13
Joined: 2009-10-01 01:57
Location: Wisconsin, USA

SOLVED: Disabling laptop lid-close action

#1 Post by Chili.Willy »

Dell Latitude C610 laptop with Debian Squeeze.

I am using the computer as a print and file server, accessing it with ssh, so I don't need the display (which is busted anyway).

I want to close the lid without having the computer suspend. Could not find a way to make it happen with gnome-power-preferences or the BIOS settings.

There is a script, /etc/acpi/lid.sh, that runs when the laptop lid switch changes. Part of the script is shown here:

Code: Select all

grep -q closed /proc/acpi/button/lid/*/state # this is a file of 1 line like "state:   open" or presumably "state:   closed"
 if [ $? = 0 ]                               # The brackets evaluate to True when the lid is closed. 
then
    if [ x$LID_SLEEP = xtrue ]; then
        [ -x /etc/acpi/sleep.sh ] && /etc/acpi/sleep.sh # i.e., if this file exists, then run it.
        exit
    fi
... there's more ...
 
The stuff that gets executed after the if [ #$ = 0 ] is the stuff that suspends the computer. So I just replaced the brackets with something that is certain to be false, so it will never happen:

Code: Select all

if [ 1 = 2 ] 
I admit this is FAR from an elegant solution, but it seems to work and it doesn't fubar the system. Maybe someone else can use it.

By the way, if anyone can tell me what the x's mean in this line, I'd be grateful.

Code: Select all

if [ x$LID_SLEEP = xtrue ]

User avatar
dilberts_left_nut
Posts: 5127
Joined: 2009-10-05 07:54
Location: enzed
Been thanked: 1 time

Re: SOLVED: Disabling laptop lid-close action

#2 Post by dilberts_left_nut »

I suspect it is just to avoid any potential problems with a NULL value.

i.e if $LID_SLEEP is undefined then 'x$LID_SLEEP' is 'x' rather than NULL

/etc/default/acpi-support contains

Code: Select all

# Uncomment this to enable ACPI sleep when the lid screen is closed.
#LID_SLEEP=true
so in theory uncommenting this and setting it to false would be the "correct" method, however there may be other places this variable is set, like by a DE's power manager tool or such.
AdrianTM wrote:There's no hacker in my grandma...

Michael S.
Posts: 1
Joined: 2015-02-15 19:56

Wheezy

#3 Post by Michael S. »

In Wheezy, inspired by the Wiki page on suspension, I achieved this by commenting out the action line in /etc/acpi/events/lid:

Code: Select all

event=button/lid LID [^o]
#action=/etc/acpi/actions/lid.sh

Dhokahai1
Posts: 1
Joined: 2015-02-19 12:36

Re: SOLVED: Disabling laptop lid-close action

#4 Post by Dhokahai1 »

HPLIP is in the Debian repositories and does not need libtool. We have to ask, where did you get your HPLIP?




____________________

Save your time and get on time success in Certkiller ccnp security books toefl exams by using our latest comptia a+ certification 220-801 and other superb pittstate resources of examsheets and Nova Southeastern University

Post Reply