TV Tuner

From Linuxhelp Wiki

orc4trodo

Author:Corey
Created On:September 19th, 2003
Updated On:October 15th, 2003

Contents

Preface

I was in the market one day for a TV tuner card for my computer. Of course, being a big Linux fan, Linux compatibility was essential in my purchase. After reading reviews and checking out prices, I decided on a Winfast TV 2000 XP Deluxe from Leadtek. The deciding factors in my purchase included:

  • FM radio Tuner
  • Included Remote Control
  • Stereo Sound
  • Partial BTTV support (I'll explain partial later on)
  • Bundled with video editing, personal video recorder and netmeeting software for Windows

This card can be purchased from Ncix.com for under $100.

This guide will focus mainly on this TV card because I have no other experience with any other TV card. Another reason is because there are a few tricky things that need to be done to get this card to work 100%. If you own a different TV tuner, this guide may still be useful to you; I will attempt to note steps that are specific to this card only.

TV Card

Before purchasing your TV tuner, there are a few things you should check out first. You should definitely go for a PCI TV tuner cards; from people I've talked to and reviews that I've read, USB tuners are no good. Apparently USB doesn't have enough bandwidth to handle the video and audio, so the results are poor quality. As well, you should ensure that your card is supported by the bttv driver. I'm not too up on any other drivers, but bttv is the way to go.

You can find a list of support cards and tuner types here.

Kernel Preperation

First thing we need to do is ensure that our kernel includes support for a tv card. Bttv comes with kernels 2.4/2.5 as well as the new 2.6 kernel. After manually connecting your tv card to your computer (through a PCI slot, I hope), boot up your Linux installation and log in as root user. Some Linux distributions may automatically detect your tv card and configure your system for it; this guide will assume that it did not.

If you have never compiled a kernel before, don't be scared, just read Joey's Kernel Compile/Update Guide to familiarize yourself with the process. First off, I'll note that I am currently running a Gentoo patched kernel based on kernel release 2.4.20, so keep that in mind. It is best if you compile the following as modules, it allows for easier troubleshooting and control. The following will need to be included, (M) means compile as a module, (Y) means compile it into the kernel:

  • Multimedia Devices -> Video For Linux (M)
  • Multimedia Devices -> Video For Linux -> V4L Information in the proc filesystem (Y)
  • Multimedia Devices -> Video For Linux -> BT848 Video For Linux (M)
  • Sound -> TV Card (bt848) mixer support (M)
  • Character Devices -> I2C Support -> I2C Support (M)
  • Character Devices -> I2C Support -> I2C bit-banging interfaces (M)

Now save your configuration, but please read the following before compiling your modules:

Important: There seems to be a bit of a problem when it comes to bttv auto-detecting the Winfast TV 2000 XP deluxe card for the NTSC format. If your card is an NTSC card (this should be checked on the box as well as on the tuner itself), there is a bit of editing that we need to do before we continue. If your card is PAL, then you can ignore the following.

The "Canada-cable" Issue

There is a problem that seems to plauge various tv cards under linux. Some people could not view the channels correctly unless they used the frequency list called "Canada-Cable". This frequency list was basically just the US-Cable frequency list slightly altered. The reason for this need was because the tuner is not auto-detected correctly. If you experience this issue, run dmesg and check to see what your card was auto-detected as. If your card is an NTSC card, chances are, it was detected as type 5 card (PAL) therefore will not function correctly. Most people have fixed this problem by specifying in their modules.conf tuner=2 which would set the tuner to NTSC and work normally. However, there is one small problem with this that is specific to the Leadtek Winfast TV 2000 XP card, and that is for some strange reason, unless the tuner is auto-detected properly, LIRC (which allows for the Remote support in linux) would not function correctly and allow only some of the keys on the deluxe remote control to work.

So, in order for the tuner to be auto-detected as type=2 (the correct tuner type for the NTSC version) we need to edit the modules source first. In your favorite text editor, open up the following file in your kernel source tree (/usr/src/linux/drivers/media/video/bttv-cards.c). What happens is that the driver defaults to type=5 in the source, so if the card doesn't auto-detect properly, it sets it to 5. We're going to tell it to set to type 2 if it can't auto-detect. In the copy of bttv-cards.c that I have , the relavent section that I will be using starts on line 75, this may vary in your file, so do a search for Winfast and look for a match around this area. Here is a copy of how it looks on my copy:

{

.name = "Leadtek WinFast 2000/ WinFast 2000 XP",
.video_inputs = 4,
.audio_inputs = 1,
.tuner = 0,
.svhs = 2,
.gpiomask = 0xc33000,
.muxsel = { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
.audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000},
/* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
gpio23 -- hef4052:nEnable (0x800000)
gpio12 -- hef4052:A1
gpio13 -- hef4052:A0
0x0000: external audio
0x1000: FM
0x2000: TV
0x3000: n.c.
Note: There exists another variant "Winfast 2000" with tv stereo !?
Note: eeprom only contains FF and pci subsystem id 107d:6606
  • /
.needs_tvaudio = 0,
.pll = PLL_28,
.has_radio = 1,
.tuner_type = 5, // default for now, gpio reads BFFF06 for Pal bg+dk
.audio_hook = winfast2000_audio,

}

On the second last line you see ".tuner_type. = 5", this is where we need to replace the 5 with 2. When this is done, save the file. Now you can go ahead and finish compiling the kernel (make dep; make bzImage; make modules; make modules_install).

Verifying and Testing the Card

Before rebooting your system, you need to add the following to your /etc/modules.conf file, and have them autoload on next reboot (this varies among distributions). options bttv radio=1 gbuffers=4

After your reboot, run dmesg and check and make sure that your tuner was auto detected as type 2 (Philips NTSC (FI1236, FM1236 and compatibles)), if so, then so far so good. Now we need to test the card with a tv application. I suggest TVtime which is the best tv viewing application for Linux. It has active development, great quality, and the authors are great to work with. Make sure you read the available information before installing. When you're ready, go ahead and run it. On first run, TVtime will automatically scan the channels and add them to your channels list.

If you did not get a picture, please visit our Help Forums and ask before you bug the TVtime developers.

Additional Notes

  • To enable access to /dev/rtc , you need to either run tvtime as root, or you can make tvtime setuid with the command "chmod u+s /usr/bin/tvtime". Don't worry, tvtime drops root permissions as soon as it has what it needs, so the security risk is low.

See Also

Linux Infrared Remote Control

External Links