HDMI Passthrough RPi4 - AVR detection

  • I've tested a few nightly releases and everywhere I have to have my AVR turned on during LE start. If it is only in stand by mode then LE will not detect it sees my IT connected to the AVR instead. If I reboot owing to whatever reason I will not have high DTS options available. My AVR is not very typical because it is coming from SONY MDR-HW700DS 9.1ch Digital Surround Wireless Headphone.

    Currently I have LibreELEC-RPi4.arm-9.80-nightly-20201231-b257060.img.gz on Pi4+ HiFiBerry Digi+. I can switch passthrough easily between HiFi and HDMI. I've tested also CEC functions to put more pressure on AVR but it doesn't matter even with dissabled CEC LE sees my TV.

  • It probably won't help but just FYI - it's possible to turn on / off HDMI outputs on RPi 4B:

    HDMI display_power ON ALL HDMI ports:

    vcgencmd display_power 1

    HDMI display_power OFF ALL HDMI ports:

    vcgencmd display_power 0

    HDMI display_power ON HDMI port 0:

    vcgencmd display_power 1 2

    HDMI display_power OFF HDMI port 0:

    vcgencmd display_power 0 2

    HDMI display_power ON HDMI port 1:

    vcgencmd display_power 1 7

    HDMI display_power OFF HDMI port 1:

    vcgencmd display_power 0 7


    HDMI ports connection status:

    cat /sys/class/drm/card0/*HDMI*/status


    Also regarding to HDMI devices (re)detection just stopping / starting Kodi should be enough, it also take long time but it's still more quick than whole LE reboot.

    systemctl stop kodi

    systemctl start kodi

    (or systemctl restart kodi)

  • Thanks for you feedback, I will try to test both of your suggestions because it might be helpful in the future. My LE is turned on all the time and restart is required very rarely. I have thought that it might be good to mention about it in terms of further development.

  • I want to refresh this topic. Once I disconnect the hdmi out cable from my avm and boot libreelec I have my avm detected as hdmi device instead of my TV. Can I somehow set this setting as a default to be always loaded, even if TV will be connected to avm out hdmi during system start-up?

  • I have tried to play around with edid file (hdmi_edid_file=1). I generated the file while AVR was turned on and pass through settings were fine. Unfortunately after reboot I still have the wrong settings and TV with only AC3 and DTS support has been detected (when AVR off).

    Is there any chance to have settings from guisettings.xml forced on startup:

    <setting id="audiooutput.passthroughdevice">ALSA:hdmi:CARD=vc4hdmi0,DEV=0</setting>

    <setting id="audiooutput.ac3passthrough" default="true">true</setting>

    <setting id="audiooutput.ac3transcode">true</setting>

    <setting id="audiooutput.eac3passthrough">true</setting>

    <setting id="audiooutput.dtspassthrough">true</setting>

    <setting id="audiooutput.truehdpassthrough">true</setting>

    <setting id="audiooutput.dtshdpassthrough">true</setting>

  • hdmi_edid_file won't work on LE10, this was for the legacy (firmware) graphics drivers. With LE10 you have to use the standard linux kernel KMS approach (as used eg on x86 builds).

    The info in our wiki only describes how to do this for x86 builds, on RPi you need to use a slightly different approach:

    First dump your edid to the firmware/edid directory, name it eg "myedid.bin":

    Code
    mkdir -p /storage/.config/firmware/edid
    cat /sys/class/drm/card0-HDMI-A-1/edid > /storage/.config/firmware/edid/myedid.bin

    Then create a cpio archive so the file is also available in the very early boot stage:

    Code
    mount -o remount,rw /flash
    rm -rf /tmp/cpio
    mkdir -p /tmp/cpio/usr/lib/firmware
    cp -r /storage/.config/firmware/edid /tmp/cpio/usr/lib/firmware
    cd /tmp/cpio
    find usr -print | cpio -ov -H newc > /flash/edid.cpio
    cd /storage
    rm -rf /tmp/cpio

    Add the following line to /flash/config.txt to load the edid.cpio as an initramfs

    Code
    initramfs edid.cpio

    And add the following option to the end of /flash/cmdline.txt (in the same line, separated by a space from the options before) to use your myedid.bin file for the first HDMI port:

    Code
    drm.edid_firmware=HDMI-A-1:edid/myedid.bin

    Then reboot. To verify everything worked fine run "dmesg | grep EDID", you should see the following lines indicating your myedid.bin is used:

    Code
    LibreELEC:~ # dmesg | grep EDID
    [    3.142571] [drm] Got external EDID base block and 1 extension from "edid/myedid.bin" for connector "HDMI-A-1"
    [    3.153272] [drm] Got external EDID base block and 1 extension from "edid/myedid.bin" for connector "HDMI-A-1"
    [   13.281974] [drm] Got external EDID base block and 1 extension from "edid/myedid.bin" for connector "HDMI-A-1"
    [   17.737414] [drm] Got external EDID base block and 1 extension from "edid/myedid.bin" for connector "HDMI-A-1"
    [   17.751318] [drm] Got external EDID base block and 1 extension from "edid/myedid.bin" for connector "HDMI-A-1"

    so long,

    Hias

  • One more question, is there any chance to passthrough the music?

    AC3 and DTS music files should just work if you have passthrough enabled. Just checked with an .ac3 file and a WAV containing DTS - kodi log showed that as being passed through.

    so long,

    Hias

  • I have had passthrough enabled in audio setting and mp3 was not working, I was wondering if there is any other option to be activated in music directly. Something like we see for videos, enable disable pass through.

  • The passthrough options in audio settings apply to music as well. But mp3 passthrough isn't supported.

    The IEC 61937 series includes standards for MPEG-1, MP3, AAC (and a few other niche formats) passthrough, but I'm not aware of any AVR supporting those formats and it's definitely not implemented/supported in kodi.

    so long,

    Hias

  • chewitt or CvH, could you please add this info to the wiki?

  • I also have problem getting audio output device setting stick in Kodi as libreELEC does not seem to recognize my AVR when it's in standby mode.

    My setup is as follow:

    HDMI 1 Sony XH95

    HDMI 2 Pioneer VSX-520 AVR

    LibreELEC nightly 20210319 running on Raspberry PI 4

    I tried with 2 edid files, one for Sony and one for the Pioneer and I tried using only one edid for pioneer to no avail. Every time I restart the system and AVR is in standby, kodi reverts the audio output device settings back to default and it cannot be set manually to correct hdmi port as Kodi does not recognize my AVR.

    Kodi and LE does recognize my AVR just fine if it's turned on when booting up LE.

    I followed the guide in #7 by the letter and re-did everything about 20 times to make sure I did not make any mistakes (maybe a hint of insanity going on here already :)).

    After everything is set as instructed in the guide and rebooting LE, dmesg does not log any EDID lines if my AVR is in standby mode.

    Also hdmi_ignore_cec_init=1 does not seem to work as everytime I start LE my Sony turns on and switches to the LE hdmi input. Only disabling almost every CEC feature in kodi CEC addon seem to have prevented the automatic waking of my tv.

    Following command returns this regardless if my TV or AVR is turned on:

    Code
    tail /sys/class/drm/*/status
    ==> /sys/class/drm/card0-HDMI-A-1/status <==
    connected
    
    ==> /sys/class/drm/card0-HDMI-A-2/status <==
    connected
    
    ==> /sys/class/drm/card0-Writeback-1/status <==
    unknown

    I included my bin file for pioneer if it could be of any use. I created the file with the following command:

    Code
    cat /sys/class/drm/card0-HDMI-A-2/edid > /storage/.config/firmware/edid/pioneer-vsx520.bin

    pioneer-vsx520.zip

    If some could provide any ideas that would be nice. Anyways, very nice work you have been doing with LE as always. Don't mean to be a burden here, just wondering if this something could be done to Kodi audio output device setting would stick so I wouldn't need to reboot the LE that often :)

  • It's a bit puzzling that HDMI-A-2 shows connected status but edid is not being read - please run "pastekodi" and post the URL.

    It might be worth forcing connector status to enabled (eg with video=HDMI-A-2:D) and double-checking your cmdline is correct.

    eg this should work (using lg-55c8.dat edid on first HDMI, forcing mode to HD and your pioneer edid on second HDMI forcing to always on without specific mode - you could also use 1920x1080@60D there):

    Code
    drm.edid_firmware=HDMI-A-1:edid/lg-55c8.dat,HDMI-A-2:edid/pioneer-vsx520.bin video=HDMI-A-1:1920x1080@60D video=HDMI-A-2:D

    Testing that here (with nothing connected to second HDMI) worked fine.

    EDID loaded lines in dmesg:

    Code
    [ 3.434129] [drm] Got external EDID base block and 1 extension from "edid/lg-55c8.dat" for connector "HDMI-A-1"
    [ 3.444927] [drm] Got external EDID base block and 1 extension from "edid/pioneer-vsx520.bin" for connector "HDMI-A-2"

    and kodi also detected the audio device with the pioneer AVR

    Code
    2021-03-21 13:22:04.378 T:948 INFO <general>: Device 6
    2021-03-21 13:22:04.379 T:948 INFO <general>: m_deviceName : hdmi:CARD=vc4hdmi1,DEV=0
    2021-03-21 13:22:04.379 T:948 INFO <general>: m_displayName : vc4-hdmi-1
    2021-03-21 13:22:04.379 T:948 INFO <general>: m_displayNameExtra: PIO VSX-520 on HDMI
    2021-03-21 13:22:04.379 T:948 INFO <general>: m_deviceType : AE_DEVTYPE_HDMI
    2021-03-21 13:22:04.379 T:948 INFO <general>: m_channels : FL, FR, LFE, FC, BL, BR, BLOC, BROC
    2021-03-21 13:22:04.379 T:948 INFO <general>: m_sampleRates : 32000,44100,48000,88200,96000,176400,192000
    2021-03-21 13:22:04.379 T:948 INFO <general>: m_dataFormats : AE_FMT_RAW,AE_FMT_S24NE3,AE_FMT_S24NE4,AE_FMT_S32NE,AE_FMT_S16NE,AE_FMT_S16LE,AE_FMT_S16BE,AE_FMT_U8,AE_FMT_RAW
    2021-03-21 13:22:04.379 T:948 INFO <general>: m_streamTypes : STREAM_TYPE_AC3,STREAM_TYPE_DTSHD,STREAM_TYPE_DTSHD_MA,STREAM_TYPE_DTSHD_CORE,STREAM_TYPE_DTS_1024,STREAM_TYPE_DTS_2048,STREAM_TYPE_DTS_512,STREAM_TYPE_EAC3,STREAM_TYPE_TRUEHD

    so long,

    Hias