Freevo

- User Documentation

# ExternalTunerConfig

1. External Tuner
   1. Motorola DCT2XXX Series Set Top Box
      1. Prerequisites
      2. Installation
      3. Configuration
      4. Troubleshooting
   2. EchoStar Satellite Box
      1. Building Lirc
      2. Configuring LIRC for Transmit/Blasting
      3. Troubleshooting

## External Tuner

For situations where an external tuner i.e. a cable box or satellite receiver is being used. Channel changes are made by either executing an external application or by sending IR events.

### Motorola DCT2XXX Series Set Top Box

If you have a Motorola DCT2XXXX (eg, DCT2224) and a serial cable, you can use the dct2xxx external tuner plugin to change channels on the set top box. It can be downloaded from the Add-Ons section of the main freevo website: DCT2XXXSerialTuner.

#### Prerequisites

1. Install pySerial into your python runtime. If you use Debian and used apt-get to install python, you can use apt-get to install pySerial as well:

-     apt-get install pyserial

2. Make sure you are running Freevo version 1.5.2 or above.

#### Installation

1. Extract the serialtuner.tar.gz archive (included in the gzipped tar file you can download using the link above) into your python runtime's site-packages directory.

2. Copy the dct2224serial.py file into your Freevo installation's freevo/tv/plugins directory. This directory could be in many places, depending on how you installed freevo. For Debian and apt-get, the above directory can be found in /usr/lib/python2.3/site-packages.

#### Configuration

1. Add the following line to your local_conf.py file:

-     plugin_external_tuner = plugin.activate("tv.dct2224serial")

2. Make sure you have configured Freevo to use an external tuner. You will need a `VIDEO_GROUPS` setting something like the following:

-     VIDEO_GROUPS = [
           VideoGroup(vdev=TV_DEVICE,
              adev=AUDIO_DEVICE,
              input_type='tuner',
              tuner_type='external',
              input_num=4,
              tuner_norm=CONF.tv,
              tuner_chan=3,
              tuner_chanlist=CONF.chanlist,
              desc='IVTV Video Group',
              group_type='ivtv',
              recordable=True),
       ]

  The above settings work for an WinPVR-250 card using the ivtv drivers. The important parts are the tuner_type='external' setting and the input_num setting. The tuner_type must be set to 'external' in order to ensure the external tuner plugin gets invoked. The input_num setting controls which input of the WinPVR card is receiving the signal from your cable set top box. For my particular card and using the coaxial cable input of the WinPVR card, input_num happens to be 4.

That's it. As long as the serial port on your set top box is active, Freevo will change the channel when recording a show or selecting a channel from the program guide. However, trying to change channels while watching a current show does not work. In this situation, you have to exit back to the tv guide and select the new channel for viewing.

#### Troubleshooting

The main problem with using the serial port of your Motorola set top box is that it may not be on. Check out this web page: DCT2XXXSerialTunerHome for some tips and links to get help.

### EchoStar Satellite Box

System: Haupauge PVR 350 with remote and Bell Express Vu Satellite.

#### Building Lirc

Lirc has two jobs on my system:

1. Receive signals from the Hauppauge remote to pass on to Freevo

2. Transmit IR signals to my satellite box so that Freevo can change channels.

In MythTV DISH IR LED TX via Modified LIRC they suggest modifying lirc build files to produce a "lirc-transmit" mdoule that won't interfer with your regular lirc receiving module. I haven't done this.

Since I use Gentoo I followed the similar, but simpler, advice found at use multiple lirc drivers simultaneously. Basically you build two lirc modules (lirc-hauppauge and lirc-serial) one after the other. Then you modify your init scripts to start both modules instead of the regular lirc init.

- HACKS: The kernel had already grabbed control of my com port and therefore regular loading of lirc-serial fails. To get around this I call setserial in my local start script and then modprobe lirc-serial explicitly. I also make sure dev/lirc1 is writeable for everyone. These hacks can likely be worked around by configuring your kernel/bios to not grab the com port and by setting up devfs/udev/pam to grant the correct permissions for lirc1. I haven't done this yet.

    # file /etc/conf.d/local.start

    # This is a good place to load any misc.
    # programs on startup ( 1>&2 )

    # let go of the serial port and THEN load lirc_serial
    /bin/setserial /dev/ttyS0 uart none
    /sbin/modprobe lirc_serial
    /bin/chmod 666 /dev/lirc1

- Important: My init script for lirc-serial includes a niceness parameter (-N -10), this was necessary to get channel changing to work reliably. The whole init script for lircd-serial looks like:

    start() {
        ebegin "Starting lircd serial"

        start-stop-daemon --start --quiet -N -10 -p /var/run/lircd-serial.pid -a /usr/sbin/lircd -- -o /dev/lircd1 -d /dev/lirc1 -p 777 -P /var/run/lircd-serial.pid
        eend $?
    }
    stop() {
        ebegin "Stopping lircd serial"
        start-stop-daemon --stop --quiet -p /var/run/lircd-serial.pid
        eend $?
    }

#### Configuring LIRC for Transmit/Blasting

1) First set up up the recieving side, see Lirc

2) Install your IR blaster hardware (I bought one from irblaster it works great).

3) Configure /etc/lircd.conf for your transmit codes.

I started with echostar 3100. Make sure you can at least turn your tuner box on and off with irsend, e.g., `irsend -d /dev/lircd1 SEND_ONCE <your_remote> power`

I used the following script to test channel changing from the command line:

    #! /bin/sh
    remote=3100_2
    /usr/bin/irsend -d /dev/lircd1 SEND_ONCE $remote $1
    sleep 0.3
    /usr/bin/irsend -d /dev/lircd1 SEND_ONCE $remote $2
    sleep 0.3
    /usr/bin/irsend -d /dev/lircd1 SEND_ONCE $remote $3
    exit 0

- Note: I tweaked the original 3100 settings until I got better response.

4) Configure Freevo

First setup your video group in `local_conf.py` for an external tuner, e.g.,

    VIDEO_GROUPS = [
        VideoGroup(vdev='/dev/video0',
                    adev=None,
                    input_type = 'tuner',
                    input_num=6,
                    tuner_norm='NTSC',
                    tuner_type='external',
                    desc='ExpressVu',
                    group_type="ivtv",
                    recordable=True)
     ]

Next configure a pluging for channel changing:

    # plugin for ir blasting for channel change
    plugin_external_tuner = plugin.activate('tv.irsend_generic2',
            args=('/usr/bin/irsend -d /dev/lircd1 SEND_ONCE 3100_2'))

- HACK: I couldn't get tv/irsend_generic or irsend_echostar to work for me so I hacked irsend_generic to mimic the behaviour of my send script. I called it irsend_generic2.

  NOTE: the name of the variable, `plugin_external_tuner`, seems to be important for recordserver (oddly enough it doesn't seem to be important for watching TV).

#### Troubleshooting

- First make sure lirc works for both transmitting and receiving outside of Freevo.

- Depending on your system you may have tweak:

  - the niceness of of lirc-serial

  - the time between irsend commands (the sleep)t

  - the actual lircd.conf parameters

PleaseUpdate: Howto set up other external tuners (eg, IR Remotes) properly.

last edited 2005-01-25 09:59:10 by ToddMacCulloch
current version: http://freevo.sourceforge.net/cgi-bin/doc/ExternalTunerConfig