You are not logged in.

#1 2009-05-11 19:13:15

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

pm-suspend, /etc/acpi/handler.sh, lid switch

Hi,

Will anybody please publish a modified /etc/acpi/handler.sh file where pm-suspend iis called on closing of the lid? I tried snippets found in various places, but no success. Probably because I can't really read bash code...

Offline

#2 2009-05-11 19:28:02

SiD
Member
From: Germany
Registered: 2006-09-21
Posts: 729

Re: pm-suspend, /etc/acpi/handler.sh, lid switch

this code (from german wiki)executes slock if the lid-button is pressed.

   button/lid)
       #echo "LID switched!">/dev/tty5
       if [ `/bin/awk '{print $2}' /proc/acpi/button/lid/LID/state` == closed ]; then
               DISPLAY=:0 su -c - $USER /usr/bin/slock
       fi
       ;;
   *)
       logger "ACPI group/action undefined: $1 / $2"
       ;;

replacing the line

DISPLAY=:0 su -c - $USER /usr/bin/slock

with the command for pm-suspend should do it.

p.s.
I don't know much about pm-suspend. wink

Offline

#3 2009-05-11 19:30:53

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: pm-suspend, /etc/acpi/handler.sh, lid switch

It's me, your own suspend helper!

I simply have

event=button/lid (LID0)
action=/usr/sbin/pm-suspend

in /etc/acpi/events. If it doesn't work, use acpi_listen to get the name of the event.

Last edited by lucke (2009-05-11 19:31:39)

Offline

#4 2009-05-11 19:49:45

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: pm-suspend, /etc/acpi/handler.sh, lid switch

lucke wrote:

It's me, your own suspend helper!

Happy to hear from you again!

I've got this file (/etc/acpi/events/anything):

# Pass all events to our one handler script
event=.*
action=/etc/acpi/handler.sh %e

How exactly am I supposed to modify it? Sorry for a dumb question, by I tread on a totally unfamiliar ground smile .

UPD:

My acpi_listen output (close/open):

# acpi_listen
button/lid LID 00000080 00000003
video VGA 00000080 00000000
button/lid LID 00000080 00000004
video VGA 00000080 00000000

Last edited by Llama (2009-05-11 19:58:39)

Offline

#5 2009-05-11 20:04:58

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: pm-suspend, /etc/acpi/handler.sh, lid switch

Just create another file, named e.g. lid, in that dir, and put the contents I provided there, possibly changing (LID0) to (LID). I think you have to /etc/rc.d/acpid restart to make the changes register.

Ku.

Last edited by lucke (2009-05-11 20:05:34)

Offline

#6 2009-05-11 20:30:55

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: pm-suspend, /etc/acpi/handler.sh, lid switch

Thanks again!

Now I've got two files:

/etc/acpi/events/anything:

# Pass all events to our one handler script
event=.*
action=/etc/acpi/handler.sh %e

/etc/acpi/events/lid:

event=button/lid (LID)
action=/usr/sbin/pm-suspend

Is it just as it's supposed to be? It works, at last, unless I'm overlooking something important smile ...

Offline

#7 2009-05-11 20:37:35

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: pm-suspend, /etc/acpi/handler.sh, lid switch

It is how it should be.

Offline

#8 2009-05-11 20:51:19

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: pm-suspend, /etc/acpi/handler.sh, lid switch

Yes, I did overlook something smile : first time after reboot it works properly: there's a system sound on closing; on opening I'm presented with the unlock password request. Second time there's no system sound and no password request, though the power LED is slowly blinking red, as on the first time. On the third time in won't suspend at all.

Meanwhile the Sleep button on the Power applet works properly every time.

Last edited by Llama (2009-05-11 20:53:02)

Offline

Board footer

Powered by FluxBB