You are not logged in.

#1 2008-05-08 09:54:07

cujo
Member
Registered: 2007-03-28
Posts: 45

Suspending On Lid Close - Lenovo T61

I've installed Arch (64bit) on my Lenovo T61, and I'm trying to work out the quirks.

One of these quirks is getting the laptop to suspend when I shut the lid.  Right now, I can call pm-suspend from the command line and it works like a charm.  I can close the lid and it will "awaken" when I open said lid.  However, I can't quite figure out how to get it to call that script when I close the lid.  Anyone have any suggestions?

Offline

#2 2008-05-08 09:56:43

Husio
Member
From: Europe
Registered: 2005-12-04
Posts: 359
Website

Re: Suspending On Lid Close - Lenovo T61

Offline

#3 2008-05-09 11:36:30

cujo
Member
Registered: 2007-03-28
Posts: 45

Re: Suspending On Lid Close - Lenovo T61

Do you know if that trick is supposed to work for my make/model of laptop?  I ask because it doesn't for me.

Offline

#4 2008-05-09 14:42:37

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Suspending On Lid Close - Lenovo T61

It's supposed to work anytime you're using acpid (ie the acpid damon is running) ... .(and acpi recognizes the button/LID event, but I think that's true for almost all laptops, and certainly for T61).

Now if you want to do it this way (acpi way), then:
1) make sure acpid is installed
2) make sure acpid is running
3) just close and open lid -> have a look at /var/log/acpid.log, it should have lines relating to button/lid event at the end
4) have a look at, and edit, /etc/acpi/handler.sh (adding something like it's at that link to the appropriate place)
That should be sufficient.

Now if you're using KDE or GNOME, there might be some other (gui) way to configure these DE's to achieve this (kpowersave/gnome-power-manager) ... but I'm not sure (I don't use them).

Finally, there's probably a way to achieve this also with hal, but I'm no good in understanding hal's .fdi rules.

Offline

#5 2008-05-09 15:03:59

cujo
Member
Registered: 2007-03-28
Posts: 45

Re: Suspending On Lid Close - Lenovo T61

Yikes.  I guess I had a brain cramp.  I just copy/pasted from that link as per the instructions without thinking.  The path was just off.  It works if I use the following path instead....

/proc/acpi/button/lid/LID0/state

Thanks all.

Offline

#6 2008-07-09 22:09:28

b4d
Member
From: Slovenia
Registered: 2008-07-06
Posts: 62
Website

Re: Suspending On Lid Close - Lenovo T61

I'll borrow this thread a little.

I am trying to power off my screen when I close the lid, my lm_lid.sh is:

#! /bin/sh

if [[ `cat /proc/acpi/button/lid/LID/state | tr -s " " | cut -d" " -f2` = "closed" ]]
then
        echo closed > /dev/pts/1
        /usr/bin/xset dpms force off
fi

test -f /usr/sbin/laptop_mode || exit 0

# lid button pressed/released event handler
/usr/sbin/laptop_mode auto

but it doesn't work, echo closed is run, xset not, but if I run xset from terminal it power offs screen normally, I even tried copying the whole if statement to other script, and it power off the screen again. Anybody has any idea what is going on? Ty.


EDIT: Found the solution http://lurker.gentoo-wiki.com/HOWTO_Aut … ur_monitor needed the xauth.

Last edited by b4d (2008-07-09 22:17:19)

Offline

#7 2008-07-09 22:17:14

timetrap
Member
From: Here and There
Registered: 2008-06-05
Posts: 342
Website

Re: Suspending On Lid Close - Lenovo T61

Here is my lm_lid.sh

if grep -q open /proc/acpi/button/lid/LID/state
then
        XAUTHORITY=/var/run/slim.auth /usr/bin/xset -display :0.0 dpms force on
        /usr/sbin/laptop_mode auto
        /usr/bin/logger dpms force on
        /usr/bin/logger $XAUTHORITY
else
        XAUTHORITY=/var/run/slim.auth /usr/bin/xset -display :0.0 dpms force off
        /usr/in/logger dpms force off
        /usr/bin/logger $XAUTHORITY
fi

Now, you will need to be sure to check for your XAUTHORITY

ps aux | grep X

Your output should show something like "-auth /path/to/file", change  the XAUTHORITY variable in the above config and it should work.

Offline

#8 2008-07-27 19:00:13

Flying Saxman
Member
From: Northern Hesse
Registered: 2007-02-26
Posts: 252

Re: Suspending On Lid Close - Lenovo T61

For some reason I can't find a lm_lid.sh and the directory /etc/acpi/actions does not even exist. And yes, I do have acpi and acpid installed. Is it possible, that newer versions of acpi/acpid need another workaround for this?

Offline

#9 2008-07-27 20:57:23

stylopath
Member
Registered: 2007-07-26
Posts: 112

Re: Suspending On Lid Close - Lenovo T61

AFAIK you will now have to take a look at /etc/acpid/handler.sh

Hessische Grüße wink

Offline

#10 2008-07-28 14:46:19

Flying Saxman
Member
From: Northern Hesse
Registered: 2007-02-26
Posts: 252

Re: Suspending On Lid Close - Lenovo T61

maybe it is /etc/acpi/handler.sh (see: acpi, not acpid!), it does exist, but acpid crashes at starting, so I'll reboot, to be able to test it.

Danke! Gruß zurück in's Hessenland! Bin gerade allerdings in Berlin, boah, die Berliner Schnute ist ja teilweise noch schlimmer, als das südhessische Gebabbel!


Update: It works! Thank you sooooo much!

Last edited by Flying Saxman (2008-07-28 18:39:24)

Offline

#11 2008-07-28 21:50:05

stylopath
Member
Registered: 2007-07-26
Posts: 112

Re: Suspending On Lid Close - Lenovo T61

Nice to hear that smile

Offline

#12 2008-07-29 14:43:43

Flying Saxman
Member
From: Northern Hesse
Registered: 2007-02-26
Posts: 252

Re: Suspending On Lid Close - Lenovo T61

just one more question: I'd like to have my KDE4-Session locked after resuming, because it is a laptop and so it is thought for using it "on the road" and so on. But unfortunately I do have NO idea, how to solve this problem. Any suggestions/ideas?

Offline

#13 2008-07-30 10:39:17

stylopath
Member
Registered: 2007-07-26
Posts: 112

Re: Suspending On Lid Close - Lenovo T61

There should be a configuration file for actions performed after/during restore (at least uswsusp has this functionality, so i expect pm-utils to do so either).
I will look for that file when i'm at a linux box again (using vista at work atm *ugly).

In that file you should place the command for locking the screen. For gnome for example:

gnome-screensaver-command -lock

for Xscreensaver:

xscreensaver-command --lock

I don't know which screensaver-daemon kde uses, but it shouldn't be too difficult to find it out.

*EDIT* found at google:
dcop kdesktop KScreensaverIface lock

you could try that on the konsole.

*EDIT2*This should help:
http://de.opensuse.org/Pm-utils#pm-util … Generation

Seems to me like you'd have to add an own hook that runs "dcop kdesktop KScreensaverIface lock" on resume, perhaps after waiting a few seconds (depends on kdesktops state, i.e. if it is already ready again).

Last edited by stylopath (2008-07-30 10:48:50)

Offline

Board footer

Powered by FluxBB