[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Execute script on ACPI resume



dircha wrote:
> 
> With APM I could execute a script on resume by placing a 
> symlink to it 
> in /etc/apm/resume.d/, /etc/rc*.d/ style.
> 
> I can find no documentation on what events ACPI specifies. As 

There is no documentation on what _exact_ events ACPI specifies, because
events are machine dependent (defined by the DSDT your BIOS manufacturer
provided).

> best as I 
> can tell, the only available method is to perform the ACPI 
> action that 
> would cause the intended event, and then read /var/log/acpid to 
> determine the name to use in the /etc/acpi/ handler.

That's the way to do it.
> 
> I need to restart /etc/init.d/hotplug on resume from 
> suspend-to-disk to 
> pickup my USB mouse.
> 
> However, executing a suspend-to-disk and subsequent resume leaves no 
> messages in my /var/log/acpid.
> 
> Has anyone else figured this out?

How do you do the suspend?  If you use a script to suspend, then the script
itself is still running when you resume (ie, the script is just another
process that gets suspended).  So something like:

	#!/bin/sh
	echo 4 >/proc/acpi/sleep
	sleep 5
	/etc/init.d/hotplug restart

should do the job.  Note, I haven't tried this, but very similar scripts
were used much earlier in the development of ACPI when using S1.  The
"sleep" statement may or may not be necessary, and the 5 second timing was
just guessed at.  A number of people found they needed it with S1.  I'd try
without it, and if that doesn't work, try with a large number just to make
sure it does work, then lower the time until you find the minimum where it
works reliably.

derek



Reply to: