LIRC remote and TVHeadend Server

  • About 2 years ago I built a small PVR based on a Raspberry Pi + Libreelec + TVHeadend Server/Client with 2 RTL2832 DVB-T adapters. To control KODI and the TVHeadend client I configured an infrared remote using lirc and a receiver connected to the default GPIO pins.

    Until a few months ago, this configuration worked fantastically well however I then started to get intermittent glitches on the remote control. This became worse after upgrading to Libreelec 8.2.x and so I dropped back to the final 8.0 version. I am currently trying to upgrade the RPi to a 3B+ which requires LE 8.2.5. With two DVB adapters installed, the remote is now completely inoperative. With one adapter installed, it is initially very laggy and then often locks up.

    The problem seems to be independent of whether the adapters are actually receiving a signal or not and the CPU is showing only a few percent. Interestingly, a Montage DVB-S2 adapter does not seem to cause the same effect, although it is hard to tell if it is actually non-existent or just very much less pronounced.

    The basic PVR function seems to be unaffected and it happily records and feeds TV to the 3 other clients in the house but I cannot now use the same remote for this server box.

    Any suggestions?

  • GPIO IR receivers are rather sensitive to interrupt latency and unfortunately USB traffic (such as from DVB adapters) can introduce such latencies. A couple of people had the same issues as you.

    Easiest solution then is to use an USB IR receiver - maybe one of your DVB adapters has an IR receiver built in which you can use, otherwise an MCE USB receiver (eg the "HP" ones available on ebay) is usually a good choice.

    so long,

    Hias

  • Thanks for that. As you say, IR over GPIO must incur quite a large interrupt overhead so there is significant potential for conflict with other devices. It's unfortunate though that recent kernel changes seem to have exacerbated the issue.

    Your point about alternative IR receivers however looks potentially useful. A bit of digging shows that the receiver in the DVB-S unit is indeed being recognised by lirc, and removing the GPIO receiver leaves just one entry in /sys/classes/rc. It now looks like I need to do a bit more work to configure lirc to use this however as I am getting no response with the default configuration. Do you have any pointers for using alternative input devices with lirc under Libreelec?

    DH

  • In general it's best to disable Lirc in LE settings->services and use the more modern "ir-keytable" configuration (which uses the IR support built into the Linux kernel).

    Detailed information about that is in the wiki: Infrared Remotes [LibreELEC.wiki]

    Note that some IR receivers in USB DVB adapters only support a limited set of IR protocols (run "ir-keytable" to find out which they are) which means you may not be able to use every remote - the GPIO IR receiver and MCE USB receivers can support all protocols/remotes and can also be used with Lirc if your remote uses some non-standard protocol.

    Another alternative to IR remotes on RPi is using CEC, i.e. using your TV's remote to control the RPi. If your TV supports that it should work out of the box.

    so long,

    Hias

  • Thanks Hias.

    I found my embedded adapter actually only supports RC5 whereas I have 'standardised' on a Philips BluRay remote using RC6. In any case, after following your linked instructions for LE9 I found that changing the RPi overlay to dtoverlay=gpio-ir allowed the GPIO receiver to perform quite acceptably again. So for the moment I will stick with that solution.

    Thanks again

    DickH

  • Ah, very interesting - I had expected that lirc-rpi and gpio-ir performance would be about the same.

    Out of curiosity: are you still using Lirc with gpio-ir or have you switched to ir-keytable/in-kernel decoding?

    so long,

    Hias

  • Thanks a lot for the feedback!

    I'm still a bit puzzled why gpio-ir works better, but then I'm glad it does and I hope it stays this way.

    so long,

    Hias

  • Just to round off this topic. After running for a day or two with the mixed configuration I noticed that there was still a problem with the remote - after leaving the box for some hours, it would take maybe 20 presses of the remote before it became responsive again. So I have now switched completely to ir-keytable and it seems to be working fine.

    It's a shame that the list of available config files for ir-keytable is so much shorter than the one for lirc since they essentially contain the same information. Unfortunately for some reason lirc used the remote binary codes inverted so you need to do some manipulation to create the file for ir-keytable.

    DickH