Debugging CEC issues

Hi guys, I’m really new to osmc, kodi and raspberry pi, but I am pretty experienced with linux and media center software in general. I’ve looked all over the osmc wiki, the kodi form and the internet and I can’t really find information I can understand and put to use (I probably just don’t understand how to apply most of the advice…). I’ve tried looking through ~/.kodi/temp/kodi.log and some other files to figure out what’s going on. I’ve tried to use cec-client to listen for things and I’m not getting anything meaningful out of it.

The Setup:

I have a raspberry pi 3 with osmc installed on it. I also put some other stuff on there, libcec, plex server (unrelated hopefully), ffmpeg (compiled from source, also hopefully unrelated), and all their dependencies (and probably a few more packages… I wasn’t super diligent about keeping track). I have a NAS hosting some shares which are NFS mounted to the pi. The pi is connected to an Onkyo HT RC360 (that link doesn’t make it obvious but the manuals say it supports HDMI-CEC, which is connected to an LG TV. All connected with compatible HDMI Cables.

The Problem:

I can’t use my Onkyo remote with my osmc


I don’t expect anyone to say, “gosh I think this is your problem”. I’d really like to figure out where to look and what to try to solve the problem and hopefully learn more about everything in the process. Like I said above, I’ve run the cec-client to try to see if anything is coming through but it always spits out the same thing, which seems to say that the cec-client is running find and not receiving any information. The kodi log never says anything pertinent (I did turn on debug logging).

I’ve installed libcec on the pi, but I don’t even know if kodi is using it and listening for cec commands. I don’t know if cec commands are getting to the pi.

Any help on what to try or where to look would be greatly appreciated.

Have you tried using the LG TV remote to control OSMC? This will confirm whether CEC is operational or not on your setup.

The CEC bus is not configured to allow the AVR remote to control OSMC. I don’t believe this is trivial either. Do you have other devices which you can control using your Onkyo remote?

Don’t manually install libcec unless you really know what you are doing. Even then, I would recommend picking a couple of our patches from Git.

Thanks for the reply.

I haven’t tried the LG TV remote because I haven’t had it for years… I have tried pressing the “TV” button on the onkyo remote and pointing it at the TV and that acts the same as having it on BD/DVD (or whatever receiver input the pi is on), more specifically I don’t see anything on the pi indicating it’s getting a CEC command.

When you say “The CEC bus” what device is the CEC bus located in? The TV the Pi or the receiver? What is the AVR? I use the onkyo remote to control the tv, a dvd player and I used to use it to control my mythtv, but that was an entirely different setup.

When you say don’t install libcec manually, a) why not? b) patches for… osmc? how does one “pick up those patches” or identify which patches I’d need?

Thank you for taking the time! I know these posts take time to sift through!

The CEC bus is a one-wire peripheral bus which can involve several devices connected over HDMI. Your AVR (amplier / audio video receiver) acts as a ‘Recorder’ typically, and typically other devices act as a ‘Player’. However, Kodi typically acts as a ‘Recorder’, but this varies from device to device (on the Vero 2, it is configured as a Player by U-Boot, so we keep this the same in Kodi to not confuse things). There are a finite number of roles that each device can assume, and the LA of each device cannot overlap. I used to have a diagram at hand that did a good job of explaining this, but I can’t find the URL.

CEC is a complicated beast, and less standardised than you may expect it to be. LG sets are considered to be quite difficult, but compatibility has improved for these units over time.

You should get output from cec-client (make sure you use the OSMC version first, not your one to rule out issues).

First and foremost, libCEC 3.1 is the latest version, but comes in two flavours. Kodi v16 (Jarvis), which is the latest stable version, uses the ‘platform’ namespace for Pulse-Eight packages (libplatform, libcec). However libCEC 3.1 from Pulse-Eight’s Git repository uses the new ‘p8-platform’ namespace to avoid issues. You will need to revert these namespace changes for correct Kodi platform.

Ideally when building a package which has libs which are used by other packages, you should also build the packages against these updated libs too. I am currently sticking with libCEC 3.0.1 as 3.1.0 has some rough edges. You would need to rebuild Kodi if you use a different library version or the updated version with the namespace changes. Annoyingly, you cannot just patch Kodi to use the namespace, you will need to patch the Kodi binary-addons to use p8-platform too, which will require patching each add-on, as well as libplatform.

You can grab our patches from GitHub and apply them against your own sources. There are a few fixes you will want to pick. I recommend you pick up the @popcornmix repeat press patch too. Some of these improvements are upstream now, but I haven’t had time to look at 3.1.0 in its latest incarnation and test it on all platforms (RBP, iMX6, AML).

If you build libCEC, you will need to override rpath of /usr/osmc/lib. I put OSMC libs in /usr/osmc/lib and load them first over /usr/lib because we had some less knowledgeable users doing sudo apt-get install libcec (or some other lib), getting them from upstream Debian and then having problems. This approach also allows us to switch between upstream and downstream libraries easily (you just transitional-package the lib you want out and Depend on the new one), then you can fall back based on the path.

The best way to build libCEC that works with OSMC of course would be:

sudo apt-get install build-essential git
git clone
cd osmc/package/libcec-osmc
sudo make rbp2

I don’t see any benefit of building this package yourself. If you have any patches that are beneficial, we are happy to include them.

1 Like