Sunday, 6 January 2008

TV Tuner Beholder BeholdTV 409FM in Linux

For TV Tuner to work in Linux properly, several steps should be performed. Described steps below are suitable for other devices of such type: for example, webcams. Only kernel modules parameters will be different.


Tweaking TV Tuner in Debian Linux

If you are using default distribution kernel, this section is certain can skipped. Type in terminal dmesg and there should appear something like that::

saa7130/34: v4l2 driver version 0.2.14 loaded
ACPI: PCI Interrupt 0000:06:02.0[A] -> GSI 18 (level, low) -> IRQ 18

saa7133[0]: found at 0000:06:02.0, rev: 240, irq: 18, latency: 32, mmio: 0xdfeff800

saa7133[0]: subsystem: 0000:4091, board: Beholder BeholdTV 409 FM [card=67,autodetected]

saa7133[0]: board init: gpio is c0c000

input: saa7134 IR (Beholder BeholdTV 4 as /class/input/input3

saa7133[0]: i2c eeprom 00: 00 00 91 40 54 20 00 00 00 00 00 00 00 00 00 01

saa7133[0]: i2c eeprom 10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

saa7133[0]: i2c eeprom 20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

saa7133[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

saa7133[0]: i2c eeprom 40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

saa7133[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

saa7133[0]: i2c eeprom 60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

saa7133[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

tuner 1-0060: All bytes are equal. It is not a TEA5767

tuner 1-0060: chip found @ 0xc0 (saa7133[0])

tuner 1-0060: type set to 38 (Philips PAL/SECAM multi (FM1216ME MK3))

tda9887 1-0043: chip found @ 0x86 (saa7133[0])

saa7133[0]: registered device video0 [v4l2]

saa7133[0]: registered device vbi0

saa7133[0]: registered device radio0
You can receive different diagnostic messages, but principle is the same:
  • Driver name - saa7133
  • Tuner name - Beholder BeholdTV 409 FM and card number card=67
  • Driver number for  tuner 1-0060: type set to 38 (Philips PAL/SECAM multi (FM1216ME MK3))
Thus, this numbers should be remembered or written. By default, a PAL standard is set for TV Tuners. To tell kernel module proper parameters, one must reload them with proper settings:
rmmod saa7134
modprobe saa7134 tuner=63 card=67

rmmod tda9887

modprobe tda9887 secam=d

chmod 777 /dev/video0
Greyed line is suitable only for countries with SECAM TV standard (for example, Russia).
This example covers Behold 409FM and kernel version below 2.6.18. For newer kernels (version > 2.6.18), one should use that parameters:

rmmod saa7134
modprobe saa7134 tuner=63 card=67

rmmod tuner

modprobe tuner secam=d

chmod 777 /dev/video0

Please pay attention that in /dev/ should appear new device file
video0 - here is our tuner, and this device file will be used by programs. Often many problems arise with incorrect (mostly, insufficient) permissions to /dev/video0. Thus, give maximum permissions to file:
sudo chmod 777 /dev/video0

If you have a customized linux kernel
In customized kernel, an I2C and Video4Linux support must be activated and a driver for TV Tuner chip as well. It is notable that one kernel module supports a couple of tuners!

Hence, let's compile i2c and
Video4Linux monolithically, and I2C drivers and tuner driver as modules. If you are uncertain of which driver is necessary, use
lspci
Moreover, in Documentation section of kernel sources, video4linux subsection, practically all driver parameters are described.


If TV Tuner does not work under Linux...
Consult with current kernel documentation - there should be answer of which tuners are supported. Consider to upgrade your kernel to fresh one. On the off-chance, documentation on kernel is located here: /usr/src/linux-2.6.zz.z/Documentation/video4linux where zz.z is your exact kernel version.

Inside this directory,
should be several files like CARDLIST.yyy, where yyy - driver name. Open this files and search you tuner name. If you can't find your tuner there, upgrade the kernel.

If you are lucky, you can find even a card number - for my Beholder409 it is:
./video4linux/CARDLIST.saa7134

...
67 -> Beholder BeholdTV 409 FM [0000:4091]
...
This is exact card number, just substitute it in command
modprobe saa7134 tuner=63 card=67

The same situation appears with CARDLIST.tuner - it must be only one, but this file contents tuners number. In dmesg output you should see:
tuner 1-0043: chip found @ 0x86 (saa7133[0])
tda9887 1-0043: tda988[5/6/7] found @ 0x43 (tuner)
tuner 1-0060: All bytes are equal. It is not a TEA5767
tuner 1-0060: chip found @ 0xc0 (saa7133[0])
tuner 1-0060: type set to 38 (Philips PAL/SECAM multi (FM1216ME MK3))
Hence, 38 is my tuner number (again, for Beholder409). The same number is in file:
tuner=38 - Philips PAL/SECAM multi (FM1216ME MK3)

Searching TV channels
I hope that your tuner is detected, so the only thing remaining is to install software:
aptitude install tvtime
This is one of the coolest program for TV Tuners that stood out from the rest of programs (tvtime, xawtv, zapper). After installation of tvtime, let's search channels:
tvtime-scanner
which starting to scan all frequencies and search TV channels:
Reading configuration from /etc/tvtime/tvtime.xml
Reading configuration from /home/penta4/.tvtime/tvtime.xml
Scanning using TV standard SECAM.
Scanning from 44,00 MHz to 958,00 MHz.
Found a channel at 59,50 MHz (58,25 - 60,50 MHz), adding to channel list.
Found a channel at 63,00 MHz (62,75 - 63,00 MHz), adding to channel list.
Found a channel at 77,50 MHz (77,25 - 77,50 MHz), adding to channel list.
Found a channel at 79,75 MHz (79,50 - 79,75 MHz), adding to channel list.
Found a channel at 85,50 MHz (84,25 - 86,50 MHz), adding to channel list.
Found a channel at 111,50 MHz (110,25 - 112,50 MHz), adding to channel list.

After that, run tvtime and rearrange found channels to your own taste
.
Take a note that computer TV Tuners (especially internal) are known to provide worse picture quality and less channels than conventional TV. This is caused by strong electromagnetic noise and cross-talks inside computer.
As a result, in your home directory should appear hidden directory .tvtime where all TV tweaks are placed.

0 comments: