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

See the file COPYING for license information.

Description: SoftCAM for Irdeto, Seca, Viaccess, Nagra, Conax & Cryptoworks

-----------------------------------------------------------------------



What is it ?
------------

First: Most certainly it's not legal to use this software in most countries of
the world. But probably you already knew this...

SC means softcam, which means a software CAM emulation.

This piece of software is originaly based on (and still contains code from)
mgcam (a standalone CAM emulation). Many thanks to the (anonymous) author for
his really fine piece of software :-)

The plugin only decrypts the scrambling codewords from the incomming ECM
stream. The actual descrambling of the video stream is done by a special chip
on the DVB card. This chip is available with "premium" technotrend chipset
cards like FujituSiemens or Hauppauge only. Budget cards like the WinTV Nova
lack the chip. In this case you have to use software decrypt (SoftCSA) which
requires a decent CPU.



How to setup ?
--------------

First you have to use a recent DVB driver with a patch firmware (root) file
(Newstruct or older won't work). You should replace the original root file in
the drivers source directory and then recompile the driver. Install the new
modules and unload/reload the DVB driver. For timeshifting of encrypted
channels you must use a LL firmware (no -icam). If you suffer from ARM crashes,
add "hw_sections=0" while loading the dvb-ttpci module.

Second you have to apply the supplied vdr-sc patch from the patches
subdirectory to your VDR sources (VDR 1.1.31 or newer required). From the base
VDR source directory this could be done with "patch -p1
<PLUGINS/src/sc/patches/vdr-sc.diff". Select the appropriate patch for your VDR
version. Recomplie VDR and use the new binary.

Now follow the VDR instruction to compile plugins (make plugins). The plugin
has several options which can be enabled at compile time:
  IRDETO=1         to enable Irdeto/Betacrypt support.
  SECA=1           to enable Seca support (needs libcrypto).
  VIACCESS=1       to enable Viaccess support.
  NAGRA=1          to enable Nagra support (needs libcrypto)
  CONAX=1          to enable Conax support (needs libcrypto)
  SHL=1            to enable @SHL (SkyCrypt) support (needs libcrypto)
  SC_SECA=1        to enable Seca smartcard support (needs Phoenix ISO
                   interface)
  SC_CRYPTOWORKS=1 to enable Cryptoworks smartcard support (needs Phoenix ISO
                   interface)
  SC_IRDETO=1      to enable Irdeto smartcard support (needs Phoenix ISO
                   interface)
  SC_CONAX=1       to enable Conax smartcard support (needs Phoenix ISO
                   interface)
  SBC=1            to enable cardserver client (see below)
  DBG=1            to compile with debugging information
For permanent activation add the options to the Make.config file in the VDR
base directory. libcrypto is part of the openssl package. For most
distributions you have to install the openssl-devel package too.

All config files  must be located in a subdirectory (of your VDR config
directory) called "plugins". The private plugin cache file is saved to this
directory, too. The keyfile must be named "SoftCam.Key". For the logger
facility you need valid subscription card data, which have to be located in the
files "Ird-Beta.KID", "Seca.KID" or "Viaccess.KID". See the files in the
"examples" subdirectory for file formats.

For Seca2 support you need binary files which contain the hash & mask tables.
The file format is the same as for Yankse. The files must be located in the
"plugins/seca" subdirectory. The name sheme is s2_TTTT_XXXX.bin where TTTT is
one of "hash","mt" and XXXX is the provider ID (e.g. s2_hash_0064.bin,
s2_mt_0070.bin). The hash file must be 1536 bytes long, the mt file 16384.

Note, that for this @SHL implementation the key must be in Z 00 00 <key> format
(the V 000000 00 <key> format doesn't works).

To make the Nagra AU work, you must have appropriate binary Rom and Eeprom
files available. The files should be named "ROMX.bin", "ROMXext.bin" or
"eepX_Z.bin" where X is the ROM number (dezimal) and Z is the upper part of the
provider ID (hexadezimal). The Eeprom files may be updated from the EMM data,
take care that the permissions are set right. The plugin searches for these
files in the "plugins/nagra" subdirectory.

For testing purpose you should start VDR in foreground always. The plugin gives
a lot of additional information to the console. This may be helpfull in case it
doesn't works at once.

The activation of the SC is controlled by your CICAM setup. As general setup
(which is not SC specific) all encrypted channels must have a CA value filled
in (in channels.conf) and the DVB cards which should receive the channels must
have proper CICAM values set.
In the plugin setup menu, you now have to specify for which CICAM values the SC
should kick in. The first two CICAM caps can be setup from the menu. If you
need more, you can edit the setup.conf file manualy and add up to 10 CICAM
caps.
Doing so, SC is activated on all cards which have atleast set one of the plugin
CICAM caps BUT only for channels which have a CA value which is listed in the
plugin CICAM caps.

Example:

ORF 2:12692:h:S19.2E:22000:500:501:505:102:13002:0:0:0
PR Start:11798:h:S19.2E:27500:255:256:0:101:8:0:0:0

To receive both channels with one DVB card, you would have to set the DVB CICAM
to 101 102. If you set the SC CICAM caps to 101 102 too, SC will kick in for
both channels. If you set the SC CICAM caps to 102 only, the second channels is
left alone (may be to be decrypted by a hardware cam).



SoftCSA support:
----------------

If you want to use the SoftCSA feature, you have to apply the patch BEFORE
compiling the plugin. When compiling the plugin, the patch will be detected and
the plugin-specific code parts will be activated.



Smartcard support:
------------------

For some encrpytion systems this plugin supports original subscription
smartcards on a Phoenix/Smartmouse ISO interface connected to a serial port.

To enable smartcard support you have to select one or more of the smartcard
systems on the make commandline. To actually activate the smartcard interface,
you should use the commandline option "-s" to specify one or more serial
devices to which the Phoenix interface are connected e.g. use "-s /dev/ttyS0 -s
/dev/ttyS1" to use two intefaces at COM1/COM2.
If you want to add a default smartcard interface at compile time use the make
option DEFAULT_PORT, e.g. DEFAULT_PORT='"/dev/ttyS0",0,0'. Note the quotes and
double quotes. The two numeric values are identical to the -I and -R options
below (set to 1 to enable).

Appearently there are "broken" card readers which swap the meaning of the CD
line (used for card detection). For these readers use the option "-I". This
enables inverse CD detection for the next interface e.g. "-I -s /dev/ttyS0 -s
/dev/ttyS1" will use inverse CD on COM1 and normal CD on COM2 while "-I -s
/dev/ttyS0 -I -s /dev/ttyS1" will use inverse CD on both.
Some other card readers have a reversed logic with the reset line (card won't
reset with default settings). You can use the option "-R" for these readers.

If you insert a card into a interface the card is autodetected (your interface
should use the CD line to signal card presence or it won't work) and
initialised (this may take some seconds to complete). You can use the setup
menu to see which cards are currently inserted and detected. You can remove a
smartcard at any time without prior action, but of course this will disrupt
decryption if you are tuned to a channel which requires the card.



Cardserver client (Streamboard client)
--------------------------------------

The Streamboard client is a client for several cardservers. Supported
cardservers are : cardd (dbox2), buffy/doz21 (windows), aroureos (linux),
freezer (windows) and dukat (linux).

The client is controlled by additional options in the softcam setup page:
 server type    - select which type of server you are connecting to
 server IP      - IP address of the server
 server port    - port used on the server
 username       - your login name on the server
 password       - guess...
 AES encryption - select yes to enable encryption
 AES key        - 16byte encryption key, entered in hexadezimal, mandatory
                  if the above is set to yes.
New settings take effect as soon as you leave the setup page with "Ok".

The Streamboard client was contributed by S.Laurel from the Streamboard.
Probably you will get best help/support there.
You can activate console output and file logging by using the compiler switches
DEBUG_SBC=1 and LOG_SBC=1.



VDR 1.3.1 support
-----------------

There is a experimental, basic support for VDR 1.3.x series. Important things:
- You should use at least VDR 1.3.1
- The meaning of the plugin CICAM caps has changed. Now you have to give the
  card numbers SC should use, e.g. "1 2" will use first an second card while "2"
  will use only the second one. (This change is enforced by VDR as VDR doesn't
  uses the values from ca.conf any more)
- If you have a hardware CAM, the hardware CAM is given priority over SC on all
  channels for which the CaSystemIds matches the ones supported by the CAM.
