Watching TV on the XO 1.5 with a USB TV Tuner

A while ago, I got a crazy cheap ATI TV Wonder HD 600 USB TV Tuner from Woot for $20.  They’re still on Amazon for almost $50.  The original XO doesn’t even come close to having the horsepower to use it, but the XO 1.5 does.

Now why in the world would you want to watch TV on the XO?  Say the power goes out as a hurricane blows through, so your internet is down.  And you can’t find the batteries for your radio!  Well, get out your XO and watch your local weatherman freak out.  Or if a thunderstorm knocks out the power in the middle of the big football game, you’re not completely SOL.


Of course, you have to compile modules into the kernel.  I tried with 2.6.31 and it didn’t work, but a bit of research later I found out that it should work with later kernels.  Luckily you can get 2.6.35 from the git repository now.

git clone git://dev.laptop.org/olpc-2.6
cd olpc-2.6
git checkout origin/olpc-2.6.35

When I did up the config, I enabled the following modules.  How did I know which modules?  Well, I plugged the USB TV Tuner into my desktop and did lsmod to see what it was using.  Once I figured that out, I used xconfig, as it’s very easy to search and browse around.

Search for “dvb”
Enable “DVB For Linux” and “Support for various USB DVB devices”

Search for “em28xx” and enable:
Empia EM28xx USB video capture support
Empia EM29xx ALSA audio module
DVB/ATSC Support for em28xx based TV cards
Search for “2028” and enable “XCeive xc2028/xc3028 tuners”
Search for “5150” and enable “Texas Instruments TVP5150 video decoder”
Make sure “Video for Linux” is enabled as a module

Compile and install the kernel like usual.  You’ll also need the firmware linked from this page:

http://linuxtv.org/wiki/index.php/ATI/AMD_TV_Wonder_HD_600_USB

cd /lib/firmware
wget http://steventoth.net/linux/hvr1400/xc3028L-v36.fw

I’m using the mplayer I compiled for the XO 1.5 beforehand.  The only other dependency is:

yum install dvb-apps

So you’ve got all that and have booted into your custom 2.6.35 kernel.  If the XO 1.5 stalls booting, power it off, then power it back on while holding down the checkmark button.

Here’s what lsmod should give you when you plug in the TV tuner:

[olpc@192 ~]$ lsmod
Module                  Size  Used by
em28xx_dvb              4980  0
tda10023                5551  1 em28xx_dvb
zl10353                 5769  1 em28xx_dvb
lgdt330x                6534  1 em28xx_dvb
dvb_core               73123  2 em28xx_dvb,lgdt330x
em28xx_alsa             5487  0
tuner                  14221  1
tuner_xc2028           15854  2 em28xx_dvb,tuner
tvp5150                13279  1
em28xx                 72432  2 em28xx_dvb,em28xx_alsa
videobuf_vmalloc        3448  1 em28xx
tveeprom                9825  1 em28xx
fuse                   55004  2
xt_tcpudp               1903  3
iptable_filter          1040  1
ip_tables               7748  1 iptable_filter
x_tables               11658  3 xt_tcpudp,iptable_filter,ip_tables
uinput                  5920  1
via_camera             12914  0
v4l2_common            11909  4 tuner,tvp5150,em28xx,via_camera
videodev               34750  5 tuner,tvp5150,em28xx,via_camera,v4l2_common
v4l1_compat            12454  1 videodev
videobuf_dma_sg         6811  1 via_camera
videobuf_core          11770  4 em28xx,videobuf_vmalloc,via_camera,videobuf_dma_sg
mousedev                8370  0
psmouse                21485  0
serio_raw               3788  0
libertas_sdio           7341  0
libertas               70143  1 libertas_sdio
cfg80211              116798  1 libertas

And here are the device nodes it creates:

[olpc@192 ~]$ ls /dev/dvb/adapter0/
demux0  dvr0  frontend0  net0

Before you can watch TV, you’ll need to create your channel list.  This is for US broadcast stations.  Make sure to do this as the olpc user.

scandvb /usr/share/dvb-apps/atsc/us-NTSC-center-frequencies-8VSB > /home/olpc/channels.conf

You’ll get a bunch of “tuning failed!!” messages as it goes through all the frequencies.  This will also take several minutes.  Hopefully you’ll be able to pick up some channels.

[olpc@192 ~]$ cat channels.conf
WVTMDT:213000000:8VSB:49:52:3
WVTMRTV:213000000:8VSB:65:68:4
WTTO-CW:557000000:8VSB:49:52:3
WIAT-HD:569000000:8VSB:49:52:1
WIAT-DT:569000000:8VSB:65:68:2
WIAT WX:569000000:8VSB:81:84:3
WABM-HD:605000000:8VSB:49:52:3
WBRC:689000000:8VSB:49:52:3

Not too bad!  But I live at the base of Red Mountain where most of the area’s transmitters are located.  I took this picture from my backyard.

tv_transmitters

I’ve already set up my /home/olpc/.mplayer/config

[olpc@192 ~]$ cat /home/olpc/.mplayer/config
[default]
vo=sdl
ao=alsa
framedrop=1
lavdopts=skiploopfilter=all:fast=1 #DVD playback crashes with this

I copy channels.conf into /home/olpc/.mplayer so mplayer can see it.  I’m ready to watch TV!

mplayer -cache 8192 dvb://WBRC

Oh, look, here’s our crazy local weatherman wearing a ridiculous bow tie.

xotv
Since WBRC is the local Fox affiliate, I can change its line in channels.conf to

FOX:689000000:8VSB:49:52:3

…so I don’t have to remember the station call letters:

mplayer -cache 8192 dvb://FOX

This will use almost all of the XO 1.5’s CPU, so don’t plan on doing anything else while you’re watching TV.  And while playback is decent enough, it’s still going to be kinda jerky at times.

A couple of the HD channels here don’t want to play at the correct aspect ratio.  I started them up like this:

mplayer -cache 8192 -monitoraspect 3:4 dvb://CBS

Then maximized and restored the mplayer window to make the stream look pretty much OK.  You might have to drag the window down a bit as well.

If you want to take screenshots of the TV broadcast, add this to the mplayer command and you can hit “s” to take a screenshot to the current working directory.

-vf screenshot

Here’s a screenshot of our local Labor Day weekend forecast.  Apparently we’re supposed to “eat outside” on Saturday.  I’ll see if I can’t have lunch out on the porch, then.

eat_outside
Noted Issues:

Audio level is very low.  Run alsamixer as root (!?!) to max it up.

The camera doesn’t work, as the TV tuner takes over /dev/video0  Not sure if it’s due to the 2.6.35 kernel or compiling the TV tuner support.

Switching between Sugar and Gnome gives the message:
/bin/sh:  /sys/devices/platform/dcon/freeze: no such file or directory
… And there’s no dcon directory
Hit enter to get to a console, then “halt -p” and boot back up into Sugar or Gnome with the power and checkmark buttons.

Leave a Reply