Hauppauge WinTV-HVR-3000

From LinuxTVWiki
Revision as of 01:46, 15 March 2007 by CityK (talk | contribs) (WinTV-HVR3000 moved to Hauppauge WinTV-HVR-3000: fix name)
Jump to navigation Jump to search

Kernel Support

At the time of writing this (January 07), the HVR3000 is a fairly new card. The 2.6.19 kernel was the first stable release to include support, but the defacto kernel available for most of my current OSs is 2.6.17. Hopefully the likes of Debian and Kubuntu will upgrade soon, but if your kernel is pre 2.6.19 you will need a new version of the v4l bit of the kernel.

From reading the commit to Kernel 2.6.19 it would appear DVB-T only is enabled. For the multiple frontends to include DVB-S you need to install as per the instructions below.

V4L (Steve Toth's hvr3000)

Steve Toth is the maintainer of the hvr3000 drivers. He has a working Mercurial (like SVN) copy of v4l (hvr3000) which I believe is the bits which have been patched into the 2.6.19 kernel. I found this http://www.mythtvtalk.com/forum/viewtopic.php?p=17223, which explained how to get and install it. Here is the lowdown:- You will need kernel source, gcc, g++, dvb-apps (aka dvb-utils on some distros) and mercurial.

1) To get the source from Steve Toth type:-

 hg clone http://www.linuxtv.org/hg/~stoth/hvr3000

2) cd to hvr3000 (which has just been created)

3) make (make sure you are booted up to the right kernel before you run make)

Problems

I encountered a number of problems getting mine to work

1) I found that that failed first time, because I was booted into a homemade kernel, and discovered the build expects the kernel uname -r to match that of the kernel source. The first time you run make it stores a file with these details in it and if they're wrong, you're doomed until you <make distclean> and ensure the kernel name and source or the same, or give the build code the appropriate parameters.

2) I also discovered just because gcc is installed, g++ isn't neccesarily.

3) I had multiple build errors relating to files in v4l/aci.c relating to sound mixing or something. So go into <make menuconfig> select 'audio devices for multimedia', then unselect 'ACI Mixer' (press space to unselect), now press escape twice and save your kernel settings. Rebuild this time without the ACI stuff.

4) I also found after installing this, my Webcam stopped working (although I haven't tried to fix this yet).

5) Kernel 2.6.19 under FC6 : Try and make, it fails. Edit the ~/hvr3000/v4l/config-compat.h file and change #include <linux/config.h> to #include <linux/autoconf.h>. I also had to remove the .mdelay = xx line from cx88_i2c.c, zoran_card.c and bttv_i2c.c.

Installation

If that was all successfull then:-

1) make install (this will install the built modules over your kernel ones, in your /lib/modules directory)

2) reboot

Configuration

Once the modules are installed, type

# modprobe cx88_dvb

This should load everything if it isn't already.

Enter directory /dev/dvb/adpaterX for the HVR3000 and you should see more than one frontend (eg demux0 demux1 dvr0 dvr1 frontend0 frontend1 net0 net1). If you only see one of each then the HVR3000 has not installed correctly and your kernel is running the release version of V4l_DVB which presently has no support for the DVB side of HVR3000.

There seems to be some issue getting the tuner to attach to the card, which needs further tracking down. Needless to say, someone suggested adding 'options cx88xx i2c_scan=1' to my /etc/modules.conf so I created a file containing just that line in my /etc/modprobe.d directory and it seems to work. This needs work to figure out why.

LIRC seems to work out of the box (at least for me). The remote sends cursor commands (up down left right) and enter and numbers quite happily regardless of application. I need to do further work to get the other things to work in a normal way.

Testing

DVB-T

To test the card the following command for testing the DVB-T can be used. Use the relevant channel info in the dvb-t folder for your transmitter.

# scandvb /usr/share/dvb-apps/dvb-t/uk-EmleyMoor > channels.conf 

If the card is working this will create a channels.conf file with the channel information

To test you can copy the channels.conf into your ~/.mplayer folder and view with mplayer by issuing a command like

# mplayer dvb://0@'BBC ONE'

Note : Some dvb-apps : scandvb is dvbscan

DVB-S

For testing DVB-S we also use scan DVB with the provided initial tuning data. Use the correct data for your satelite. Note the -f (frontend) and -d demux options to select the correct fe. You can also specify which DVB adapter by adding option -a 2 for /dev/dvb/adapter2 etc.

# scandvb -f 1 -d 1 /usr/share/dvb-apps/dvb-s/Astra28.2E > channels.conf

The method shown in DVB-T can be used to view the channel. Or you can use dvbstream to stream it into mplayer. Example.

# /sbin/dvbstream -o -f 12421 2343 2345 -p H -s 27500 -c 2 | mplayer - 

MythTv users don't forget to set the Diseqc option to LNB if you have a basic sat dish.

Newbie stuff

Ok, so it all seems to be working, how do you test it. Well firstly the devices the drivers create should exist. Firstly /dev/video? (where ? will be a number, in my case its /dev/video0) shows the video stream. Next there will be a /dev/dsp? which shows the audio stream (presented as a line in type ossdsp device), which also shows up as an alsa device (if you've loaded cx88_alsa). For alsa see /proc/asound/cards to see which device is for the cx88, then look in /dev/snd/pcmC?D0c (where ? will be the card number found earlier) aka ALSA:hw.?,0. To test the card use tvtime or xawtv or even mplayer to watch the video stream. I found tvtime slightly easier to setup and control (with a mouse). Once you're happy you can change channel (up and down I believe) and change device (the key i) you're ready to try pulling it all together.

Sound

To hear sound from the card you will need to pipe the sound output from the cards sound device back into your sound card. There are a number of ways of doing it, but I only managed to make 1 work properly. In theory you can use sox to stream from one device to another, but I had problems with resampling and it just sounded wrong. You can also use arecord to get data from the alsa device, then pipe it to aplay using - as a source (stdin), but when I did that the sound came out nearly a second later than the picture. I had success only using mplayer:-

 mplayer tv://25 -tv driver=v4l2:device=/dev/video0:norm=PAL-I:chanlist=europe-west:\
                   alsa:adevice=hw.2,0:amode=1:audiorate=48000:volume=100:\
                   immediatemode=0:buffersize=32 -aspect 16:9

Where My Sky DigiBox is tuned to channel 25, my video card is /dev/video0 it's PAL-I (europe-west) and the cx88_alsa device is card2 sub 0 (ie hw.2,0). I want sound in stereo (amode=1) at 48k. I had problems with buffers overflowing, so I set the buffersize to twice what was needed and the sound is now perfect.

My Sky DigiBox is setup for a 16:9 screen, even though PAL-I isn't so the -aspect 16:9 corrects the screen size

Useful Information

Remote Control

The HVR3000 has onboard IR receiver. This can be configured by following the V4L wiki here at LinuxTV. Search Remote Contollers.

I found however when you booted with or without a keyboard and mouse the event no changed and you had to manually start lircd each time. The following bash script is a simple way of automatically determining the event no and starting lircd.

The script has a work around for systems with more than one HVR3000 card. Please adjust the cardno to start.

#!/bin/bash 

#Determin the first card number 
EVENTNO=`cat /proc/bus/input/devices |grep HVR300 -A 3 | grep -o event[[:digit:]] | grep -o [[:digit:]] -m 1` 

#If we have 2 tuner cards with IR set this as 2, otherwise 1 
CARDNO=2 
EVENTNO2=$[EVENTNO+CARDNO-1] 

#Start Lircd with the right event 
echo "Starting lircd...." 
sudo /usr/sbin/lircd -H dev/input -d /dev/input/event$EVENTNO2 

#Start mythbackend if not running 
sudo /etc/init.d/myth* start 

#Start the frontend 
mythfrontend 

Multiple Frontends

There does not seem to be a concencous on multiple frontends and how to handle them in applications. The basic DVB apps can easily select the correct frontend, but for instance in MythTV this support is not available and will only select a complete adapter.

It is suggested to create symbolic links as follows.

mkdir /dev/dvb/adapter1 
ln /dev/dvb/adapter0/demux1 /dev/dvb/adapter1/demux0 
ln /dev/dvb/adapter0/frontend1 /dev/dvb/adapter1/frontend0 
ln /dev/dvb/adapter0/net1 /dev/dvb/adapter1/net0 
ln /dev/dvb/adapter0/dvr1 /dev/dvb/adapter1/dvr0 

But be warned it is one or the other, if your application trys to open both adapters at the same time it will fail.