sled -- serial line LED

This software reads the state of a push button to and controls 2 LEDs
connected the serial line.  It can be used the shutdown your server
when there is no keyboard connected and you don't want to log on to
the server as root in order shut it down.

It works as follows:
--------------------
A green LED will indicate when the pushbutton is active and a slowly
blinking yellow LED indicates that the server is working or still in
the process of shutting down. To shut down the server you press the
pushbutton for 3 seconds.

When you press the pushbutton then the green LED will go off indicating
the shutdown is in progress.  The command "/sbin/shutdown -t2 -h now"
is now executing.  The yellow LED continues blinking while the server is
still shutting down.  When the yellow LED stops blinking then you should
still wait 10 seconds before you power off the computer. The yellow LED
stops when all processes are killed and the disks are being unmounted.

If your computer supports automatic power off then you do not have to
worry about the 10 seconds. Just wait until it has switched off it self.

You need the following parts to build this shutdown button with LEDs.

   * 1 green low power LED (a normal LED will also work but it will not be
     as bright)
   * 1 yellow low power LED
   * 2 resistors 1.5K Ohm
   * 1 resistor 6.8K Ohm
   * 1 small push button
   * 1 female RS232 serial line connector with cable

The RS 232 9 PIN D-SUB MALE connector at the Computer.
 9 PIN-connector25 PIN-connector Name  Dir       Description
 1              8                CD   input  Carrier Detect
 2              3                RXD  input  Receive Data
 3              2                TXD  output Transmit Data
 4              20               DTR  output Data Terminal Ready
 5              7                GND  --     System Ground
 6              6                DSR  input  Data Set Ready
 7              4                RTS  output Request to Send
 8              5                CTS  input  Clear to Send
 9              22               RI   input  Ring Indicator

The parts are connected together as shown 
in the diagram called pictures/circuit.gif

Take also a look at this article which describes the hardware:
http://linuxfocus.org/English/January2000/article186.shtml

Installation
------------

-run make to compile the software. 
-then create a link from the serial device (to which the circuit
 is connected ) to /dev/led:
 E.g: 
 cd /dev
 ln -s ttyS1 led

 You can see which serial lines you have using:
 setserial -ag /dev/ttyS*
-run make install to install the program called sled and an
 rc.d-script called sled_rc
-test sled on its own by running sled /dev/led
 kill the sled process again by running killall sled
-test the rc script by running /etc/rc.d/init.d/sled_rc start
-create a link from /etc/rc.d/rc3.d/S99sled to /etc/rc.d/init.d/sled_rc
 There is no link for a kill script as we want the sled daemon 
 to be killed as on of the last processes.

 The sled_rc script is tested under Redhat and Mandrake but works
 probably for many others.

That's it.

I decided to use /etc/rc.d/rc3.d/S99sled because it will be
the last command executed at startup. This means your server is
fully operational when the LEDs are on.

-------------------------------
Versions:
2000-12-03: version 0.1 first version

Written by Guido Socher <guido@linuxfocus.org>

Copyright: GPL, see http://www.gnu.org/copyleft/ for details
