mercoledì 5 novembre 2008

How to - webcam & tv tuner at the same time with Ubuntu 8.10

Do you own a tv tuner and you would like to use it under linux, but you can't 'cause it conflicts with your system webcam and you are going to get crazy with modules and nodes?
Ubuntu 8.10 (and the 2.6.27 linux kernel in particular) are a lifebelt in this sense!

It works! :D

A better handling of videodev modules and, consequently, a smarter creation of /dev/video nodes from the kernel, let all of us use multiple input video devices at the same time!
My devices are the built in webcam in an Asus A6j laptop, that works like a charm with the Syntek drivers embedded in this release, and a Terratec Tv tuner model Cinergy Hybrid T usb XS, that works with the em28xx-dvb modules.

Since on the net is pretty difficult to find a complete guide (I couldn't find one...) I've decided to write a couple of lines about it.

The procedure is mainly described in, then some good "old" googling, searching for minor fixes has completed the frame.

First of all, a consideration: this procedure works well with my hardware, since I've done no testing with other configurations I cannot guarantee that it will suite for your hw... However I will be glad to try to solve any problem that could come out e I will be even more happy to have feedback on working configurations!

3,2,1...Let's go!

We will need some software during the procedure, it is better to install it first: cheese for the webcam, kaffeine for the tv tuner (for the dvb-t transmissions, to be precise), mercurial to download the driver's sources and build-essential for all the tools needed for compiling.

Note that Kaffeine is not the only software capable of visualizing the digital straming from the tv tuner, but, imho, it is the simplest, more intuitive and more functional piece of software that you can find for this scope!

You can install everything at once, by opening a terminal and paste:

sudo apt-get install kaffeine build-essential cheese mercurial

Now you can download the sources for the tv tuner with this command

hg clone

and move to the downloaded directory

cd v4l-dvb-experimental

We could now compile with the classic make && make install commands, but there is a script ( that is designed exactly for this scope, it's up to you to chose which way to use.

With the script (that, obviously needs admin rights) the commands are:

sudo ./ build

for compiling and then

sudo ./ install
sudo ./ load

to load them in the kernel.

Unfortunately with both methods, here come the problems: when you start compiling, the compiler breaks with this error message (I've cut'n'pasted just the last lines):


make: *** [default] Error 2
cp: cannot stat `drx3973d/drx3973d.ko': No such file or directory
cp: cannot stat `tvp5150/tvp5150.ko': No such file or directory
cp: cannot stat `lgdt3304/lgdt3304.ko': No such file or directory
cp: cannot stat `zl10353/zl10353.ko': No such file or directory
cp: cannot stat `cx25843/em28xx-cx25843.ko': No such file or directory
cp: cannot stat `xc3028/tuner-xc3028.ko': No such file or directory
cp: cannot stat `xc5000/tuner-xc5000.ko': No such file or directory
cp: cannot stat `em28xx.ko': No such file or directory
cp: cannot stat `em28xx-audio.ko': No such file or directory
cp: cannot stat `em28xx-aad.ko': No such file or directory
cp: cannot stat `em28xx-audioep.ko': No such file or directory
cp: cannot stat `em28xx-dvb.ko': No such file or directory
cp: cannot stat `qt1010/qt1010.ko': No such file or directory
cp: cannot stat `mt2060/mt2060.ko': No such file or directory

The solution is actually simple, you have to copy three files from kernel sources.
Let's download the sources with

sudo apt-get install linux-source

move to /usr/src and unarchive the downloaded package (io use nautilus with admin rights 'cause I'm used to, but tar -xjvf is perfect too!)

When the archive is extracted, copy the files with

sudo cp linux-source-2.6.27/drivers/media/dvb/dvb-core/*.h linux-headers-2.6.27-7-generic/drivers/media/dvb/dvb-core/
sudo cp linux-source-2.6.27/drivers/media/dvb/frontends/lgdt330x.h linux-headers-2.6.27-7/drivers/media/dvb/frontends/
sudo cp linux-source-2.6.27/drivers/media/video/msp3400-driver.h linux-headers-2.6.27-7/drivers/media/dvb/frontends/

(of course the kernel number may be different depending on your kernel version!)

and, after coming back to the directory that contains the drivers (v4l-experimental), you can execute the compiling procedure once again.

When you have done, control whether the module has been correctly installed in the kernel with

lsmod | grep em28xx

If nothing comes out, it is sufficinet to reload the module with

sudo modprobe em28xx

We have almost done! have now to download the correct firmware (that will be saved on the hd, not writed in the tuner memory!) for your tv tuner...
Let's move to /lib/firmware

and download the correct firmware with

sudo wget

where, insted of FIRMWARE, you have to insert the name of the correct firmware for your device. There are four different firmware versions: firmware_v1.tgz, firmware_v2.tgz, firmware_v3.tgz and firmware_v4.tgz
In theory the highest the number the better the firmware (since it is more recent), but Terratec model Cinergy hybrid T XS needs version 3 (and a small group of those devices, pricipally the French version, recognizable from the ID 0ccd:005e with the command lsusb, need version 2 of the firmware).
However it is not a big deal to try one firmware and, eventually, change it with another one.

No it is sufficient to plug the tv tuner and, launching kaffeine you will find an extra button for digital tv (and by pressing "C" you can open the frequency scanner to tune the device and find all the channels).

Those are the results of tail -f /var/log/messages when the device is plugged after the modules have been correctly loaded:

... em28xx: new video device (0ccd:005e): interface 0, class 255
... em28xx: device is attached to a USB 2.0 bus
... attach_inform: tvp5150 detected.
... tvp5150 3-005c: tvp5150am1 detected.
... successfully attached tuner
... em28xx #0: V4L2 VBI device registered as /dev/vbi0
... V4L2 device registered as /dev/video1
... em28xx-audio.c: probing for em28x1 non standard usbaudio
... em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
... em2880-dvb.c: DVB Init
... register disabled
... DVB: registering new adapter (em2880 DVB-T)
... DVB: registering frontend 0 (Zarlink ZL10353 DVB-T)...
... input: em2880/em2870 remote control as /devices/virtual/input/input10
... em28xx-input.c: remote control handler attached
... em28xx #0: Found Empia Hybrid ATSC (em2882)

A guide for using the analog receiver of the Cinergy Hybrid device will be posted as soon as I find all the info to make it work properly.

So, now more than anytime, stay tuned! :D


Nessun commento:

Posta un commento

commentando accetti implicitamente le regole del blog, leggile!