LIRC Setup

  • Hi, this is my first post in this forum. I've been running Kodi on Ubuntu desktop for several years now, and right up front I want to say that I'm not a Linux expert. My main computer runs MacOS, so that gives you some idea of how much I get into Linux stuff. But you can't easily run MacOS on an inexpensive media center computer, and I hate Windows, which is why I have always used Ubuntu for those.

    My problem is that Kodi running under Linux does not support 4K HDR. The various posts I have read suggest that it is currently impossible for Kodi to do HDR passthrough under Ubuntu desktop. If you ask about it they typically suggest running LibreELEC, which would be great except I do sometimes do other things in Ubuntu besides running Kodi.

    One of the big things is I have installed LIRC (the old version that actually works) and use it not only with Kodi, but to do other things that are not related to Kodi at all. These are controlled using the .lircrc configuration file in the Ubuntu user directory. For example I can turn lights and other devices on and off this way. I can also start Kodi with the options I need.

    From what I have read I suspect that LibreELEC does not use nor support LIRC. So I guess my first question is, is there some way to assign certain remote buttons to various functions outside of Kodi (for example, run a shell script, or send a command to another computer on the local network using ssh?). And if so, can it learn buttons from multiple remotes that can then be assigned to these non-Kodi functions? All of that is possible with LIRC, which is how I do it on my current Ubuntu system.

    If not then my second question is whether it is possible to put both LibreELEC and Ubuntu Desktop on the same computer and at power up use the remote control to allow booting into one or the other? I think I have seen where some people have it set up so that when their systems boot up they get a text menu that lets them pick what operating system they want to boot into (though I don't know how they accomplish that at the moment) but typically they need to use a keyboard to make the selection.

    On my media center computer there is no keyboard attached and no really good place to put one (if I really need to do something that requires keyboard input then I use VNC to get to the Ubuntu desktop from my Mac, but not while I am watching TV). The idea is if I want to watch 4K HDR content I could boot into LibreELEC (which I understand does support 4K HDR) but if I need to do anything else I can boot into Ubuntu desktop, as I do now.

    I have never used LibreELEC in the past simply because I assumed I could not use my remote control the way I use it in Ubuntu Desktop, or do anything that I might occasionally want to do using a desktop environment (as rarely happens). So I don't really know how it works. My assumption has always been that it can't do these things, but am I wrong about that?

    Or, is there perhaps some other approach to this that I'm not considering? The one thing I don't want to have to do is add any additional hardware; the area around my TV is already too cluttered with devices!

  • The LE installer expects to have exclusive use of whatever disk /dev/device you install LE to so it does not support dual boot installs (and we have never offered to support dual-boot setups, it's too much hassle). However if you understand how to fiddle with partitions and create space for another OS and configure things (maybe, or maybe-not?) then it's completely possible. You can mod the syslinux config (or install grub if you or Ubuntu prefers it) and configure that to create a boot menu offering LE and Ubuntu. For a remote to work with that it probably needs to be the kind that acts like a wireless keyboard since there is no 'OS' at boot time to do fancy remote support. If the remote emulates USB keyboard arrow key navigation and USB is active (should be at BIOS level) it should work. There are probably threads in these forums on all those topics if you go (re)search for them. Again, we don't support dual-boot so there's an element of self-initiative required.

    https://wiki.libreelec.tv/configuration/…es#lirc-support <= We dropped the lirc on/off from the settings add-on some time ago (wiki needs to be update) but AFAIK everything else documented there should still apply and lirc can be used if you really need it. Without knowing what other special things you are doing in Ubuntu it's hard to say whether it can be easily replicated in LE without old-school lirc, but in 99% of cases there's usually and easier way. Give detailed descriptions and share code/scripts involved (often more useful and a non-technical users bad description) if you want better guidance.

    NB: HDR support requires an HDR capable Intel or AMD GPU (not nVidia) and the LE11b1 Generic image or newer. This uses GBM/V4L2 graphics which means no VNC. If you want to do things remotely you can SSH in use "kodi-remote" to do basic keyboard navigation around the GUI from an SSH client. If you really want VNC then you need to use the Generic-Legacy image, but that uses X11 and thus means no HDR. You cannot have both.

  • The LE installer expects to have exclusive use of whatever disk /dev/device you install LE to so it does not support dual boot installs (and we have never offered to support dual-boot setups, it's too much hassle). However if you understand how to fiddle with partitions and create space for another OS and configure things (maybe, or maybe-not?) then it's completely possible. You can mod the syslinux config (or install grub if you or Ubuntu prefers it) and configure that to create a boot menu offering LE and Ubuntu. For a remote to work with that it probably needs to be the kind that acts like a wireless keyboard since there is no 'OS' at boot time to do fancy remote support. If the remote emulates USB keyboard arrow key navigation and USB is active (should be at BIOS level) it should work. There are probably threads in these forums on all those topics if you go (re)search for them. Again, we don't support dual-boot so there's an element of self-initiative required.

    https://wiki.libreelec.tv/configuration/…es#lirc-support <= We dropped the lirc on/off from the settings add-on some time ago (wiki needs to be update) but AFAIK everything else documented there should still apply and lirc can be used if you really need it. Without knowing what other special things you are doing in Ubuntu it's hard to say whether it can be easily replicated in LE without old-school lirc, but in 99% of cases there's usually and easier way. Give detailed descriptions and share code/scripts involved (often more useful and a non-technical users bad description) if you want better guidance.

    NB: HDR support requires an HDR capable Intel or AMD GPU (not nVidia) and the LE11b1 Generic image or newer. This uses GBM/V4L2 graphics which means no VNC. If you want to do things remotely you can SSH in use "kodi-remote" to do basic keyboard navigation around the GUI from an SSH client. If you really want VNC then you need to use the Generic-Legacy image, but that uses X11 and thus means no HDR. You cannot have both.

    Well as you may have surmised from my initial post I don't really know enough about Linux to pull off any of what you talked about in your first paragraph. Also the remote is a MCE compatible remote which does not emulate any keyboard keypresses. Dual booting was never my first choice, but if there are no other options I thought it might be a way to get the functionality I wanted, if it was not too difficult to set up.

    I am trying to figure out what you mean in your second paragraph. As best I can tell, you are referring to the part where it says "Since LibreELEC 8.2.0 LIRC is disabled by default, but can be enabled in LibreELEC Settings > Services > Lirc." And you are saying that the option to enable LIRC no longer exists? So, then, how can you use LIRC?

    As for how I am using LIRC, here are some generic examples from my .lircrc file. Let's say Kodi completely hangs - I can use this to reboot the system by pressing the Red button on the remote:

    begin
    prog = irexec
    button = KEY_RED
    config = sudo reboot
    repeat = 0
    end

    (That does imply that the /etc/sudoers file has been modified to allow rebooting without requiring a password.)

    Here's a more complex example - this uses curl to send a command to an external device on 192.168.1.123 port 9200:

    begin
    prog = irexec
    button = BTN_1
    config = nohup curl -s -d '' http://192.168.0.123:9200/command > /dev/null 2> /dev/null < /dev/null &
    repeat = 0
    end

    Note that BTN_1 was mapped in from a different infrared remote, since I ran out of MCE remote buttons. All of these were then transferred to a Harmony remote. I followed an article I found at https://twosortoftechguys.wordpress.com/2018/08/29/ext…lities-of-lirc/ to set this all up.

    One final example, this runs a command on a Raspberry Pi in another location (not anywhere near the TV and media center):

    begin
    prog = irexec
    button = BTN_0
    config = ssh [email protected] "nohup command_name command_options > /dev/null 2> /dev/null < /dev/null &"
    repeat = 0
    end

    Again BTN_0 was mapped from a different infrared remote (same one as in the previous example). I this case I had to figure out how to make ssh work without asking for a password using keys, but you can run a command or program or script this way. This is probably the most important usage for me at the moment. Oh by the way, I am not sure why all those references to /dev/null are there, I probably copied some example from a web page and it worked so I didn't want to mess with it.

    Now I assume you will tell me that LibreELEC doesn't support that kind of usage and if so I get that, but that is why I was wondering if LIRC could be used, because LIRC (the older version at least) does support all that, and in a way that you can figure out how to do it without needing specialized knowledge of Linux. Sure, I had to search for a bit to figure how how to do the key thing so ssh doesn't prompt for a password, or how to run sudo reboot without it prompting for a password, but at least I could pretty much follow along and get it set up.

    As for your third paragraph, again I did not really understand much of that but if you are saying that you can't use VNC or Remote Desktop to view the screen in LibreELEC, normally my only reason for doing that is to be able to remotely view and change settings in Kodi (or, in the case of Ubuntu Desktop, to do other things unrelated to Kodi). I am unfamiliar with keyboard-remote but if it lets you see and change Kodi options remotely that would work, however just from the name I suspect it's only for substituting for a remote control/keyboard and doesn't let you see the screen.

    I am NOT wanting to be able to watch video remotely, just to be able to easily view/change Kodi options from another computer. I assume you can ssh into LibreELEC to manually change configuration files using nano, but that really doesn't show you the options in Kodi's interface. But anyway that is not my primary concern, my real concern is whether LIRC can be made to work, or if there is some alternative way to do the things I have mentioned using my remote.

    Edited once, last by maple (February 13, 2023 at 8:34 PM).

  • I am NOT wanting to be able to watch video remotely, just to be able to easily view/change Kodi options from another computer. I assume you can ssh into LibreELEC to manually change configuration files using nano, but that really doesn't show you the options in Kodi's interface. But anyway that is not my primary concern, my real concern is whether LIRC can be made to work, or if there is some alternative way to do the things I have mentioned using my remote.

    The easiest way to solve both problems is using a phone / tablet with a Kodi remote app, like Kore or Yatse.

  • The easiest way to solve both problems is using a phone / tablet with a Kodi remote app, like Kore or Yatse.

    Those work in the same way as VNC would (if it worked) to let you see all the Kodi settings screens and make changes? Or are they just remote control apps (which would not really be helpful)? But anyway, I have been using VNC from a MacOS desktop computer, didn't really want to have to use a phone or tablet, I would think it would be pretty hard to read the settings on a phone screen anyway unless you have eagle eyes.

    But as I said getting VNC to work is not my primary concern, I mainly am wanting to find out about the LIRC part.

  • Those work in the same way as VNC would (if it worked) to let you see all the Kodi settings screens and make changes? Or are they just remote control apps (which would not really be helpful)? But anyway, I have been using VNC from a MacOS desktop computer, didn't really want to have to use a phone or tablet, I would think it would be pretty hard to read the settings on a phone screen anyway unless you have eagle eyes.

    Those apps have specific GUI's to edit Kodi settings, and they access Kodi's web interface. They are much more than just RC. I'm no Mac user, but I bet there is a way to run such apps on a Mac's big screen, too. It should be no problem to connect to Kodi's web interface from there.

    But as I said getting VNC to work is not my primary concern, I mainly am wanting to find out about the LIRC part.

    Go to the forums main page, and search for keyword "LIRC". Happy reading! :)

  • Searching for posts about LIRC won't help if there is now no way to activate it from the LibreELEC interface anymore. Really I am probably wording that wrong, I'm not looking for information specifically on LIRC now (unless there is still a way to make it work in LibreELEC, which chewitt's post seems to indicate is no longer possible) but what I am really wanting to know is if there is a way to do the specific things that I have been doing using a .lircrc file, as I described in post #4 in this thread.

    If you look at the three examples I gave you can see the type of thing I am trying to do. Assuming that LIRC is no longer functional in LibreELEC, then I guess what I should be asking is if there is any other way to accomplish things like that using whatever remote control functionality is built into LibreELEC? The impression I am getting is that in LibreELEC you can control only Kodi and nothing else using the remote, but if that's not the case then I was hoping for some explanation of how it might be done.

  • If you want to continue using LIRC we still support it and you can continue doing the same things. The only change will be dropping "sudo" from any commands being exectuted since in LE everything runs as root making sudo not necessary. Using LIRC also negates the need for Ubuntu, and all the dual-boot and boot menu things.

    However, there is no HOWTO guide for your exact setup, nobody is going to volunteer to write one specially for you, and forum staff generally expect a modicum of initiative to be shown. So have a go, and if you get stuck, ask Q's.

  • maple I've noticed that you've mixed very different topics into this thread. Now you struggle to describe the priority among them. To make life easier for all of us, I close this thread. Please open new threads for each topic.