I’ve made a lot of progress on the MythTV box on the last few days.
Firstly, I didn’t trust the SCART to S-Video/2 x RCA cable that I’d bought, suspecting that it may be wired to have SCART be the input, not the output. So, I went out and bought a switchable input/output SCART connector, along with an S-Video cable and a double RCA jack lead. Using this, I was able to conjur up a black-and-white image from our digital set-top box on /dev/video1, our second PVR-350 TV card.
Interestingly, the ivtv driver needed its input set to 2, not 1 (as documented), to produce colour S-Video output. Perhaps 1 is for NTSC, rather than PAL, but who knows? Most of this stuff assumes NTSC and other American details, so I’ve often found myself having to go through a few extra hoops. Anyway, the cable box now gives an image on the MythTV box, so that’s progress.
For the last couple of days, I’ve been beating my head against the wall, trying to get to the next stage, which is to have the MythTV box be able to change the channel on the digital set-top box. Getting this to work is a nightmare.
The basic description of what is needed for this is simple: connect an IR blaster to the MythTV box and have it act like an oversized remote-control to the set-top box. The reality, as is so often the case with Linux, is that there’s a lot more to it than this.
The IR blaster was purchased months ago from a bloke in the US, using PayPal. It connects to the RS232 serial port.
Now, the IR blaster needs to be driven using lirc, but an instance of that is already running to handle input from the PVR-350’s remote-control. lirc isn’t teriibly sophisticated, so multiple instances of the daemon, lircd, would conflict with each other. So, I had to produce a modified build of lirc that would handle talking to the set-top box.
Ha! Easier said than done. Kernel sources were required for this, so I downloaded the Fedora source RPM of those and dropped them on the box. However, compiling lirc against these gave module address mapping conflicts when I tried to insert lirc’s modules into the running kernel. In the end, I had to partially build a Fedora kernel to reproduce the module map that Fedora was actually using and thus expecting.
That was more work than it sounds, because I don’t use custom kernels any more (I just don’t need them any more and compiling them for the sake of it is something I’m too old, fat and lazy for these days).
Anyway, finally I had a second instance of lirc that would use different device nodes than the original. Next, I set about testing the software, which eventually worked and appeared able to drive the IR blaster.
The next problem was that there is no existing lirc remote-control config for the Thomson DCI-52UPC, which is the piece-of-shit set-top box provided by that wayward gang of goons known as UPC. This meant I needed to create one.
Creating such a config entails using the device’s remote-control to teach lirc abput the required IR codes to drive the unit. Sounds easy, I know.
Well, the first problem was that my PVR-350’s IR unit expects only its accompanying remote, which uses the RC5 protocol. UPC’s set-top remote-control clearly doesn’t, so I can’t use the PVR-350 as a receiver for learning the codes.
Now, the VFD display on the Origen AE case that houses the MythTV box also happens to have an IR unit, so I downloaded some software from IRTrans to make that work. Rather surprisingly, I was able to get this IR unit to the stage that it would recognise keypresses from the DCI-52UPC’s remote-control, which was pleasing.
Unfortunately, the software used to talk to this IR unit is not lirc, so although it was listening to the keypresses and recording them, it was doing so using a format that lirc can’t use to relay to the set-top box.
So, I went out and purchased another IR receiver this afternoon, a Microsoft MCE unit. Although it’s sold as a Microsoft unit, the kernel reports it as a Philips eHome Infrared Transceiver. It’s a USB device and was recognised as soon as I plugged it in.
Within a few minutes, the system was configured to start recording keystrokes from the UPC remote-control, using lirc’s irrecord utility. A few minutes after that, I had an lircd.conf file containing raw IR codes for the set-top box. Optimistically, I thought I was now in the home straight.
Well, I fired up the new instance of lircd and told it to send some numeric keystrokes to the UPC box. The IR blaster’s visible LED flickered red with each keystroke, but the UPC box just sat there, ignoring whatever the blaster was sending.
I’ve spent the evening reading about lirc and infrared protocols, but I have to admit to being stumped at this stage of the game. I don’t know what to try next at this point. How hard can it be to send IR signals over a small transmitter and have those interpreted by a set-top box? Too hard for me, clearly.
But it’s not all doom and gloom. Yesterday, I finally figured out how to make the VFD display on the case work. It connects internally over USB, but it needs to be driven as a serial device, so first of all you need the ftdi_sio kernel module to do the conversion.
Then, you run irserver, which can be downloaded from IRTrans. It’s a low level daemon that accepts commands over TCP and passes them on to the VFD unit.
MythTV, on the other hand, knows nothing of such things and expects to be able to use LCDproc as its API. Happily, the people at IRTrans have a patched version of LCDproc available for download. Once that is installed, you can fire up LCDd, which then talks to irserver, which, with a little bit of help from the ftdi_sio module, drives the VFD unit.
Simple, as only Linux can be. Anyway, the result is nice: channel and programme information is now displayed on the case’s VFD unit, which lends the box a slick and professional look.
I’ve also replaced XMLTV’s tv_grab_nl with a Python version I found on the Web. This one is much better, as it grabs channel icons and reliably downloads programme descriptions and genre information. The old one wasn’t
robust and couldn’t deal with the contradictory data supplied by tvgids.nl (e.g. overlapping start and finish times).
Finally, I’ve put in a cable amplfier/signal splitter unit, so that we can have more inputs to the MythTV box. The idea is to add a third PVR-350 tuner card at a later date. At that point, all of the machine’s PCI slots will be in use.
There are sundry other niggling little problems with the box, ranging from playback freezes (which can be remedied with a push of the skip button) to kernel oopses. All in all, the system has fantastic potential and is an endless source of hacking pleasure and frustration, but it’s definitely not production quality material at the moment.
I really do have to get the bloody thing to change the channel on the digital set-top box, or it will have limited utility. If I can just get that part to work, I’ll be most of the way there and can then sit back, breathe out and relax a little again.
The whole experience gives me a huge amount of respect for TiVo. How they can put together a reliable box for $200 is beyond me.