Tuesday, December 5, 2006

Gadmei UTV 330 on Linux

Recently, I bought a Gadmei UTV 330 USB TV Box. Because I want to know more about video capturing while it is the cheapest USB TV Box I can find.

The basic hardware information is as follow (gotten from V4L wiki: http://www.linuxtv.org/v4lwiki/index.php/Em2820/gadmei_utv_310 and driver log information (dmesg)):

Tuner: TNF 5323
Decoder: Philip SAA7113
USB bridge: Empia em2860

Thanks the great work of V4L guys, the card almost works out of box. It can be recognized correctly under Linux and accept NTSC video input. But the TV broadcast standard used in my country is PAL, so I added the PAL standard to card configuration in driver, and it works for PAL video immediately. The data driven design makes adding new card support so easy.

The sound and IR doesn't work out of box, and Gadmei corporation doesn't release hardware specification, so the work method to add sound and IR support is to do USB snooping under Windows.

After reviewing the USB standard and studying the source code of existing driver, adding sound and IR support is a fairly easy work.

The sound control is through register 0x08 of em2860, the effect of different value is as follow:

0xfc: switch to line in (composite video or svideo)
0xfd: switch to tuner
0xfe: turn off sound

The IR is turn on through writing 0x07 to register 0x0f. The key press and release are gotten through pulling register 0x45 periodically. The only remaining thing is a correct key map.

The maintainer of em28xx driver is Markus Rechberger. It is very kind of him to review and revise my patch.

Many USB TV Box is based on Empia em28xx series chip. The em28xx driver information can be found on V4L wiki: http://www.linuxtv.org/v4lwiki/index.php/Em2880.