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.
I know you like your DIY projects, but I can’t help but wonder if an Elgato EyeTV 610 wouldn’t Just Work(tm). Too bad UPC won’t give you a second box/card, though; it would be nice to watch one thing while recording another.
In the UK we are quite lucky with a wide choice of Freeview DVRs and Sky+. If only these privatised Dutch cable companies were actually in competition with each other over customers, rather than “who gives the greatest kickback to the city”.
The reason Tivo can do it is simply because they select the right components, get full documentation for them and have some smart people integrating them, all working together in the same room.
Sometimes commodity hardware and combining a wide variety of otherwise unrelated OSS projects isn’t the best solution…
The Elgato wouldn’t just work, because it needs to be connected to a Mac, not a TV. This is not a solution for the living-room, as far as I’m concerned.
I completely agree with you about the sad state of cable TV operations in The Netherlands. The range of channels available is very good, but the hardware is complete rubbish. UPC simply doesn’t care about its customers and it certainly doesn’t give a fuck about integration with non-UPC hardware.
I understand TiVo’s business model, but I’m still astonished that they can assemble their boxes for $200. That price scarely covers the hardware, never mind the assembly, software development, marketing costs and other expenses.
I mean, just the Origen AE X11 case that houses my MythTV system cost way more than a fully operational TiVo unit. Granted, the X11 is a nice case with a VFD unit, but still.
As for your last claim, I must reluctantly concur: building your own system from commodity hardware and various bits and pieces of open/free software isn’t always the best choice.
Luckily, that didn’t come as a nasty surprise to me, as I’ve shared that opinion for many years. However, I do still believe that it very, very frequently is the best solution available.
Take my case, for example. I have few real choices in The Netherlands. Basically, I can choose between a braindead DVR with a dismal UI and a severely lacking EPG,an MCE PC or an open-source solution. The last of those options pretty much equates with MythTV these days.
I’ve got the braindead DVR already, which was only ever intended as a stopgap until I could get MythTV up and running. An MCE box was out of the question. The off-the-shelf solutions are poorly spec’ed to keep the price competitive. I want lots of storage, for example, so that meant building my own system.
If I have to roll my own, I’m not going to use anything as inflexible as Windows, so I chose the only viable option: MythTV on Linux.
Picture quality and the hassle getting the system to work with the set-top box are my biggest gripes. Most of the problems with the set-up are minor and surmountable, although I’m sad to have to admit that I’m pretty much stuck with the shite picture quality.
Anyway, if TiVo were available over here, I’d buy it again in an instant. I like to hack on projects like this, but it’s only TV when all’s said and done. It should just work.
Well, A Mac Mini with Elgato box would probably work quite well in the living room and probably give superb image quality. (Digital cable in, DVI out to the tele)
But if Macs aren’t your cup of tea, well, then they are not. 🙂
Don’t forget the insides of Tivos share a lot with the hundreds of millions set-top boxes out there. Plus they don’t buy an expensive Intel CPU but use low cost ASICs for MPEG decoder and a 16-bit 66MHz CPU as brain. All that stuff is seriously cheap these days. And doesn’t Tivo cost another $10/month for the subscription? I wouldn’t be surprised that most people keep paying for another year or two after, this means Tivo doesn’t need to be able to make the box for $199.
That said: the Freeview DVRs here retail from £130, though the better ones (comperable to Tivos) are over £200. If you have it all assembled by low-paid chinese, anything seems to be possible…
I don’t know much about the internals of the Mini. Can you buy them with as much disc space as you want?
And how many tuners does the Elgato have? If more than one, does it have multiple inputs or does it accept a single coaxial input that it then internally splits into two?
The TiVo I had was a DirecTiVo box, so it didn’t even need an MPEG decoder. It streamed MPEG2 straight from the satellite feed to disc and then played it back. Simple.
The Mini is pretty limitted; it only has one 2.5″ SATA disk, that is why the box is so small. But both Iomega and lacie make external disks that fit very neatly underneath. The other option is to have your storage remotely over ethernet. (which would be my prefered option in any case as it takes away the noise of spinning disks)
I don’t know much about the Elgato (or Miglia, the other brand) so I don’t know if it is possible to hook up more than one box; they certainly only have one tuner per box.
DirecTiVo and other integrated solution are by far the best option. It’s about time the goverment stepped in and forced cable companies to use an open standard, with the only propriatary part being the smart card they provide.
Oh well, one can always dream…
I’d love to have the MythTV box be a discless frontend, with a huge RAIDed backend fileserver in the cellar, connected over GigE. That’s some time away, however.
For one thing, I have no Ethernet jack at all near the TV at the moment, which is why the thing is currently connected over a hopeless 802.11b link: good enough for programme guide updates, but not really for network-booting or streaming video.
Next year, we’ll be building our own home (well, we will be paying someone to do it!) but that is one thing I will sort: lots of connectivity.
I plan to run empty conduit to two corners of every room from one central location so that connecting anything (ethernet, TV, phone, multi-room audio, whatever) anywhere in the house won’t be a problem.
That’s the advantage of a newly built home. Ours is 100 years old and the myopic people who built it didn’t have the common decency to foresee the need for Ethernet, fibre-optics, etc.
Regarding the Origen VFD unit, the IRTrans user manual claims that the irserver can replace lircd so that lircd clients are compatible with the irserver. I’m about to get one of those VFD units(for a different case though) and would be really interested to know whether it really works.
The documentation is a little lacking, though. For example, if you need to run multiple devices, can you do this with irserver?
I have a USB IR receiver and an RS232 IR transmitter and it’s not clear to me that I could replace the IR receiver with the IRTrans unit and use that to drive the IR transmitter.
irserver isn’t updated very often, either, so I’ve decided to use that only to drive the VFD and to use the much better-documented LIRC for the IR work.
The reason the codes don’t work from your transmitter to the settopbox is probably the transmit frequency. I had that problem with my Explorer2000 box until I changed the default frequency in the config file.
(To solve that problem of needing two lircd on your box, I used some guy’s pre-hacked sources for lirc that renamed everything from ‘lirc’ to ‘remote’. Just google for it.)
/dj6
Thanks, dj6. I eventually got the set-top box working with a Motorola config sent to me by someone. I also had to replace the IR blaster to get one with enough power to reliably change the channel.
These days, it’s also possible to control multiple IR devices without having two lirc installations on the box. I now have this working, too.
Can you please share the upc lirc setup? I’m stuck, just like you were….
Thanks, Edwin