   tty_control - Controlling inputs from serial lines

Version History
===============
   Version  2.00 Date 2002-01-04
   default commands are now own scripts
   redirection of the output to /dev/null is now done by ../init.d/tty_ctrl
   source files splitted: now sys_calls.c, sys_calls.h and tty_control.h exist
   sprintf commands from the initialization of the commands removed
   makefile changed due to the file splitting 
   Version  1.13 Date 2001-10-04
   remove option for deinstallation added to makefile
   minor changes in source code
   some debian fixes added
   Version  1.12 Date 2001-07-08
   makefile introduced, all global variables removed
   Version 1.11. Date 2001-06-22
   Starts as Daemon, all actions are logged, own commands can be executed
   Version 1.0. Date 2001-02-02
   tty_control - Controlling inputs from serial lines

Schritt fuer Schritt Anleitung
==============================

Bitte verwenden Sie die html Version zur Installation!
Diese hier wird seit Version 1.12 nicht mehr gewartet

0. Als root anmelden
1. tty_control bersetzen:
cc -o tty_control tty_control.c
2. tty_control nach /sbin kopieren:
cp tty_control /sbin
3. Das Skript (tty_ctrl siehe Punkt 7) in das Verzeichniss /sbin/init.d 
kopieren:
cp tty_ctrl /sbin

   Hinweis: normalerweise befindet sich das Verzeichniss unter /etc/init.d. Da 
ich suse 7.0 verwendet
            habe und deren Verzeichnisstruktur etwas abweicht, bezieht sich 
diese Anleitung auf das Verzeichniss /sbin/init.d

4. Um das Kontrollprogramm fuer die serielle Schnittstelle in den
Runlevels 1,2 und 3 automatisch zu starten:
Ins Verzeichniss /sbin/init.d wechseln und folgende Links
(Abhngig von den gewnschten Runleveln) erstellen:
ln -s ../tty_ctrl rc1.d/S21tty_ctrl
ln -s ../tty_ctrl rc2.d/S21tty_ctrl
ln -s ../tty_ctrl rc3.d/S21tty_ctrl

5. Wenn eigene Kommandos ausgefuehrt werden sollen, dann muessen diese
   im Verzeichniss /sbin/tty_ctrl liegen
   und button1 fuer das Kommando bei Betaetigung des 1. Knopfes
   button2 fuer das Kommando bei Betaetigung des 2. Knopfes
   usw. bis button7 heissen
   Bei Aufruf dieser Skripte wird ein Rckgabewert erwartet, wenn dieser nicht 
gleich 0 ist,
   erhaelt man eine Fehlermeldung


   Hinweis: Achten Sie auf die Rechte in diesem Verzeichniss, sollte nur von 
root les- und ausfuehrbar sein.

Die default Kommandos:
Button1  cdrom mount / umount / ejct
Button2  mount floppy
Button3  umount floppy
Button4  init 1  (single user)
Button5  init 2  (multi user, network)
Button6  init 0  (shutdown)
Button7  init 6  (reboot)


6. Nach einem Neustart sollte es funktionieren.

7. Nur zur Information: Das Skript tty_ctrl
#!/bin/sh
# /sbin/init.d/tty_ctrl
#starts tty_control on 2. serial line
/sbin/tty_control /dev/ttyS1

8. Nachfolgend die Belegung der seriellen Schnittstelle und die verwendete 
Schaltung.


ASCII Schematic for the RS-232 Cabling:

---------------------------------------------------------------
|  9 Pin  | 25 Pin     | Designation of Signal        |  Typ  |
---------------------------------------------------------------
|   1     |   8        |   CD (Carrier Detection)     | input |
|   2     |   3        |   RxD (Recieve Data)         | input |
|   3     |   2        |   TxD (Transmit Data)        | output|
|   4     |   20       |   DTR (Data Terminal Ready)  | output|
|   5     |   7        |   GND (Ground)               | ground|
|   6     |   6        |   DSR (Data Set Ready)       | input |
|   7     |   4        |   RTS (Request To Send)      | output|
|   8     |   5        |   CTS (Clear to Send)        | input |
|   9     |   22       |   RI (Ring Indicator)        | input |
---------------------------------------------------------------



         ____
DTR ____| R1 |_____
        |____|     |
          10 kohm  |                     S1
                   |____________________/ _________________ CD
                   | 
                   |                     S2
                   |____________________/ _________________ CTS
                   |
                   | 
                   |                     S3
                   |____________________/ _________________ DSR
                   |
                   | 
                   |                     S4
                   |____________________/ __________________ RI
                   |
                   |
                   |
                   |                 S5
                   |________________/ _____________|\|______ CTS
                   |                         |     |/|
                   |                         |
                   |                         |
                   |                         |_____|\|______ DSR 
                   |                               |/|
                   |
                   |
                   |                 S6
                   |________________/ _____________|\|______ CTS
                   |                         |     |/|
                   |                         |
                   |                         |
                   |                         |_____|\|______ CD 
                   |                               |/|
                   |
                   |
                   |                 S7
                   |________________/ _____________|\|______ CD
                                             |     |/|
                                             |
                                             |
                                             |_____|\|______ DSR 
                                                   |/|

         ____
DTR ____| R2 |_____
        |____|     |
          2.2 kohm |
                   |                             LED-red 
                   |_____________________________|/|______ GND
                                           |     |\|
                                           |
                                           |     LED-green
                                           |_____|\|______ GND 
                                                 |/|



         ____                                  LED-yellow                  
 RTS____| R2 |_________________________________|\|______ GND
        |____|                                 |/|
          2.2 kohm  

