This is a "plugin" for the Video Disk Recorder (VDR).

Written by:                  Felix Rauscher <felix@rauscher-muenchen.de>

Project's homepage:          http://www.physik.uni-muenchen.de/~Felix.Rauscher/


See the file COPYING for license information.


Description:
============

Controls Status LEDs 


Hardware:
=========

Serial port:
------------

                  R
        LED    ---------
RTS O----|>---|         |------| GND
               ---------

                  R
        LED    ---------
DTR O----|>---|         |------| GND
               ---------

Pins on a 9-Pin sub-d connector:

	RTS	7
	DTR	4
	GND	5
	
For internal connectors refer to your mother-board manual.

Notes:
- I am not sure about the polarity of the LEDs, but it is not really important.
  You can set the polaity in the configuration file. Depending on the polarity
  of the LED it will light until vdr started.
- The value of the resistor R depends on the LED you are using (low current or
  not, color). Additinally the signal levels of a RS232-port are not precisely
  specified (3-20V). So you will have to try (start with using a potti). I am
  using 900 Ohms, bu the LED is a little bit dark.
  
Note: Since version 0.1.0 different means of connecting leds can be implemented.
See file HOWTO_create_device_class if you want to adpt this plugin for a 
different device type.

Console
-------

The console device supports 4 "leds": 

	NUM_LOCK	\
	CAPS_LOCK	|- = Keyboard leds
	SCROLL_LOCK	/
	BEEP		     1kHz beep from the PC speaker

Notes:
- The console device (/dev/console) must be writeable for the vdr-process
- The console device will not work when vdr runs in an xterm (KDE-konsole ..).
- You probably do not want to use the BEEPer if you really have connected a speaker. The idea is to connect a led instead of a speaker. For detailes see http://www.vdr-portal.de/board/thread.php?threadid=49268.	

Cutter-Mutex Patch
==================

If you plan to use the condition "cutting" you should apply the patch in the
patches subdirectory:

cd /usr/src/vdr-1.X.XX
patch -p1 <PLUGINS/src/serled/patches/cuttermutex.pathc

If this patch is not applied, and the conditin "cutting" is used, vdr is will
frequently crash at the end of cutting.


APIVERSION
==========

The latest vdr versions want the plugins to honor the APIVERSION instead of the VDRVERSION. For vdr-version>1.3.48 go into the plugin source directory and do:

rm Makefile
mv Makefile.apiversion Makefile

  
Config-File:
============

If no parameters are givn serled will look for /etc/vdr/serled. A different
config file can be given (-Pserled <different config fie>).

An example configuration file is in example/serled.example. A line

	DEVICE serial <device file>
	
starts a section for one serial port, which is ended by

	/DEVICE

. The argument <device file> is the device pinting to the serial port (usually
/dev/ttyS0 for COM1 and /dev/ttyS1 for COM2). 

Inside a device section  you can create two sections for the two signals by
typing

	RTS [inverted]
	
or

	DTR [inverted]

. These sections are ended by /RTS or /DTR respectively. The flag 'inverted'
indicates that the LED is connected with the inverse polarity (give this flag if
the led lights during boot). 

Inside an RTS or DTR section you can define an arbitrary number of signals. The
signal which is defied first will have the highest priority. There are two
different kind of signals:

	ON <condition>

or
	FLASH <t on> <t off> <condition>
	
'ON' means that the led is on as long as <condition> is fulfilled. 'FLASH' means
that the led flashes while <condition> is fulfilled. <t on> and <t off> is the
time the led is on and off. Without denominator the time is interpreted as usec
(micoseconds). You can give s ms or us as denomiator (e.g 1s 400us). Do not put
a whitespace between number and denominator.

The valid <condition>s are:

	replay		A recording, DVD, .. is replayed
	record		VDR is recording
	all_record	All input devices are used for recording. This does not
			work if you have plugins providing devices (xine,
			softdevice ?). It is also quite untested as I have only
			one DVB card.
	cutting		vdr is cutting
	
BUGS:
=====

The condition all record is untested. It does not work with my setup. I think he
xine or the streamdev pluin gives an additional device, so that the condition is
no longer fulfilled.

Additional conditions 'red', 'green', blue' and 'yellow' are forseen. They
should be fulfilled when the respective color key is active. At the moment this
does not work.
