CEC problems on rpi5 with LE nightly

  • In the CEC configuration it starts with 1, so i assume 1 == 0 and 2 == 1, right?

    No. This setting is to select/address the right HDMI input on your TV, not the output of the RPi ! This should important for those functions:

    • Switch source to this device on startup / Beim Starten Kodi als aktive Quelle melden
    • Action when switching to another source / Aktion beim Umschalten auf eine andere Quelle
    • Send "Inactive source" command on shutdown / Beim Ausschalten Kodi als inaktive Quelle melden


    One of the 2 CEC Adapter entries in the peripherals (Peripheriegeräte) list equals to HDMI 0 and the other to HDMI 1. Currently it makes not really a difference which entry you use to configure, because it results in the same configuration set.

    Try to imagine the HDMI chain like a pyramid:

    Code
            TV 
            AVR
    RPi | Bluray | Game console

    The root device is mostly a TV (HDMI sink) with the address 0.0.0.0
    Every connected device get a physical address with that pattern : 1.1.0.0
    The first digit is the HDMI port number of the TV
    The second digit is the HDMI port number of the AVR

    Example 1:
    RPi is connected directly to HDMI 1 of your TV: 1.0.0.0

    Example 2:
    RPi is connected via AVR to the TV. AVR is connected to HDMI port 2 of TV.
    The RPi is connected to HDMI port 3 of the AVR: 2.3.0.0
    Bluray at HDMI 4: 2.4.0.0
    Game console at HDMI 1: 2.1.0.0

    This addressing is important if you want to signaling the device as the current source, so the TV and AVR switch to the right HDMI inputs and you can get a picture and sound. libCEC seems to detect this address automatically.

    However, you could set this address manually via one of these:

    • "HDMI port number / HDMI-Portnummer" + "Connected to HDMI device / Verbunden mit HDMI-Gerät"
    • Physical address (overrules HDMI port) / Physikalische Adresse (verwirft HDMI-Port)

    In case of example 2:

    • The correct value for physical address is 2300

      or

    • HDMI port number: 3 + Connected to HDMI device: AVR.

      or

    • Alternatively HDMI port number: 2 + Connected to HDMI device: TV

    The issue is, that this manual setting will be overwritten automatically after you closed the settings dialog or reboots KODI. This seems intended by libCEC as long the auto detection works.

    In my experience it's better to leave this settings at default and don't change that, although sometimes the correct addressing is displayed:

    HDMI port number: 0
    Connected to HDMI device: TV
    Physical address (overrules HDMI port): 0


    You can check the current addressing in this way:

    • stop KODI
      systemctl stop kodi
    • scan CEC bus
      echo 'scan' | cec-client -s -d 1

    Edited 4 times, last by HarryH (June 13, 2024 at 9:04 PM).

  • Oh wow, that was exactly what i was looking for. Some simple explanation what all those config flags are meant for. Thanks, i will try that the next evening! Guess i simply have the wrong TV HDMI output selected.

  • Unfortunately, at least in nightly, the settings are somehow not saved. What i was able to achieve is that when i poweroff the rpi in the menu, the tv turns off too. But when i power on the TV, nothing happens with the rpi. When i power off the TV, also nothing happens with the rpi. I checked the settings and noticed, that after a restart, most of them are set back to default, e.g. i configured its connected to TV / AVR, but when i reboot, it states only TV, which is wrong. I assume thats the reason why its not working.

    I will test maybe this evening or tomorrow how LE12 behaves.

  • I checked the settings and noticed, that after a restart, most of them are set back to default, e.g. i configured its connected to TV / AVR, but when i reboot, it states only TV, which is wrong.

    That's the issue that I already tried to communicate twice to you and the reason for that recommendation:

    The issue is, that this manual setting will be overwritten automatically after you closed the settings dialog or reboots KODI. This seems intended by libCEC as long the auto detection works.

    In my experience it's better to leave this settings at default and don't change that, although sometimes the correct addressing is displayed:

    HDMI port number: 0
    Connected to HDMI device: TV
    Physical address (overrules HDMI port): 0

    I assume thats the reason why its not working.

    I will test maybe this evening or tomorrow how LE12 behaves.

    Maybe it works with your configuration. IIRC it hasn't worked for my configuration to shutdown KODI via TV off in LE12. I switched to another solution and allow KODI to power off after 120 minutes in idle state.
    Until now I doesn't have investigate into the deep regarding this. But I believe the partitially reset of the CEC Adapter settings, because of the auto-detection isn't the same issue. Maybe the EDID data plays a role, but TV on/off commands shouldn't depend on a correct HDMI port information. It's a global command at the HDMI net. It looks more like a timing or order issue to me.

  • IIRC it hasn't worked for my configuration to shutdown KODI via TV off in LE12.

    I am now at LE12 and it also does not work on my side. But not sure if i have everything configured correctly. Can you tell me whats this client cec mode is? output of cec-client, if it helps in any way. And you are correct about your guess, my TV is the "root", then the AVR, then all other devices e.g. rpi5, nintendo switch, pc etc. on the avr hdmi ports

    Guess i can not help you in any way e.g. providing any data or so? Unfortunately, CEC is a killer feature for me :-/
    Guess i have to go back to amlogic and coreelec then :-/

  • libCEC is the underlying library which KODI currently use to provide CEC support, provided by Pulse-Eight. KODI is only a client/consumer of libCEC. The library does the CEC communication and so on.
    All things that works with cec-client should also work/be possible with KODI. If threre is a difference in behavior between KODI and cec-client, then it will be an issue of one them.

    If both (cec-client and KODI) behaves same, but wrong - then it indicates for an error of libCEC or the involved HDMI configuration/driver/firmware/hardware like RPi, AVR / TV ...

    cec-client is nice to debug CEC messages or to send commands via script. Maybe you can see on that way if there any messages are send as soon you power off your TV. Normally your AVR should react on the message from the TV, but:

    • the TV must send this message
    • it must be allowed in your AVR to power off via CEC


    This should be possible independent to the RPi5 behavior. If not, you have already an issue with your HDMI configuration of the TV/AVR or one of the other devices disturb the bus. In the worst case you should start with a single physical connection TV <-> AVR, then TV<->AVR<->RPi5 only and so on to check which one is the disturbing device. Hopefully not the RPi5. ;)

    Also the most propagated hint of chewitt : Power off and un-plug all involved devices. Go away and trink a coffee, tea or something like that for least ten minutes, can be a magic healing. Because that ensures that really all HDMI partners were off/reset and the handshaking is initialized new.

    By the way, cec-client could also be used as a workaround during boot to power on the TV too via autostart.sh or something like that, because the CEC interface must not be occupied by another client such as KODI at this time.

  • I probably forgot to mention: when i use the odroid n2 instead of the rpi5, all works fine (power on/power off of everything), so the other devices work as expected. Not sure what coreelec uses or if there are even any alternatives to libCEC (probably not?).

    I will try this 10 minutes tea thing and make a little pray ;)

    cec client mode is set to "Wiedergabegerät" (replay device?), i assume/hope thats correct.