More fun with lirc and remote controls

For those of you who were following my MythTV saga from a few posts ago, I am happy to report that as of tonight, all the buttons on my remote control now work from within MythTV. How much work required though really offers some more insight as to how badly broken usability in Linux is.

Originally, I thought I would be able to take advantage of the fact that the kernel knows what remote control ships with the device and is automatically generating input events by default (assuming you remove the cx88-ir driver from the hald blacklist). So for example, when I hit the “Channel Up” button on the remote, a KEY_CHANNELUP input event was being generated. Unfortunately, MythTV doesn’t understand any of these input events that are Linux specific. Myth relies on a table of input events provided by the QT library, which provides a common portability layer (at the cost of only offering the lowest common denominator). Hence, even though my remote control was detected by the kernel, and unique events were being generated for each key, there was no way for MythTV to identify the events.

I could probably make it work if I were willing to extend the MythTV source to know how to handle non-standard events (and I might still do that in the future). If such work were done, MythTV would start to “just work” with all of the remotes that are shipped with tuner products by default.

So I ditched that idea and figured I would go with the lirc approach. When I had tried running “gnome-configure-lirc” previously, it had failed to show my cx88 card in the list. But now that I had removed it from the hald blacklist, now it showed up properly. I selected the cx88 and specified the “Hauppauge silver/black remote” I had kicking around.

I saved the configuration and exited the program, but at that point the lircd service would not start, claiming that it could not load the kernel modules. It turns up the default lircd configuration file specifies two single quotes (”) as the name of the modules to load, and says that loading of the lirc kernel module is required, even though my device uses the inputdev interface. Edit the configuration file to say that no modules need to be loaded, retry, and find that now it’s complaining that it cannot open device profile (”), since the gnome-configure-lirc also doesn’t bother pointing lirc at the remote control configuration I had just created. More edits to the configuration, and now the lircd daemon *finally* starts.

I run the “irw” test utility and start whacking buttons on the remote, and it is showing the correct info for *most* of the buttons. However, several buttons fail to register at all, like the “OK” and “Back/Exit” button, both of which are fairly important. So now I’m running “irrecord”, a handy little command line application for mapping buttons to keys that, from the crappy usability, you would think was written by a twelve-year-old. You’re expected to know the exact names of the input mappings in advance, or else you have to run “irrecord –list-namespace” in a separate window to dump out the list. Oh, and it doesn’t do incremental updates properly so if you run the program twice it proceeds to trash out whatever keys you defined previously (forcing you to output to a temp file and merge the results by hand with a text editor).

It’s worth noting that the remote control profile setup by gnome-configure-lirc *does* have mappings for the buttons in question – they just don’t match what is actually being generated by my remote control for whatever reason.

I get past *that* point and now irw is showing the correct buttons, but MythTV doesn’t work still. It turns up at some point “mythbuntu-lirc-generator” got run, creating a profile based on a different remote control. It’s not quite clear to me what sort of black magic this program does to setup MythTV, but after digging through the frontend logfile it became clear that I needed to run it again.

In total, I spent about 90 minutes fumbling around before I finally got it all to work. There is clearly considerable room for improvement in this process. In fact, one might argue that it’s pretty pathetic how much work was required given it’s an extremely popular card and I couldn’t even get it to work with the stock remote that shipped with it.

At least my fiance can now finally use the MythTV box in my living room without having to know the esoteric commands like how the left and right bracket [] keys on the keyboard control the volume.

15 thoughts on “More fun with lirc and remote controls

  1. And much like me, now that your significant other can use your MythTV box “with ease”, everyone’s happiness quotient goes up 🙂

    When I first built a MythTV box, my wife thought it was the most useless thing ever and a huge waste of money. Wanting to keep her happy (haha), I had bought an Asus Digimatrix since it is small, quiet, and looks more like an AV component than a computer (the ladies are always concerned with aesthetics it seems). Compared to other options, it was quite expensive at the time. Then she learned how to schedule and record shows that SHE cared about and suddenly it was the best investment ever…

    • Zaphod,

      Yeah, being at the point now where you can do all the basic navigation from the remote control will help alot. And as the MythTV box queues up back episodes of “Law and Order” over the next week (her favorite TV show), I think she will come to like the solution.


      • Law and Order is a lot better (in my opinion) than John and Kate plus 8 (thank goodness it has ended) or Days of Our Lives, both of which are what my wife loves to record. Still, at least she doesn’t think it was a waste of time or money now…

  2. I remember my initial plans to have the significant other and roommate use this cheapo keyboard….How dumb I was…

    It is a neat insight into usability:
    The person who does the initial work does everything to make their experience the best it can be. If you follow that person, but stray off and get a different hardware component, you find yourself stuck.

    Problems such as the IR receiver, is why so many folks(me included) just spring the extra $10-15 for a WMCE usb IR. It’ll work well enough and I get to spend less time messing with the configuration of the myth box.

    In a ideal world, I’d rather us(those buying the USB) give one person $7.50 each, instead, and provide an incentive to work on getting those IR chips inside the capture cards working….or instead work on the lirc/mythbuntu-lirc program to work out of box with more stuff.

    Anywho, I’m glad someone who’s got alot more technical know-how is actually delving into these issues and bringing them out of the closet that mythtv user’s are so used to throwing their problems into.

    • Hey Matt,

      Yeah, I was kind of hoping that if I used a popular card, the IR receiver that came with the tuner, and the remote control that came with the tuner, then it might be pretty straightforward.

      In fairness, the IR receiver in the card worked as expected. All of the problems came from userland/lircd/mythtv.

      As my office mate put it in a very flattering way, “If it took *you* three hours, how do they expect mere mortals to *ever* get this stuff to work?”

      If nothing else, my hope is that regular users will see that they are not dumb/crazy for not being able to get these things to work easily.


      • In reference to “If it took *you* three hours, how do they expect mere mortals to *ever* get this stuff to work?” . All I know of you Devin is what I see here on kernellabs, and boy is it a lot. You sure do knock out a ton of work in a small time and it has all been of top quality. Kudos to all that you do

        • Ryan,

          Well, thank you for the compliment. In this case, I think my officemate was just trying to make the point that if it’s this hard for a developer to get it to work (and a developer who actively writes code for the project), he can only imagine how hard it must be for regular users (non-developers) who just want to setup a mythtv box to watch TV with.


  3. Lirc is definitely one of the most problematic packages I’ve encountered in terms of usability, and the one part of my MythTV system that I’ve spent the most time on and has caused me the greatest frustration (because they keep changing parts of it for no apparent reason). Supporting multiple devices requires some weird gyrations, which appears to me could be (easily?) fixed in the configure script. Lirc could use a complete overhaul and probably integration into the kernel input events subsystem so that you could use it with any app, instead of requiring apps to support it explicitly (or using a kludgy hack to blat out keypresses). Apps don’t care what kind of keyboard you’re using; remote control support should be the same way.

  4. Actually, users of the Linux operating system should be thankful for LIRC. LIRC is better than nothing. 😉 IMO, the whole input system of Linux is rather bizarre. However, Linux gets better usability as time progresses, but the process seems a tad slow at times.

    • Hello tpretzel,

      I’m certainly a fan of the notion that “you get what you pay for”. I was just trying to emphasize my surprise that there hasn’t been more outrage by users to see these problems corrected (or enough annoyance by developers such that someone takes up correcting the problem).


      • I expect the outraged users that do speak up get shouted down by the community, given many “members” are doing this work on a volunteer basis. Statements made in frustration can kick pride in the head and that just creates a negative feedback cycle.

        • Hello Caysho,

          Yeah, perhaps “outrage by users” was not the best wording I could have chosen. I’ve been on the receiving end of many users who believed they were somehow entitled to have their hardware work properly and my response, being a volunteer, is typically that “you get what you pay for”. That said I am still a bit surprised that more users haven’t voiced their annoyance/frustration of the situation.

          While you cannot compel a volunteer developer to fix something, in many cases developers who take pride in their work will fix certain things if enough people complain about them.


    • I can appreciate that to a degree.

      There have been situations, either through my own fault or not, where, if it were a Windows box, I’d have to reformat and deal with it.

      With Linux, short of major file corruption, you can recover from any number of misconfiguration or failed installs. Compare that to the sister-in-law’s Vista laptop that had to be reformatted because Window’s NFS managed to corrupt a lock file, causing it never boot into a profile.

      That said, Linux isn’t competing in a vacuum and neither is MythTV. Accepting it as “better than nothing” is an excuse, that, we as power users and programmers, should not be happy with.

  5. I actually like lirc, irexec, irwxevent. Maybe because I have them working, and I think they are reasonably powerful — a few remaining nits making it totally seamless with mplayer,smplayer, myth etc, which I plan on trying to do. But otherwise I like it. Admittedly I have bought MCE remotes for all the boxes (seemed logical since only the recording box had capture cards and was not exposed).

  6. Devin Heitmueller

    Hi SS,

    I have never argued that the lirc tools are not powerful or that they don’t have lots of features. All I would argue is that when they *don’t* work as expected, figuring out what is wrong is a *huge* undertaking that I’m sure many people just give up on.



Leave a Reply