[H-GEN] Software suspend and linux
Tony Nugent
tony at linuxworks.com.au
Sun Oct 20 23:17:00 EDT 2002
[ Humbug *General* list - semi-serious discussions about Humbug and ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
On Sun Oct 20 2002 at 21:16, David Findlay wrote:
> Anyone know how to get the Wake, sleep and power keys on modern keyboards to
> work with Linux? I'd like Power to do a software suspend if possible so I can
> turn off and restart exactly where I left. I'm on Debian. Thanks,
I believe that this functionality is only becoming available in the
recent 2.5.x development kernels. If this is the case, then "sleep
with swap-to-disk" will not be generally available until the 2.6.x
production kernels start to appear.
But all is not lost. If you have these extra keys, then you should
be able to enable them to your liking by using loadkeys to setup the
kernel's keyboard table with their keycodes and new bindings (see
below).
If pressing any of these keys results in syslogs complaining
about unknown keycodes, then take a note of which keys are
producing which keycode values. If this isn't happening, then
the "showkey" utility on a text console may help. If that
doesn't work either, then some other magic will be needed to
enable and detect them :)
I can get responses to these extra keys on my "microsoft" ps/2
keyboard, but not with my logitech cordless ir/usb keyboard... it
might need some parameters given to the usb driver, I'm not sure.
This isn't exactly what you are asking for, but it may be useful to
illustrate how this works...
To do a shutdown with a halt and poweroff rather than a reboot, I
have this in /etc/inittab on my workstation:
# Trap CTRL-ALT-DELETE -> reboot
ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# Trap CTRL-ALT-END -> halt
ce::kbrequest:/sbin/shutdown -t3 -h now
... and this in /etc/rc.d/rc.local:
# enable windows menu keys on text console to change virtual console
echo -e "
keycode 103 = Up
alt keycode 103 = Incr_Console
keycode 108 = Down
control alt keycode 108 = Decr_Console
keycode 107 = Select
control alt keycode 107 = KeyboardSignal
keycode 125 = Decr_Console
alt keycode 125 = Console_1
keycode 126 = Incr_Console
alt keycode 126 = Console_6
keycode 126 = Last_Console
alt keycode 127 = Console_7
" | loadkeys
This sets up ctrl-alt-end to shutdown and halt (and also enables the
windows menu keys to move around between the text consoles).
It is possible to do all sorts of magic with this, see the man pages
for loadkeys and dumpkeys for the details.
Of course you need to have an ATX power supply to actually
poweroff. This has worked for me with linux on every motherboard
with a VIA chipset (and many others, but not all). While not
specific to linux, keyboard powerup also works (configurable in
the bios and with dip-switches on some m'boards).
More possibilities for customising these keys is possible with the X
keyboard driver and its various utilities.
All this being said, in the recent past I'm sure that have come
across references to web sites (at google, freshmeat etc) that
mention utilities specifically designed to bring these extra keys to
life. However, I never did look at them. (I just now tried a quick
search them, but didn't find what I had previously seen - you might
have better luck).
> David
Have fun with this!
> If you give someone a program, you will frustrate them for a day. If you teach
> them how to program, you will frustrate them for a lifetime.
:)
Cheers
Tony
--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'. See http://www.humbug.org.au/
More information about the General
mailing list