Computers 'n Stuff: Installation and setup of the em28xx linux driver for analogue devices like the PCTV analog USB 2 (150e/55e) in opensuse 10.2

I here share the resolutions for my Linux problems so they might safe somebody some time.

Saturday, May 26, 2007 parmanent link to this post

Installation and setup of the em28xx linux driver for analogue devices like the PCTV analog USB 2 (150e/55e) in opensuse 10.2


Ihave an old Pinnacle analog USB video grabber device which I bought some time ago for no particular reason. I tested It in windows but picture quality and software sucked. Channel switching took forever and nothing worked the way I wanted it to, so I stopped using it. But now I tried to install it in OpenSuse Linux just for the hack of it. Here I write my experiences with this device.

First I have to say that Linux actually supports this device and the picture quality of the linux driver and tv sofware is much better than that provided by pinnacle for windows. So if you want to use this PCTV analog usb its well worth switching to linux.

The PCTV analog USB is em2820 videodecoder chip based vido grabber with an LG TAPE series tuner. I once cracked it open to see the chips inside the PCTV analog USB 105e 55e

If you want to use the 150e/55e with OpenSuse 10.2 the em28xx driver which is a successor of the em2820 is the right choice. As far as I understand it, this driver is part of the v4l project and is maintained by Markus Rechberger, Mauro Carvalho Chehab, Aapo Tahkola, Ludovico Cavedon, Sascha Sommer, Aidan Thornton. Thanks to them we can now use this budged video grabber with a great quality driver.

The em28xx is loaded as a kernel module in OpenSuse 10.2 as soon as a PCTV analog USB is connected to a USB port. It then automatcally creates device nodes /dev/dsp (digital audion/pcm) and /dev/video (raw video).

You first have to update the em28xx driver that comes out of the box of OpenSuse 10.2, this means you have to compile them from source and install them. This sounds harder than it is, so don't get scared. The result is well worth the effort.

The updated drivers from may 2007 will allow you to use the following software in addition to mplayer which is also supported by the old Suse driver:

MythTV, TVtime, Kdetv, freevo. In addition the picture quality is markedly improved, setting the resolution of the grabbed video image and setting of the correct videonorm is now possible. Last but not least no VBI device is initialized any more which might also cause some strange errors.

To update the driver you will have to install gcc, kernel-sources, kernel-headers and mercurial packages using your favorite packet manager e.g. yast2 for OpenSuse. In addition you need SOX for the operation of the digital audio. Now you are prepped to download and build the drivers. This is quite easy since the PCTV analog USB 150e 55e doesen't need firmware or any kind of DVB support like DVB cards would require which are also supported by the em28xx. To dowload the sources and to build the driver type:
# hg clone http://mcentral.de/hg/~mrec/v4l-dvb-kernel
# cd v4l-dvb-kernel
# make
# make ./install
If this driver update doesen't solve your problem then you might consider to try the experimental tree of the driver:
# hg clone http://mcentral.de/hg/~mrec/v4l-dvb-experimental
# cd v4l-dvb-kernel
# make
# make ./install


Markus Rechberger also suggested somwhere (cant remember the link, though) to reinstall the media/lib to troubleshoot problems with using tvtime. This helped me too to get TVtime working. This could be done by:

# rm -rf  /lib/modules/`uname -r`/kernel/drivers/media

and then reinstalling the drivers. May be that will help if you are experiencing problems which can't be solved otherwise.

In OpenSuse the module (modprobe or insmod) options live in /etc/modprobe.d/tv. The driver has to be loaded to with the correct options so that It will support the PCTV correctly. My /etc/modprobe.d/tv looks like this:
alias char-major-81 videodev
alias char-major-81-0 off
alias char-major-81-1 em28xx
alias char-major-81-2 off
alias char-major-81-3 off
options em28xx card=8 tuner=47 disable_ir=0


All available valid insmod options for card= and tuner= for em28xx are listed here

Without the tuner=47 option I could not tune UHF channels with my device.

Testing video playback

If you have mplayer installed then you can use it to test for correct setup. An mplayer command which is successfully used to start mplayer for tv playback was:
# mplayer -tv device=/dev/video0:amode=0:input=0:norm=PAL:driver=v4l2:outfmt=yuy2 tv://E6
this should tune channel E6 and open a tv window. Use h and k to switch channels. Note that /dev/video0 has to be adjusted to match your PCTV videograbber. It might also be /dev/video1 or the like if you have multiple video input devices.

This one starts mplayer with audioplayback enabeled without the need of SOX
# mplayer -tv driver=v4l2:device=/dev/video0:amode=1:input=0:norm=PAL:adevice=/dev/dsp1:immediatemode=0:audiorate=48000 tv://
Note that /dev/dsp1 needs to match the Audioinput of your PCTV Videograber. It might be /dev/dsp0 or the like.

Audio setup
The PCTV analog USB features no analog output which you could plug into the line in input of your audio card. The PCTV features digital audio (PCM) which has to be piped to the digital sound input of you sound card. Of the software I have tested only mplayer and MythTV can read directly from the digital sound device of the PCTV analog USB and output it over your soundcard. Kdetv, xawtv, motv and freevo remain silent because they expect an analgo output to be connected to the line in of your sound card. For these tv viewers you'll need a workaround. You have to install and use sox to pipe the digtal audio from the tv card to your sound card.
these commands worked for me:
# sox -t ossdsp -r 48000 -b -c 2 /dev/dsp1 -t ossdsp /dev/dsp
# v4lctl -c /dev/video0 volume mute off

(/dev/dsp1 is the pcm device of the analog USB and /dev/dsp is the PCM in of you audiocard. /dev/video0 should be the PCTV analog USB) Change this if the names of the devices on your box differ) now you should hear the sound of the channel you just tuned to with your PCTV analog USB. If you hear only static then try to tune to another channel. Now you can fire up your TV-viewer software e.g kdetv to swich the channels.


Links:
em28xx driver FAQ A lot of problems get addressed here
em2820 driver FAQ this is the old version of the em28xx driver. All development is done on the em28xx now I guess, but you can find some troubleshooting hints for the PCTV analog USB 10e 55e since it is a em2820 based device.
Official em28xx Project Wiki

Labels: ,

3 Comments:

Blogger Unknown said...

Sox gives an error because c is not a valid integer. And MPlayer can't be switched to composite.

Tuesday, March 09, 2010 4:23:00 AM

 
Blogger Unknown said...

This all is too hand made. Now I switched MPlayer to composite and have to make it deinterlace now. MythTV does not let me start watching and it's a totally crapy program. I just hate it. All the others really don't get the PCM Channel. This is Linux Stone Age.

Tuesday, March 09, 2010 4:37:00 AM

 
Anonymous www.lugo-3d.com said...

Goodness, there is a lot of useful data here!

Monday, November 21, 2011 12:20:00 AM

 

Post a Comment

<< Home