TV Tuner Card
These notes describe how I got the TV tuner card on sage working. Much
of the investigation was originally done using a Terratec Cinergy 1200
DVB-T card. This has now been replaced by a Hauppage WinTV-Nova-T-500,
and the notes have been modified accordingly.
Sources of information:
Kernel configuration
Using the above information from the above sources, the following (all under "Multimedia devices") were enabled in the kernel:
Option |
Option name |
Module name |
Video For Linux |
|
VIDEO_DEV |
videodev |
DVB for Linux |
DVB Core Support |
DVB_CORE |
dvb-core |
|
Load and attach frontend modules as needed |
DVB_CORE_ATTACH |
- |
|
To select Digital TV adapters |
DVB_CAPTURE_DRIVERS
|
- |
|
Enable DVB USB support |
DVB_USB |
- |
|
DVB receivers based on the DiB0700 USB bridge |
DVB_USB_DIB0700 |
dvb-usb-dib0700 |
Downloading and installing the firmware
The card
needs firmware loaded into it at start up. The information sources
above provide a link for getting it - it goes in /lib/firmware.
Renaming the devices
When the driver modules get loaded, they automatically create entries under /dev
for the TV card. Unfortunately, these devices don't have the names that
are expected by utilities: the entries are created immediately under /dev, but utilities expect them under /dev/dvb/adapter0. udev has to be used to rename the devices.
udev is already partially set up to do the renaming: there is a line in /etc/udev/rules.d/udev.rules that runs the script /etc/udev/scripts/dvb.sh for each dvb device that is created. However, the /etc/udev/scripts/dvb.sh file doesn't exist and has to be manually created, with the contents:
#! /bin/sh
/bin/echo $1 | /bin/sed -e 's,dvb\([0-9]\)\.\([^0-9]*\)\([0-9]\),dvb/adapter\1/\2\3,'
and made executable. This shell script was found in many places from a
Google search for "dvb.sh udev" - I don't know where it came from
originally, or why it isn't supplied as part of the udev package.
The devices are owned by user root group video, so you will have to add yourself to the video group in order to access them.
Loading the modules
Nothing needed to be done to load the modules - this happens
automatically at boot.
Remote control
The remote control needs lirc to be installed. It's not supplied with Slackware, so I built and installed it from source:
cd lirc-0.8.2
./configure --with-driver=userspace
make
vim description-pak
checkinstall
installpkg /usr/local/packages/lirc-0.8.2-i486-1fog.tgz
Note that the above builds/installs only the userspace bits - no kernel modules.
The LinuxTV website provides an lircd.conf configuration file
for use with lircd. lircd needs to be started from /etc/rc.d/rc.local.
Streaming
In order to watch (and listen to) TV on the laptops, sage has to stream the video+audio over the LAN.
I initially tried a simple streaming server called dvbstream
on sage, with gxine as the client on nettle. This sort of worked, but
both picture and sound were too broken up to be watchable. The problem
seemed to be insufficient bandwidth on the LAN.
The solution seemed to be to use a streaming server that could "transcode" the stream to a more compressed format. vlc looked as though it would do the job. It did, after a fashion, but it was a beast to build and use, and very buggy.
I eventually discovered MythTV,
which does an excellent job of streaming to the laptops (without
needing to transcode!), as well as enabling sage to act as the main TV.
Generating channels.conf
In order to use utilities such as gxine with the tuner card, you have
to have a "channels.conf" file containing information about
locally-available TV channels (channel names, frequencies etc.). This file is not needed by MythTV.
To generate channels.conf (and in the process, test basic operation of
the card), you use a simple utility called "scan" from the linuxtv-dvb-apps-1.1.1 package. I didn't bother installing this package properly - I simply did:
tar xf linuxtv-dvb-apps-1.1.1.tar.gz
cd linuxtv-dvb-apps-1.1.1/util/scan
make
There's a README in the scan sub-directory, which gives some information and there's a fuller description on the LinuxTVWiki site.
scan has to be given a
file containing a list of frequencies (with assocated information) to
get it started - it isn't a fully-automated scanner. There is a file (util/scan/dvb-t/uk-Hannington) provided with scan
that contains the information for our Hannington transmitter, but I had
to do quite a bit of research and experimenting to collect the
corresponding information for our other local transmitter (Midhurst) -
see Transmitter Frequencies below. I put this information in the file util/scan/dvb-t/uk-FOG on sage.
To actually generate the channels.conf file, I did:
./scan -t 1 -x 0 -5 dvb-t/uk-FOG >channels.conf 2>channels.log
The options used were:
Option |
Descritpion |
-t 1 |
Get only TV channels (not radio or text) |
-x 0 |
Get only free-to-air channels |
-5 |
Increase tuning timeouts |
I then hand-edited the channels.conf
file, removing channels I wasn't interested in, uniquely
labelling channels that we could get from both Hannington and
Midhurst, and sorting into a sensible order.
The scan needs to be repeated at different times of day (and maybe on
different days) to pick up all the channels and their names. This seems
to be partly due to variations in signal strength, and partly due to
some channels only transmitting for part of the day. The outputs from
the repeated scans then have to be combined.
Transmitter frequencies
There is an official table
of all UK DTT (Digital Terrestial Television) transmitters, which lists
the channel numbers used by each transmitter. These channel numbers are
in the range 21 to 60, and correspond to 8MHz channels. To convert a channel number to the corresponding
frequency in MHz use:
frequency = channel * 8 + 306
For example, channel 21 is 474MHz and channel 69 is 858MHz.
Unfortunately, it's a bit more complicated than that, since individual
transmitters may use frequencies that are offset by +0.167Mhz or -
0.167MHz from the central channel frequency. These offsets are
indicated by '+' or '-' in the official table. I also found
another site that lists channels and frequencies in a more friendly manner.
Our local transmitter is Midhurst. The
following table of Midhurst channels is derived from the two sources mentioned:
|
Channel |
Frequency Mhz |
MUX 1 |
56 |
754.167 |
MUX 2 |
65 |
826.167 |
MUX A |
62 |
802.167 |
MUX B |
59 |
778.167 |
MUX C |
64 |
817.833 |
MUX D |
60 |
786.167 |