[ltp] how does apm operate?

linux-thinkpad@linux-thinkpad.org linux-thinkpad@linux-thinkpad.org
Tue, 13 Apr 2004 19:01:37 +0545


On Tue, Apr 13, 2004 at 06:57:39AM -0500, Ivarsson, Torbjorn (T) wrote:
> In my continuous efforts to solve my KDE-keeps-crashing-when-resuming-problem I am trying to figure out exactly how apm/apmd works so that I can insert my own debugging code. I was under the impression that there are some scripts somewhere that apm use when suspending/resuming, but I can't find them.
> 
> I have downloaded the source for apm/apmd (v3.something) and briefly looked through the code. There's only one reference to a script-file, apmd_proxy. The file came with the source tarball but I cannot find it in my system (MDK10).
> 
> Questions: Can anyone briefly explain the chain of events when apm suspends and resumes the computer? What files are used etc.? Or is there a good resource anywhere that I can dig through?
> 
> Thanks,
> T.
> -- 

on Debian, at least (and I see no reason it should be different on
another distro), apmd sends events to a script, /etc/apm/apmd_proxy,
which in turn runs scripts in subdirectories for the type of event, 
/etc/apm/resume.d/, /etc/suspend.d/ and so on.

Obviously apmd_proxy can be set up to do anything you like.

Scripts in these directories are run much like init scripts in
/etc/rcN.d, in normal collate order, so the run order can be manipulated
by prepending numbers to the script names. Output from programs called
by these scripts (hdparm, for instance) goes to syslog.

I hope this is some help.


rgds

_
A