Ubuntu – HDMI Audio stops after TV turned off

12.04hdmiradeonsound

After the 12.04 Update my HDMI audio stops working anytime I turn off my 2nd monitor(plasma TV). Graphics card is a Radeon 6800 which has DVI out to 1st monitor, HDMI out to receiver which the TV gets it's Audio/Video. Audio is always via my receiver sound.

Things work fine as long as it boots with the TV and Receiver on.
Turn off the TV and BART's HDMI audio will go away, and the HDMI option vanishes from the sound menu. I had an occasional HDMI issue with 11.10 but turning on/off the TV would fix the sound.
How can I hardcode things so that it always uses HDMI out of audio?
I suspect the TV is sending a signal upon that 12.04 is now listening for.
Turning the TV back on does NOT resolve this, and I'd suggest having the ability to override this new "feature" via sound menu.

Best Answer

I've been having this problem. I couldn't find a decent fix, but I have this work around. Note that it's a horrid hack but it does the job for me until the root problem is fixed -- hopefully it will help someone else. Every 5 seconds it checks dmesg for HDMI connection errors and if it finds one it restarts the connection.

I made this watchdog script -- replace "DFP1" with the name of your output (get it from xrandr).

#!/usr/bin/env python
import os
import time

valid = "ELD_Valid=1"
invalid = "ELD_Valid=0"

def executeCommand(the_command):
    temp_list = os.popen(the_command).read()
    return temp_list

def getDMESG():
    return executeCommand("dmesg | grep -i hdmi | tail -n 10")

def needsRefresh():
    list = getDMESG();
    valid_index = list.rfind(valid)
    invalid_index = list.rfind(invalid)
    if invalid_index > valid_index:
        return True
    else:
        return False

def doTest():
    if needsRefresh() == True:
        os.popen("xrandr -display :0 --output DFP1 --off; xrandr -display :0 --output DFP1 --auto").read()

while True:
    doTest()
    time.sleep(5)

If anyone knows a better way to detect the error (with catalyst drivers), please let me know. (With the opensource drivers I think you could trigger the reset bit of the code on drm acpi events if you wanted to do some scripting).

I start it by adding this to /etc/rc.local: (change "xbmc" to the user name that you log in as)

su xbmc -c 'python /home/USERNAME/src/check_hdmi.py &'
Related Question