Monday, August 04, 2008

Hauppauge WinTV-HVR900 on Mandriva Linux 2008.1

On the second attempt to get my HVR900 working with Mandriva 2008.1, I’ve had success, and can now watch Freeview HD*, terrestrial on my laptop.

I have had success after some help from Steven Ellis, who knows a lot about these things, and has done a lot of the hard work of getting Freeview HD, for Linux in NZ working. The steps for Mandriva 2008.1 is actually a lot easier than the instructions for Ubuntu, as it didn’t require anything very fancy to be done with the kernel, I was able to compile the HVR900 drivers (em28xx-new) against the Mandriva laptop kernel, after downloading kernel-source-2.6.24.5-2mnb-1-1mnb1 rpm and creating a symlink in /lib/modules/2.6.24.5-laptop-2mnb to the source.

The only tricky bit was extracting the correct firmware, which required me to install a different kernel source, purely to get a perl script out of it, as it was not in the default Mandriva kernel source, although will be in future versions by the looks of things.

Steps taken

  1. Install latest tmb source: urpmi kernel-tmb-source-latest-2.6.24.7-4mdv2008.1. This includes /usr/src/2.6.24.7-tmb-4mdv/Documentation/video4linux/extract_xc3028.pl which is needed.
  2. Extract the firmware, following instructions from: http://www.linuxtv.org/wiki/index.php/Xceive_XC3028/XC2028
    1. wget http://www.steventoth.net/linux/xc5000/HVR-12×0-14×0-17×0_1_25_25271_WHQL.zip
    2. unzip -j HVR-12×0-14×0-17×0_1_25_25271_WHQL.zip Driver85/hcw85bda.sys
    3. perl /usr/src/2.6.24.7-tmb-4mdv/Documentation/video4linux/extract_xc3028.pl
    4. cp xc3028-v27.fw /lib/firmware
  3. Download kernel source: urpmi kernel-source-latest-2.6.24.5-2mnb1
  4. Create a link: /lib/modules/2.6.24.5-laptop-2mnb/source -> /usr/src/linux-2.6.24.5-2mnb/
  5. Download driver source: hg clone http://mcentral.de/hg/~mrec/em28xx-new (urpmi mercurial first)
  6. Compile with ./build.sh in em28xx-new. Add yourself to the video group.
  7. Download and compile mplayer svn: (http://www.mythtv.co.nz/mythtv/digital-tv/dtt-debugging/ step 1). I recommend installing it in /usr/local/bin, so you can continue to use your normal mplayer.
  8. download NZ channels file, http://www.mythtv.co.nz/mythtv/digital-tv/dtt-debugging/dtt/channels.conf
  9. Edit channels file.  TV ONE in this file is no longer right.  It needs the audio to be changed from 401 to 300.  (second to last field).
  10. find good reception = watch TV.
  11. add some nice icons to launch mplayer.

The mplayer command I use to play tv is:

/usr/local/bin/mplayer -lavdopts fast:threads=2 -vf pp=fd -mc 2 -framedrop  -fs dvb://"TV ONE"

Screenshots.. (showing off!)

TV one, paused for screenshot

TV one, with compiz desktop rotation

Startup Icons

Notes

1080i still does not work well, sometimes not opening at all before mplayer crashes, sometimes opening and playing for a few seconds before crashing or looking bad. I am hoping that if I stick with mplayer svn, soon this issue will be fixed.

Recording with mplayer is quite easy.. I use the following command.

/usr/local/bin/mplayer -dumpstream -dumpfile tv1.ts dvb://"TV ONE"

Threading

I’ve noticed that even when I tell mplayer to use threads, I seem to only get load on 1 CPU at a time, it keeps jumping between cpu’s, but never do I get both CPU’s at 100%, only about 50%. I think maybe mplayer is not running on multiple threads, even with the -lavdopts fast:threads=2 option. I’ve tried -lavdopts fast:threads=4 and it seems a little better, but still does not really use both cpu’s 100%

Resources

http://www.mythtv.co.nz/mythtv/digital-tv/dtt-debugging/ - excellent information on getting this going

http://www.mythtv.co.nz/mythtv/digital-tv/ - good NZ specific information

http://www.linuxtv.org/wiki/index.php/Hauppauge_WinTV-HVR-900 - HVR-900 information

Thanks to Steven Ellis for his excellent documentation.

Hardware details

I have been testing this on a dual core dell inspiron 9400 laptop with a GeForce Go 7900 GS, 256MB video card, nvidia driver version 169.12. The operating system is Mandriva 2008.1 64 bit, with Compiz fusion and KDE running.

The HVR900 I have shows up as:

Bus 001 Device 003: ID 2040:6502 Hauppauge
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               2.00
bDeviceClass            0 (Defined at Interface level)
bDeviceSubClass         0
bDeviceProtocol         0
bMaxPacketSize0        64
idVendor           0x2040 Hauppauge
idProduct          0x6502
bcdDevice            1.10
iManufacturer           0
iProduct                1 WinTV HVR-900

– CUT –

Dmesg:

usb 1-6: new high speed USB device using ehci_hcd and address 3
usb 1-6: configuration #1 chosen from 1 choice
Linux video capture interface: v2.00
em28xx v4l2 driver version 0.0.1 loaded
em28xx new video device (2040:6502): interface 0, class 255
em28xx: device is attached to a USB 2.0 bus
em28xx #0: Alternate settings: 8
em28xx #0: Alternate setting 0, max size= 0
em28xx #0: Alternate setting 1, max size= 0
em28xx #0: Alternate setting 2, max size= 1448
em28xx #0: Alternate setting 3, max size= 2048
em28xx #0: Alternate setting 4, max size= 2304
em28xx #0: Alternate setting 5, max size= 2580
em28xx #0: Alternate setting 6, max size= 2892
em28xx #0: Alternate setting 7, max size= 3072
attach_inform: tvp5150 detected.
tvp5150 4-005c: tvp5150am1 detected.
successfully attached tuner
em28xx #0: V4L2 VBI device registered as /dev/vbi0
em28xx #0: V4L2 device registered as /dev/video0
input: em2880/em2870 remote control as /class/input/input9
em28xx-input.c: remote control handler attached
em28xx #0: Found Hauppauge WinTV HVR (B2C0)
usbcore: registered new interface driver em28xx
em28xx-audio.c: probing for em28x1 non standard usbaudio
em28xx-audio.c: Copyright (C) 2006 Markus Rechberger
Em28xx: Initialized (Em28xx Audio Extension) extension
tvp5150 4-005c: tvp5150am1 detected.

* 576i and 720p work, 1080i still has issues.

1 comment:

Unknown said...

Instead of steps 3 and 4, you should have done:

urpmi kernel-devel-latest

kernel-source is for building your own kernel, kernel-devel is for building drivers for an existing kernel.