Re: Anybody want a device driver?

Alan Cox (
Thu, 8 May 1997 18:59:09 +0100 (BST)

> Something I have been looking for is video capture and/or TV Tuner
> capability in the U.S. and would buy whatever board/system supported these
> under Linux, either in X, SVGA, or simply standalone (e.g. cat /dev/video
> >movie.avi).

Several BT848 based TV tuners have support under Linux in the BT848 driver.
There is also a Matrox meteor driver.

> If there is some specific hardware, it would be the Nogatech PCMCIA
> adapters (they have both tuner and video variants) so I could use them
> with my laptop.

That would so cool on a PC110


bttv - BT848 frame grabber driver 0.3

Copyright (C) 1996,97 Ralph Metzler ( & Marcus Metzler (

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

This driver is solely based on a Bt848 manual and Philips data sheets for the various chips of the tuner. (No "NDAed" code, no reverse engineering) Except for the tuner and videotext code it should work on any card using the Bt848. The following cards (AFAIK) use a Bt848: Miro PCTV, Hauppauge Win/TV pci, STB PCI TV

The only differences between the cards are the types of tuners used and extra components on the boards. E.g., the Hauppauge cards (at least the German version 405) have an additional Videotext decoder chip, while the Miro product will have to do this in software. On the other hand, the Miro cards have both crystals (for NTSC AND PAL) and an S-VHS input on board.

The driver is tested to work on the Miro PCTV and Hauppauge cards using PAL. It did not work on STB cards yet because they only have NTSC versions. I hope the new NTSC code will change that.

NTSC is tested to work on a Miro PCTV with the signal from a multinorm VCR playing back an NTSC video. (I have to rent the tape from a store downtown. Since I cannot copy the tape with my VCRs (only NTSC playback) I can only test this if there is a new movie in NTSC available. If you want to send me a tape with NTSC recording make sure it has a season 4 Babylon 5 episode on it :-) ) I also tried it with a signal from a satellite transponder (I only found one with NTSC here in Germany) but had problems getting any sync. But I had the same problem with some PAL signals from the same satellite. Strange ...

Starting with version 0.3 you can use several cards at the same time. I tested this with a Miro PCTV and a Hauppauge Win/TV pci (304) in an ASUS P55TP4N (430FX, Triton I chipset). IRQs are shared but can also be different. The (arbitrary) maximum number of cards is 4 but can be adjusted by changing BTTV_MAX at the beginning of bttv.c if you need more. (But which board has more than 4 slots plus 1 for the VGA card?)

Does the NTSC version of the Hauppauge cards have the same tuner (or at least the same I2C tuner interface)? Please look under the metal shielded case and tell me if you also have a TSA5522, TDA5737 and TDA9800 in there!

This is still a test version and might crash your computer! Use it at your own risk! Only kernel versions 2.0.x and 2.1.x are supported. If you use 2.1.x then 2.1.16 with modutils 2.1.13 is a good start. For newer kernels the modutils have to be fetched from and they still seem to be severely screwed up. E.g., I cannot get it to work with 2.1.22 and I did not try any newer 2.1.x kernels yet. Of the 2.0.x kernels I only tested 2.0.28.

I will not support older kernels at this time. If you upgrade your system to a 2.x.x kernel you might also have to get new module utilities, a new libc, etc. Read the file linux/Documentation/Changes in the kernel sources for details.

If you have a Hauppauge board read "README.Hauppauge"!!!

Support for the videotext decoder chip SAA5246 on Hauppauge Win/TV cards to work over the I2C interface of the Bt848 with the Videotext package by Martin Buck is included in the vtx-driver sub-directory. (The videotext decoder chip is not included on the WinCast/TV card or AFAIK other non-Hauppauge cards. ) You can get the videotext package at sunsite in: /pub/Linux/apps/video/videoteXt-0.6.tar.gz

Matrox Millennium and S3 cards are supported and tested to work. Support for other cards will be added if there are volunteers for testing or somebody sends me detailed information about the card or a test card. If you test this with S3 cards, install the wintv module AFTER starting X11 for the first time!!! Since X11 checks for 64MB alignment of the videomem it might remap it and wintv would write into the wrong memory (actually into non-existing memory ...). There might be even more problems with S3 cards. Read the file PROBLEMS for details.

The driver is tested by myself with Accelerated X 1.3 and XFree 3.2(A) on a Matrox Millennium. Older XFree versions seem to be a problem with some S3 cards (see PROBLEMS).

How to test watching TV:

go into X11 in true color or high color. 8 bit modes (256 colors) are not supported yet and do not look that good anyway :-)

Do a "make" to compile driver and xwintv. Install the driver with "make ins". This will also create /dev/wintv. start "xwintv".

use "i" to toggle tuner and video input, tune with "+" and "-" (starts at approx. 591 Mhz=channel 36 in Europe), use "n" to toggle between PAL and NTSC.

there are no status displays yet.

This might only create a few lines of sampled data in a window and then crash the whole computer. On Triton I chipsets (430FX) it no longer crashes on my T5TP4N since I disabled Bus Concurrency and on other Triton I boards if I also disable Streaming and Peer Concurrency. If the driver crashes on your system, please try to find settings in the BIOS setup which work and mail me what you had to change!

"xwintv" is just hacked together from old ugly sources I once used for X programming. In XTV is a first test version of the Motif program XTVscreen. It should also compile with LessTif. A statically linked version is (or will soon be) available. (Check

To grab into main memory is still kind of complicated in Linux and I did not decide yet how to do it. Some drivers (e.g. Matrox Meteor) reserve a large memory chunk at boot time for grabbing into and let user programs mmap() it. Since the Bt848 can write each line (or even parts of lines) to a different memory location, I actually don't need one continuous chunk of memory and could allocate a 4Kb page for each line (enough for 1024 pixels with 32bit per pixel, which is more than enough). Some test code for this is already in bttv.c. But don't hold your breath ...