Thursday, August 05, 2010

Hauppauge USB Live 2 & Ubuntu

I'm running Ubuntu and purchased a USB Live 2 stick from Hauppauge to visualize some direct composite video coming from a 5.8Ghz receiver. This video is transmitted from an RC plane to see what's going on up there on a netbook. I'm not flying it FPV for lack of goggles and because I want to keep track of where the plane is. Basically, the intention is to put the family behind the netbook to see what the plane sees and I'll stare at the dot in the distance.

The USB stick arrived yesterday in the mail and after plugging it in, nothing happened. USB devices get recognized by their ID's and as soon as you register a driver for it, the kernel will visit all eligible drivers to see if one wants to step up to communicate with the device. Apparently the support for USB live 2 is not available in the stock distribution of Lucid yet. After searching around I suddenly hit a post made on the 3rd of August (sic!) that support for USB Live 2 was just completed on a development branch in v4l2. So the day before I got the stick development just finished with the first version of the driver.


I managed to install this on both my netbook and general PC. These are a 32-bit Lucid Lynx distribution on a Samsung N210 and a 64-bit installation on a more powerful machine with ATI HD5850 and i7 920. You should make sure that you're not holding back any linux packages, since I got screen corrruptions with kernel 2.6.32-23. The latest version now is 2.6.32-24 and there it worked (or it was something else, who knows?). After the clean install, you need to grab gcc, do an update/upgrade of all packages and make sure the latest kernel headers are present:
> apt-get install gcc
> apt-get install linux-headers-generic ( <-- ensure it's the latest & greatest @ 2.6.32-24 )
Then I used the entire v4l2 source tree available here (at 05-Aug-2010 that is, things may change rapidly here)
> hg clone
> cd polaris4
/polaris4> sudo -s
/polaris4> make

( then edit v4l/.config:
2. change this into:
4. (notice the n instead of m at the end, that's all).
5. This essentially deactivates the build of a problematic module, so if you have a problem there
you can deactivate it.

/polaris4> make
( yes again ).

If all went well:
/polaris4> make install

And then reboot. The reboot will ensure you're not using any old drivers. The rollback procedure for this is to reinstall the linux-image-...version... you were using. That will replace all your modules with the stock Ubuntu Lucid distribution.

Any time you get a new linux-image installed, you have to do another make, make install in this custom directory to overwrite the module files again. Remember that!

As you can tell, after doing this some video-related things may not work properly. For my netbook, I'm only going to use it in the field and some simple stuff. So far things haven't broken, so that should be relatively safe. It looks pretty stable so far.

I've noticed that the image when there's no signal may be plain blue. That is usually the case when the signal hasn't been tuned at all, but in this card you must ensure there's a video signal going into it.

The USB Live2 is a great little gadget with quite good image quality and zero lag on the Linux drivers. In Windows it's possible you get lag up to 3 seconds even, but that's because your driver must be configured to use "GAME" mode (if you're flying or gaming with this that is, otherwise it doesn't matter too much).

In order to visualize things, I now use tvtime (apt-get install tvtime). There's a handy configuration XML file in /etc/tvtime.xml where you can make all the default settings. The coolness about this utility is that you can change a large number of settings without restarting and adjust the image quality, brightness or contrast itself. Great for outdoors flying and getting a bit more out of the display.

The USB Live 2 uses the cx231xx kernel driver.


Anonymous said...

Awesome! thanks for the post; I'll be trying that now.

Anonymous said...


Did you try to use two of this device at the same time in Linux?

Gerard Toonstra said...

No, I only have one.

Anonymous said...

Here is a module config, which excludes (almost) all unnecessary modules:
This reduces the build time to about a minute.

Godwin said...

HI,I am trying and trying. But I am not able to get this to work on my ubuntu. Please see this screenshot here :

I would appreciate any help on this.
Thanks so much

Gerard Toonstra said...

Did you try:

tvtime -d /dev/video1

That's how I start up my tvtime. I also have a webcam. Notice that if my cam is set to PAL, or receiving a PAL signal, tvtime doesn't work.

I do have more success through mencoder and mplayer in that case.

Note that the tvtime configuration should use teh correct standard. Maybe you need to hit Tab once and select the PAL/NTSC standard first.

When tvtime tries to play PAL, I get a black screen and it sort of locks. Looks exactly like what you have there.

Find that out first.

Godwin said...

Thanks Gerard, but how do I make it accept PAL system?
PAL is the standard in India.
I tried mplayer but mplayer isn't even starting for some reason. I'm yet to go deeper to explore mplayer. If you have some tips,please tell me to get this to work.

Gerard Toonstra said...

On Ubuntu Lucid with the old code from the polaris repository, I cannot set tvtime to PAL and get an output that way. I have been able to get PAL output using:

export FILENAME=

mencoder tv:// -tv driver=v4l2:device=/dev/video1:immediatemode=0:outfmt=yv12:norm=pal:width=640:height=480 -nosound -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=8000:vhq:keyint=90 -o >(tee $FILENAME | mplayer -cache 64 -)

This will record something from the device and play it through mplayer.

If you have access to some camera, I highly recommend testing NTSC first and tvtime, that'll show you if it works at all and there's no other issue to resolve. 'tvtime -d /dev/video1' is a basic test I perform when I need to know things are working.

I use this for a GoPro camera only set to NTSC, so always use NTSC. Although setting it to PAL and recording PAL as above also does work for me with an occasional lock-up or driver problem requiring a reboot to work again.

Hope that helps.

Just tried on my Natty system and see the following:

> lsusb
> dmesg

[ 7299.378356] cx231xx #0: can't change interface 2 alt no. to 1 (err=-71)
[ 7299.378359] cx231xx #0: failed to set alternate setting !

This "-71" is what I got consistently. The cx231xx is the chip used within the device.

Can't help you further than this I'm afraid. I posted a Q on the linux driver forum, but never got a reply. That's why I reverted to Lucid and the polaris4 version, where this worked. Maybe the next version of Ubuntu, it will work out of the box?

Godwin said...

Actually,I was trying with Ubuntu 11.04.
But,now I've switched to Ubuntu 10.0.4 LTS to get this thing to work.
Still,I'm facing problems.

2002.386591] cx25840 2-0044: 640x480 is not a valid size!
[ 2002.390705] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.394831] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.398960] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.403079] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.403089] cx25840 2-0044: 640x480 is not a valid size!
[ 2002.407210] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.411329] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.415458] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.419581] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.419589] cx25840 2-0044: 640x480 is not a valid size!
[ 2002.420322] cx231xx #0: cx231xx_stop_stream():: ep_mask = 8
[ 2002.425310] cx231xx #0: cx231xx_initialize_stream_xfer: set video registers
[ 2002.435335] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.537694] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2002.541815] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2007.551547] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2007.555653] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2007.560277] cx231xx #0: UsbInterface::sendCommand, failed with status --71
[ 2007.633934] cx231xx #0: cx231xx_stop_stream():: ep_mask = 8
[ 2007.642041] cx231xx #0: can't change interface 3 alt no. to 0 (err=-71)

Any idea what is actually a valid size?


Godwin said...

I'm actually trying with mplayer now. This is what I'm using :

sudo mplayer -cache 128 -tv driver=v4l2:width=256:height=192:input=1:normid=5:amode=1:device=/dev/video1 tv://

Gerard Toonstra said...

The -71 is a driver problem. I posted something on the v4l media list:

Ubuntu 10.0.04 does not exist, is that 10.04? I've just checked on my setup and it is ubuntu maverick 10.10. I compiled the drivers as per the dheitmuellers instructions that I believe you've found as well. Install those drivers. Then restart. Use an NTSC camera or something first, because that will work with tvtime. It really facilitates finding a signal if you get any. Verify dmesg every time.

sudo is not necessary for the mencoder or mplayer.

Soon as you plug in the stick, you can see in dmesg whether it has recognized correctly, or it still has problems. You shouldn't be getting the -71 problem, as it's hopeless to try anything if you do.

Godwin said...

Thanks Gerard. How did you get past the -71 error finally?

I've managed to find an NTSC camera here. I'm just starting to test. But did you mean that nothing is going to work unless I get past the -71 error?
If you meant that,how do I get over this -71 error?

Thanks so much.

Anonymous said...


I just wanted to ask you if now is the driver perfectly working. People are saying contradicting things on the Web.


Gerard Toonstra said...

No, it's not working for me. I tried on Maverick and Natty, which both are problematic due to API changes in the compilation and such. I have only ever been able to get this to work on Lucid. The current driver in Natty doesn't work for me. I get "-71" errors in the dmesg log.

I use this for recording video in the field and I resorted to the purchase of a DVR (Lawmate EVO 500). This way, I carry less stuff with me, have a minimal 2" screen for inspection and "boot-up and record" in about 10 seconds.

Maybe this USB Live2 will in the future be used again, when the drivers perhaps get better. The stick is working on both windows and lucid, so don't think it's a hardware problem.