You are not logged in.

#1 2012-04-04 12:56:14

Troglodyte
Member
Registered: 2012-04-04
Posts: 14

[partly SOLVED] Controlling the uswsusp s2both feature with acpid

Hi,

I am currently using uswsusp on my laptop to suspend to both disk and RAM, which works flawlessly by using the

$ s2both

command.

Now, I would like to use acpid to execute that command and also lock my screen using my display manager which is xdm, whenever I close the lid of my laptop and resume once I open it again.

passing

acpi_listen

and then closing and opening the lid gives me:

button/lid LID close
button/lid LID open

Next I created the following file: /etc/acpi/events/lid_close
It contains:

event=button/lid LID close.*
action=/etc/acpi/actions/lid_close.sh "%e"

The problem is, that I have no idea what the corresponding lid_close.sh script would need to look like in order to do what I want it to do.

I'm aware that I would need an additional event file for the opening of the lid and a corresponding script, but for now I would be happy with automating the suspension/lock process and resuming manually using the power button.

Hopefully you can help me with this.

Thanks in advance.

Last edited by Troglodyte (2012-04-05 14:39:02)

Offline

#2 2012-04-04 19:57:11

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [partly SOLVED] Controlling the uswsusp s2both feature with acpid

If you want to lock the screen, on the wiki there is a script https://wiki.archlinux.org/index.php/Pm … or_suspend that uses pm-utils to achieve it.
For the first question, i think in /etc/acpi/handler.sh there are lid open/close options too, so you can put s2both there, while closing.
Hope I understood well your problems, and hope i could help you!

Offline

#3 2012-04-05 11:55:29

Troglodyte
Member
Registered: 2012-04-04
Posts: 14

Re: [partly SOLVED] Controlling the uswsusp s2both feature with acpid

nierro wrote:

For the first question, i think in /etc/acpi/handler.sh there are lid open/close options too, so you can put s2both there, while closing.

Thanks for the reply.

There is a a part in the handler.sh script which would be activated upon closing/opening the lid.

    button/lid)
       	case "$3" in
	    close)
		#echo "LID closed!">/dev/tty5
		;;
	    open)
		#echo "LID opened!">/dev/tty5
        	;;
	esac
	;;

But as I understand it all it does is print "LID closed!".

How do I make it execute the

$ s2both

command?

Offline

#4 2012-04-05 12:05:25

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [partly SOLVED] Controlling the uswsusp s2both feature with acpid

Put it in a line under #echo LID closed, before ;; !
Hope this will help you!

Offline

#5 2012-04-05 12:55:17

Troglodyte
Member
Registered: 2012-04-04
Posts: 14

Re: [partly SOLVED] Controlling the uswsusp s2both feature with acpid

Ok.

my /etc/acpi/events/anything file now looks like this:

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

My /etc/acpi/handler.sh looks like this

    button/lid)
       	case "$3" in
	    close)
		#echo "LID closed!">/dev/tty5
		s2both
		;;
	    open)
		#echo "LID opened!">/dev/tty5
        	;;
	esac
	;;

and it works!

Didn't think it would be that easy. Thanks for pointing me in the right direction nierro!

Now I just need to figure out how to return to xdm instead of my WM upon resume.

Last edited by Troglodyte (2012-04-05 13:01:33)

Offline

#6 2012-04-05 14:05:58

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [partly SOLVED] Controlling the uswsusp s2both feature with acpid

Well, as i said, there is a script for pm-utils, but i think you can use it with acpi too (when the lid gets opened, make that script run!)
Glad to have helped you !

Offline

#7 2012-04-05 14:38:01

Troglodyte
Member
Registered: 2012-04-04
Posts: 14

Re: [partly SOLVED] Controlling the uswsusp s2both feature with acpid

nierro wrote:

Well, as i said, there is a script for pm-utils, but i think you can use it with acpi too (when the lid gets opened, make that script run!)
Glad to have helped you !

I knew from the wiki that it's possible to use pm-utils with acpid, but I didn't want to use pm-utils becuase it doesn't support suspend to both.

It would be nice if the wiki contained an example for using acpid and uswsusp like I am now.

Offline

#8 2012-04-06 08:41:23

nierro
Member
From: Milan, Italy
Registered: 2011-09-02
Posts: 849

Re: [partly SOLVED] Controlling the uswsusp s2both feature with acpid

you mustn't use pm-utils, copy and paste that script in a file, make it executable, then put the path to that script in handler.sh after lid open.

Offline

Board footer

Powered by FluxBB