A little while ago our VCR broke and I decided that I might try out this new PVR craze. I have an old Pentium III 550MHz with 256MB RAM running Gentoo and it has been functioning as a personal webserver for the last few years.
I’ve taken some notes here so that I can remember what I did and also to add any gotchas that I came across on my particular system.
The first thing I needed to do was get the PC on the wireless LAN so that I could hide it behind the TV and not have a blue cable running all over the house. I had a Linksys DWL-122 USB wireless adapter handy. With a little googling I discovered it is a prism2 chipset which means it needs the linux-wlan-ng drivers. I followed this guide for gentoo and got the drivers going. Getting the connection to come up at boot was not straight forward. I added the prism2_usb to /etc/modules.autoload/kernel-2.6 for starters. I added the gateway and IP address settings to /etc/conf.d/net. That was easy. I tried a few times to get the init script to work but gave up and instead copied the net.eth0 init script to net.wlan0 and modified it so that the iface_start function looks like this:
iface_start() {
modprobe prism2_usb prism2_doreset=1
wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable
wlanctl-ng wlan0 lnxreq_ifstate ifstate=enable
wlanctl-ng wlan0 lnxreq_autojoin ssid="MySSID"
authtype=opensystem
Those commands should hook up the wireless stuff before the network configuration gets going. The first command runs twice because sometimes it fails. I also find that on the occasional reboot, the USB device gets in a weird state and won’t come good (even with reboots) until I unplug it. It was a bit of a time waster because I was booting new kernels at the time and thought that the new settings had created a conflict.
I chose the Hauppauge PVR 350 because it has onboard mpeg2 encoding and decoding which I thought would help my old CPU to cope. The Pentium III plays DivX ok but sometimes gets choppy. I also bought a big HD (Seagate IDE 320GB) as I was running out of room. Once I had those installed, I found this guide for MythTV and Gentoo which I followed closely with a few excursions off the side as documented below.
When configuring the kernel I also needed to setup the IVTV drivers. I followed this guide. The IVTV drivers require a whole bunch of stuff to be turned on in the kernel so that they work. I use ‘make menuconfig’ and it’s not always obvious which menu items the kernel defines map to but you can check them by choosing the ‘help’ button in menuconfig.
In addition to the ones in the MythTV guide, I chose the following options:
Multimedia devices --->
<M> Video For Linux
[ ] Enable Video For Linux API 1 (DEPRECATED)
[*] Enable Video For Linux API 1 compatible Layer
Video Capture Adapters --->
<M> Conexant 2388x (bt878 successor) support
Encoders/decoders and other helper chips --->
<M> Micronas MSP34xx audio decoders
<M> Wolfson Microelectronics WM8775 audio ADC with input mixer
<M> Philips SAA7113/4/5 video decoders
<M> Conexant CX2584x audio/video decoders
<M> Conexant CX2341x MPEG encoders
<M> Philips SAA7127/9 digital video encoders
Graphics support --->
<*> Support for frame buffer devices
[*] VESA VGA graphics support
<*> Trident support
For a window manager, I already had TWM compiled but I’m not sure this is the best choice. The title bar doesn’t disappear when MythTV is running and I get weirdness when using the IVTV mpeg2 output encoding which I suspect is due to TWM.
The lircd setup went smoothly however, I found that the second part where you map remote control buttons to MythTV didn’t work. I chose to use a ~/.mythtv/lircrc file but the one I downloaded only mapped a few buttons. My remote is the grey and black type and it has seperate channel buttons to the arrow buttons. Here is my lircrc file with better mappings.
The cool thing about the IR receiver is that it’s on a wire so you can hide the computer and just have the IR receiver poking out front somewhere. It is quite small and black.
For XMLTV I used tv_grab_au_reg which is a xmltv grabber for Australia and signed up to the OzTiVo wiki which is a requirement for dowloading the data. There are instructions on the tv_grab_au_reg page to get it going with MythTV. I found that I had to add all my channels to the .xmltv config file like this:
<channel display="ABC" tvguide="ABC-Qld"/>
<channel display="7" tvguide="Seven-Bris"/>
<channel display="NINE" tvguide="Nine-Qld"/>
<channel display="Ten" tvguide="Ten-Qld"/>
<channel display="SBS" tvguide="SBS-Qld"/>
<channel display="Briz 31" tvguide="BRIZ"/>
Initially when I added the channels to MythTV I did an autoscan. I had to do it a few times using the back button to get all the channels. Doubling up here didn’t seem to matter. However when I went to mythfilldatabase, it added new channels from the XMLTV file into MythTV. To get around this, I deleted all my channels, did the scan again and then edited each one so that it had the correct callsign and XMLTVID (the callsigns are ABC,SEVEN,NINE,TEN,SBS and BRI31). That way when I ran mythfilldatabase it didn’t add new channels but did the right thing. I still have database entries for programs that don’t link back to channels since I deleted the channels (which means programs are listed twice on some screens) but I expect this will go away once I move past that data.
For TV Output, I followed the instructions for PAL IVTV on Gentoo. These were pretty spot on but failed to mention that your need to set TV in your ServerLayout in xorg.conf and also modprobe the ivtv-fb module. As soon as you modprobe that module, the output of console will go to TV out of the PVR card which results in a helpful blank looking screen on your monitor and may cause a bit of panic. Anyway, once you modprobe that, the /proc/fb thing starts working. I added ivtv-fb to /etc/modules.autoload/kernel-2.6 too.
Now I am at the stage of learning to use MythTV. I’ve already recorded some stuff and watched a bit of teev. It is all pretty awesome. I’m still not 100% on the TV out thing – I had to make a setting to the offset so I can see one edge of the image. I have no trouble playing back recordings but the video can get very choppy when I’m watching live TV at times. I am going to try and get the whole thing going in framebuffer mode without X and see if I can get the onboard mpeg2 output decoding going too. That should give better performance. If I get around to it, I’ll post some more info about it on this blog.
UPDATE: See some photos here. I have installed a heap of myth plugins. They are pretty straightforward. Mythweather and mythnews didn’t do much. Mythmusic and mythgallery work pretty well – mythgallery is not so good on an iPhoto gallery as iPhoto tucks everything into little subdirectories everywhere.
[tags]gentoo, hauppauge, lirc, mythtv, pvr, pvr 350, tv, tv out, tv_grab_au, xmltv[/tags]
Linux