Powered by PlusNet
and
Powered by Joomla

Home arrow Zaurus arrow Suspend/Resume Script Architecture
Suspend/Resume Script Architecture PDF Print E-mail

I have created a simple architecture that allows you to easily specify any number of arbitrary scripts/commands to run when you suspend or resume your Zaurus. It is loosely based on the Linux Init System and was also inspired by SafeBoot. I have created a package so that you can easily install it with the package manager. The download link is below.

susp-resume_0.9-3.1.ipk (You MUST also install sudo-0.1.ipk)

It can only be installed to RAM and is intended for use on Sharp ROMs only. OpenZaurus users don't need this as that ROM already has a similar feature. It is untested with the Crow ROM and I'm not sure if it will work properly with it. In any case, while I have not had any problems with it, I strongly advise that you make a backup first, although the package should uninstall cleanly.

Once installed you will get the following directories:

/etc/apm.d
/etc/apm.d/suspend.d
/etc/apm.d/resume.d

Any executable commands in or linked from /etc/apm.d/suspend.d/ that have the filename format Snnxxxx (e.g. S20Today) will be run in order (a la Init System) with the argument 'suspend' when you suspend your Zaurus.

Any executable commands in or linked from /etc/apm.d/resume.d/ that have the filename format Rnnxxxx (e.g. R50Today) will be run in order with the argument 'resume' when you resume your Zaurus.

The suspend part also has a timeout feature so that if the suspend commands take longer than a predefined number of seconds then the suspend scripts are killed off and your Zaurus is allowed to suspend normally. This is so you do not get into a state where your Zaurus will not suspend. Because of this, it is best to give the critical and stable suspend commands lower filenames to ensure they are run first. The timeout value is located in the script /usr/local/bin/susp.sh and is 20 seconds by default.

For those of you wanting to know how it works, the best thing to do is to peel apart the package. It is very simple. Basically it just moves the link to the apm binary in /usr/local/bin to one side and replaces it with a script that runs the necessary commands to get the suspend/resume scripts running at the right time and then passes any arguments onto the real apm binary.

Some examples of suspend/resume scripts are below. If you find any problems, please let me know.

Suspend/Resume Opie-Today Script: I have put together a package that installs a suspend/resume script for Opie-Today, using the Suspend/Resume Script Architecture. This recreates the functionality that Opie users get with Opie-Today, but with Qtopia instead. The package can be downloaded below. (You will need to install Opie-Today and the Suspend/Resume Script Architecture first.) This can only be installed to RAM

susp-resume-today_0.9.1.ipk

The script will launch Opie-Today when you resume your Zaurus, but only if your Zaurus has been suspended for a certain period and if it isn't already running. The period is specified in seconds in the delay variable in the script /etc/apm.d/Today and is 2700 by default (45 minutes). This is done so that if you are constantly suspending and resuming every five minutes, you don't get Opie-Today launching all the time and slowing things down.

Suspend/Resume SafeBoot Script: This is a modification of the SafeBoot package, for the Suspend/Resume Script Architecture, that stops the double reboot bug that some people have experienced (including me). The package can be downloaded below. It must be installed to RAM. (This one can also be uninstalled cleanly)

susp-resume-safeboot_0.9.ipk

Last Updated ( Sunday, 01 October 2006 )
 
© 2008 Pinkney Corner
Joomla! is Free Software released under the GNU/GPL License.