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

Suspending successfully from X-windows



Some notebooks seem to suspend OK from a virtual terminal, but not from 
X-windows.  I had that problem and found a solution.  The setup here is a 
Gateway Solo3350 with a Phoenix NoteBIOS 4.0 release 6.0 (serial 25.04). 
This trick may apply also to other notebooks using that same BIOS.  

I assume that you already have APM set up correctly so that you can 
suspend successfully from, e.g., virtual terminal #1.  Be sure that you 
have installed the debian package "console-tools".  It contains the two 
little utilities: fgconsole and chvt.  If an unprivileged user is to 
suspend the notebook, these two files must be made suid root.  (I don't 
think that is much of a security risk on a notebook.)

Now add the following at the very beginning of /etc/apmd_proxy, so that 
the start of that file should look like this:
-------------------------------------------------------------
#!/bin/sh

XVT=7
if [ -x fgconsole -a -x chvt ]; then
[ $(fgconsole) -eq $XVT ] && chvt $XVT
fi
# The four previous lines allow "suspend" from Xwindows.
# XVT should be set to the virtual console from which X is run.
# Files /usr/bin/fgconsole and /usr/bin/chvt must be
#    set suid root if a general user is to use suspend.
# These four lines must be AT THE START of /etc/apmd_proxy.
# The BIOS evidently stops the display asynchronously, so
#    we must get there first.
-----------------------------------------------------------------

What it does is to "change" to the virtual terminal that X-windows is 
using, typically #7, just before the BIOS shuts the display down.  Timing 
seems be crucial.  It DOES NOT WORK to put this functionality in 
/etc/apm/event.d .  That is too late.

It is very nice to just close the lid on your kde desktop and then have it 
right there when you open it again.  :-)

-- 
Oliver Johns <ojohns@metacosmos.org>
San Francisco, California USA
GPG KeyID=A2ACE692
GPG Fingerprint=BE4A C1B8 EB0D 8FD9 737D  CE4A 1E56 BF9B A2AC E692



Reply to: