On Wednesday 23 May 2001 18:29, Ken Teh wrote:
> I have a rackmount PC with a hard disk, no monitor, no keyboard, which I
> would like to be able to run shutdown properly at the push of a button.
> Right now I'm using a keyboard to push ctrl-alt-delete to do this, but I
> was wondering if anyone knows of something more elegant. A keyboard is a
> mighty big switch :)
Just connect a pushbutton to some spare input somewhere; parallel port,
serial port control inputs, game port, spare input on custom card, spare IRQ
line on the ISA bus, etc... Then write a driver or program that directly or
indirectly executes something like 'halt -p' or 'poweroff'.
If you're using an IRQ line, you need to hack your own driver to catch the
IRQ. You could just implement the open, close and ioctl file operations.
(Look at some simple Linux driver to see how the basic open/<various
operations>/close stuff, and installing ISRs, is done.) The ioctl call would
just go to sleep and wait for the ISR to wake it up, and then, when it wakes
up, just return to let the user space side know the "shutdown button" was
pressed.
For other non-standard solutions, you may have to write a driver where the
ioctl() call (or read(), if you prefer to use that) sits in a loop, checking
the button, then sleeping for, say 100 ms, or returning if the button was
pressed.
As to the standard interfaces (parallel, serial, game etc), you can probably
just write a user space application using the standard API for the interface
you're using.
//David Olofson --- Programmer, Reologica Instruments AB
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
.- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> [EMAIL PROTECTED] -'
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/