Saturday, February 10, 2007

The Retelling of a Myth: Happy Hauppauge, Very VIA

The Hauppauge PVR-150 kit is fairly nice, assuming you actually get one in the box. It comes with a remote that works with lirc, and the on-board MPEG2 encoding means you can barf CATV streams directly into memory without tying up the CPU. It also has S-Video and composite inputs, although I haven't tried them.

After I put in the PCI card I expected to just run through the YaST2 TV card module and be done with it - it marches you through configuring TV cards fairly effectively. Much to my chagrin it didn't work however - the hotplug manager needed firmware downloaded and installed before it could load the device. There were two separate files that needed to be installed - one for the MPEG2 video stream, one for audio.

Once the firmware was installed I moved on to the infrared remote control. For some odd reason, the YaST2 screen that configures TV cards wouldn't let me select the correct driver for the PVR-150... instead it gave me two (what appeared to be) infrared keyboard drivers. Ummm.... no.

In fact, it appears that the correct version of the lirc driver for the new "gray / black" Happauge remotes isn't included with openSUSE 10.2. Instead, I had to jump on lirc's download page and obtain the source distro myself. I have to give a hand to the lirc maintainers however - they came up with a fantastic means of building from source. When building from source you first enter a menu screen that allows you to select the appropriate card & ir type. This pipes out a script that runs ./configure with the appropriate arguments, which you can then modify if you need (i.e. if you need to change the --prefix). The Makefile correctly builds & installs the kernel modules and userspace tools, and does so with minimal fuss or manual intervention. It even placed the kernel modules in a different location than SuSE's lirc modules, so it didn't run a chance of clobbering existing drivers. Of course, I needed to remove SuSE's lirc and lirc kernel packages to ensure the correct version(s) were invoked... but that was small potatoes. Lirc was probably one of the easiest from-source builds I've done in a long time.

After the modules were installed I had to change SuSE's sysconfig for lirc. I modified /etc/sysconfig/lirc to include LIRCD_DEVICE="/dev/lirc" and LIRC_MODULE="lirc_i2c". Another nicety of the source distribution was a universal Hauppauge configuration file - remotes/hauppauge/lircd.conf.hauppauge appears to support all the different Hauppauge remotes currently in the wild, and all in one file. I just dropped it over into /etc/lircd.conf and restarted the lirc daemon. The /dev/lirc device spawned, and all was good.

To map the actual keys I just used irw to tell me what the individual keys I pressed corresponded to. As I did that, I created a spreadsheet of remote buttons, the lirc code and the MythTV keyboard command. After I had exhausted all the MythTV/button permutations, I went through and created a .lircrc file. Each button press was defined as:

# Mute
begin
prog = mythtv
button = MUTE
repeat = 3
config = |
end

It took a while to define each key - to save time one can search for other people's posted configs as reference and adapt as necessary. After the file was set, I created a symbolic link from .lircrc to .mythtv/lircrc so MythTV's frontend could appropriately parse it.

Finally we have the hardware built, case constructed, OS installed, capture card configured and IR remote sending events. It may seem like a lot of effort, but think about it this way: we, lowly consumers, are creating a digital appliance out of naught but thin air. The very fact that we have such a flexible yet coherent construct in the first place is pretty remarkable. We've been able to pull parts off the shelf and build the foundations of a DVR without writing a single line of code!

Now on to actually orchestrating our products and convincing them to cooperatively put our favorite TV shows in its little robot brain...

No comments:

Post a Comment