Hauppauge WinTV-HVR-3000

From LinuxTVWiki
Revision as of 08:34, 15 October 2010 by Davemc (talk | contribs) (expand shortcut text.)
Jump to navigation Jump to search
Hvr3000.jpg

The Hauppauge WinTV-HVR-3000 is a DVB-T and DVB-S on one PCI card sharing the same Demux.

Kernel Support

Kernels 2.6.28-rc1 and later have a working multiple frontend driver built in.

Darron Broad & Fabio M. Di Nitto HVR3000/4000 comes in two flavours as a diff patch, one with a single frontend (you select frontend via options flag in modprobe.conf eg single /dev/adapter0/fe0) and the other with both frontends (selectable from adapter0/fe0 and adapter fe1)

This uses work from Steve Toths original HVR3000 repository (at time of writing 16 months old and will not compile with current v4l-dvb)

There are several sets of patches at http://people.debian.org/~pm/hauppauge/ : a single frontend patch only for HVR3000 against 2.6.26-rc version kernels, and several revisions of Darron Broad's multiple frontend scratcpad-8628.diff patch (from http://dev.kewl.org/hauppauge ), cleaned up and updated for v4l-dvb revisions 8628 and 8854.

Components Used

  • Conexant CX23882 PCI Broadcast Audio/Video Decoder
  • Conexant CX22702 DVB-T chip
  • 14109LF Rev B3D3 Tuner

Identification

If your kernel doesn't support it

01:06.0 Multimedia video controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
        Subsystem: Hauppauge computer works Inc. Unknown device 1402
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
        Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
        Latency: 32 (5000ns min, 13750ns max), Cache Line Size: 32 bytes
        Interrupt: pin A routed to IRQ 16
        Region 0: Memory at f8000000 (32-bit, non-prefetchable) [size=16M]
        Capabilities: [44] Vital Product Data
        Capabilities: [4c] Power Management version 2
                Flags: PMEClk- DSI+ D1- D2- AuxCurrent=0mA PME(D0-,D1-,D2-,D3hot-,D3cold-)
                Status: D0 PME-Enable- DSel=0 DScale=0 PME-

If your kernel does support it

01:06.0 Multimedia video controller: Conexant Systems, Inc. CX23880/1/2/3 PCI Video and Audio Decoder (rev 05)
        Subsystem: Hauppauge computer works Inc. Device 1402
        Flags: bus master, medium devsel, latency 32, IRQ 16
        Memory at f8000000 (32-bit, non-prefetchable) [size=16M]
        Capabilities: [44] Vital Product Data <?>
        Capabilities: [4c] Power Management version 2
        Kernel driver in use: cx8800
        Kernel modules: cx8800

Driver Sources

Steve Toth's repository (22 Sep 2008)

On September 2008, you can get patched v4l sources from Steve Toth's repository ( http://linuxtv.org/hg/~stoth/s2-mfe/ ) via mercurial and you won't have to get any patch to get working this card (this version also has got support for HVR4000). It has been tested on Ubuntu 8.04.1 (working DVB-T and DVB-S, analogue audio didn't work for me) with a 2.6.24-21-generic kernel version/flavour. The way to compile the modules is the same as it would be getting the official v4l sources but without having to patch them. The way to get the v4l "patch included" sources is (supposing that you have mercurial installed):

 # hg clone -r 8894 http://linuxtv.org/hg/~stoth/s2-mfe

After it, on the s2-mfe directory you get a patched version of the v4l drivers. Maybe you will want/need to configure it, with a "make menuconfig". Finally, just compile and install the modules:

 # make && make install

Remember: on ubuntu you need to delete the "original" modules for cx88 and saa7134

 # rm -rf /lib/modules/`uname -r`/ubuntu/media/cx88
 # rm -rf /lib/modules/`uname -r`/ubuntu/media/saa7134
 # depmod -a

To load modules on the right order, follow the next bash script:

#!/bin/bash
modprobe cx8800 && modprobe cx88xx && modprobe cx8802 && modprobe cx22702 && modprobe cx88-dvb && \
echo "Successfully loaded HVR-3000 modules"
exit

On Ubuntu 8.10 Intrepid, when kernel changed from 2.6.27-7 to 2.6.27-9 or to 2.6.27-11, you must delete the previous kernel headers 2.6.27-nn, the old modules in directories cx88 and saa7134 (they are now in /lib/modules/`uname -r`/kernel/drivers/media/video/. ), do a depmod -a, then download the new s2-mfe tree, recompile and reinstall.

kewl.org HVR3000 (06 Mar 08)

Please follow these instructions based on FC8/Ubuntu 8.04 using yum or apt-get.

# yum install mercurial

Or

# apt-get install mercurial

As the current patch does NOT work with the current version of v4l you will have to pull a working revision from the repository. In order to do that you will have to install one of the newer versions of mercurial. So if your version of Mercurial doesn't support revisions you will have to get an updated package or compile a current version yourself.

# hg clone -r 7285 http://linuxtv.org/hg/v4l-dvb
# cd v4l-dvb

Or (Plan B Tested on 2.6.22 ====DVB-S==== Only)

# hg clone -r 7879 http://linuxtv.org/hg/v4l-dvb  
# cd v4l-dvb

Then get the diff you want (sfe or mfe). Note how the filename represents the version of the v4l repository that you have to use. You can also check at http://dev.kewl.org/hauppauge if a newer version of the patch exists and use another version of the repository accordingly.

# wget http://dev.kewl.org/hauppauge/sfe-7285.diff

Or

# wget http://dev.kewl.org/hauppauge/mfe-7285.diff

Or (Plan B Tested on 2.6.22 ====DVB-S==== Only)

# wget http://linuxtreme.net/Drivers/Patches/sfe.diff


Apply the patch

# patch -p1 < *fe-7285.diff

Or (Plan B Tested on 2.6.22 ====DVB-S==== Only)

# patch -p1 < sfe.diff

(Optional) Remove modules from *buntu 8.04

This step is only required if you are running an Ubuntu variant, after one of their bug fixes duplicated the modules being run.
This also may be useful to anyone who gets dmesg errors like : cx88xx: disagrees about version of symbol (videobuf_dma_free)
# rm -rf /lib/modules/`uname -r`/ubuntu/media/cx88
# rm -rf /lib/modules/`uname -r`/ubuntu/media/saa7134
# depmod -a


Compile and Install

# make
# make install


If you apply the patch and get errors, you can contact Darron at kewl dot org whom will most likely refresh the patch against the latest v4l-dvb, or jarb1 at uk2 dot net whom has a tar.gz copy of the v4l-dvb the above patch works with (Well works with FC8 2.6.23 anyway)

(With plan B ====DVB-S==== Only; No further configuration is applicable; You may configure the Kaffiene and watch Sat on Linux :))

Single Frontend Diff (sfe)

Now all you need to do is edit /etc/modprobe.conf to have

This option will load the DVB-S/S2 frontend and is the default:
options cx88-dvb frontend=0

This option will load the DVB-T frontend:
options cx88-dvb frontend=1

NOTE: On Debian and Ubuntu Systems you will have to enter /etc/modprobe.d/ and create a custom named file that holds the above mentioned content.

Multiple Frontend Diff (mfe)

No further configuration is applicable.

Enter directory /dev/dvb/adapterX 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-S side of HVR3000.

If the module has not loaded (/sbin/lsmod) try

# modprobe cx88_dvb


Problems

On Ubuntu Hardy with the latest kernel the driver doesn't survive suspend/resume. tested with Mythtv using Plan A (sfe). On Ubuntu Jaunty with the latest kernel trying to use DVB-T:

# dvbscan -frontend 1 -demux 1 /usr/share/dvb-apps/dvb-t/(the new zealand one?) > channels.conf
Unable to query frontend

Testing

Untested by myself (jarb1) is analogue TV

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 frontend. 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 satelite dish.

Sound

This part of the article is original and has not been rewritten since Steve Toths version as I use the onboard sound card.

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 startup script has a work around for systems with more than one HVR3000 card. Please adjust the cardno to start.

/etc/init.d/lircdhvr3000

#!/bin/bash
#
# chkconfig: 5 90 10
# description: Startup for lircd with multiple HVR3000 cards
# This will only funtion in run level 5 (X)... where else is a remote
# useful?
#
. /etc/init.d/functions
RUNAS="root"

#If we have 2 tuner cards with IR set this as 2, otherwise 1
CARDNO=2
RETVAL=0

# depending on parameter -- startup, shutdown, restart 
# of the instance and listener or usage display 
case "$1" in
   start)
       echo -n "Starting HVR3000 IR (lircd) : "
       #Determin the first IR Input card number
       EVENTNO=`cat /proc/bus/input/devices |grep HVR300 -A 4 |grep H: | grep H: -n | grep $CARDNO | grep -o event[01123456789] | grep -o [01234567890]`
       
       RESULT="Using Card : "$EVENTNO       
       echo -n $RESULT
       #Start Lircd with the right event
       daemon /usr/sbin/lircd -H dev/input -d /dev/input/event$EVENTNO
       RETVAL=$?
       echo
       touch /var/lock/subsys/lircd
       exit $RETVAL
       ;;
   stop)
       echo -n "Stopping HVR3000 IR (lircd) : "
       killproc lircd
       RETVAL=$?
       echo
       rm -f /var/lock/subsys/lircd
       exit $RETVAL
       ;;
   reload|restart)
       $0 stop
       $0 start
       exit $RETVAL
       ;;
   *) 
       echo "Usage: $0 start|stop|restart|reload"
       RETVAL=1
       ;;
esac
exit $RETVAL

Then enable the script

# /sbin/chkconfig --add lircdhvr3000
# /sbin/chkconfig --levels 5 lircdhvr3000 on
lircd.conf

A working lircd.conf:

begin remote

  name  Hauppauge_3000
  bits           16
  eps            30
  aeps          100

  one             0     0
  zero            0     0
  pre_data_bits   16
  pre_data       0x1
  post_data_bits  32
  post_data      0x1
  gap          32994
  toggle_bit_mask 0x0

      begin codes
          Power                    0x0074
          Go                       0x0161
          Skip                     0x00A3
          Replay                   0x00A5
          Rewind                   0x00A8
          Forward                  0x00D0
          Play                     0x00CF
          Stop                     0x0080
          Pause                    0x0077
          Record                   0x00A7
          TV                       0x0179
          Videos                   0x0189
          Music                    0x0188
          Pictures                 0x016F
          Guide                    0x016D
          Radio                    0x0181
          Up                       0x0067
          Down                     0x006C
          Left                     0x0069
          Right                    0x006A
          OK                       0x001C
          Back/Exit                0x00AE
          Menu                     0x008B
          Prev.Ch                  0x019C
          Mute                     0x0071
          Vol+                     0x0073
          Vol-                     0x0072
          Channel+                 0x0192
          Channel-                 0x0193
          Red                      0x018E
          Green                    0x018F
          Yellow                   0x0190
          Blue                     0x0191
          Text                     0x0184
          Sub/CC                   0x0172
          1                        0x0002
          2                        0x0003
          3                        0x0004
          4                        0x0005
          5                        0x0006
          6                        0x0007
          7                        0x0008
          8                        0x0009
          9                        0x000A
          0                        0x000B
      end codes

end remote

Multiple Frontends

There does not seem to be a consensus 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 tries to open both adapters at the same time it will fail. ITS HARDWARE not software!

External Links