Corey's TV Tuner Guide
Created on September 19th, 2003.
Updated on October 15th, 2003.
1. Preface
2. TV Card
3. Kernel Preperation - What to enable in your kernel to use a tv tuner.
4. The "Canada-Cable" Issue - Explains the mysterious "Canada-Cable" problem and fix.
5. Verifying and Testing the Card - Using TVtime to test your card.
6. Additional Notes - Additional notes.
7. Installing Lirc - Instructions on Installing Lirc
8. Configuring Lirc - Configuration for Lirc
9. Helpful Links
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:
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 CardBefore purchasing your TV tuner, there are a few things you should check out first. You should definitly go for a PCI tv tuner cards, from people i've talked to and reviews that I've read, USB tuners are no good. Aparently 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 PreperationFirst 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:
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" IssueThere 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 CardBefore 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 veiwing 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.
LIRC is the daemon that allows for your remote control to control various things in linux. This part of the guide will focus on getting your remote to work with TVtime.
Installing LIRCWe will need to compile LIRC from source because there is another edit we have to make to a source file. We need to fix the problem of LIRC only recognizing some of the keys on the Winfast TV 2000 XP deluxe remote control.
First off, download the latest stable source for lirc here. Unpack it into your /usr/src directory. I have created a patch that will update the nessesary files in the lirc-0.6.6 release to work correctly with the Leadtek Winfast TV 2000 XP Deluxe card, you can download it here. Apply the patch from the lirc source directory with "patch -p1 < /path/to/patch-lirc-0.6.6-winfastdeluxe.diff". If you would rather not patch, I have a modified version of the lirc source created, you can download it here. (Please read the included README-WINFAST file)
Configuring LIRCThere are two parts to the LIRC configuration, the first part you should have completed already in the above section for installing the lircd.conf file. The section part is the ~/.lircrc file that will interpret remote control key-presses and send them to your tv application. For this guide, I will assume you are using TVtime. I have included a copy of my lircrc config file here. For more information, please check out Lirc.org's Lircrc format doc. Place your lircrc file in your home directory ( ~/.lircrc ). Then you need to run "irexec -d" which is what will be capturing your remote keypresses and sending them to tvtime.
Test your remote by pressing the power button, if TVtime opens, go ahead and test all your buttons out to ensure everything is working fine. If so, congraduations, you now have a working tv card with remote control support.
Helpful LinksHaving trouble? Got questions? Require further assistance? If so please feel free to visit our Help Forums and ask the experts!