12

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.

2

9 Answers 9

9
+50

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 &'
7
  • The script works but not the automation with rc.local. Could you please show how the rc.local should look like?
    – ECII
    May 21, 2012 at 11:08
  • Would it be OK to add the script to cron and let it execute every minute or so?
    – ECII
    May 21, 2012 at 11:24
  • You could put in into cron. You'd have to remove the entire while True: block and replace it with simply doTest(). It might take some tinkering -- make sure it's run in the logged in users cron (not root). May 21, 2012 at 12:31
  • My rc.local contains a few things. At the bottom it has this: su xbmc -c 'python /home/andy/src/check_hdmi.py &' then on a new line exit 0. Have you replaced xbmc with the correct user name? May 21, 2012 at 12:34
  • If you're using a normal desktop environment (I'm using xbmc, so I'm not), you could probably just add the python script to your startup applications. May 21, 2012 at 12:54
6

In the meantime while the bug report gets a good going over, I've noticed a quick button combination that will save a few headaches.

Simply pull out into a tty and back to your GUI:

CTRL + ALT + F1 (or anything from F1 to F6)

then

CTRL + ALT + F8 (you might need to use F7 instead of F8. One of them will return you to your desktop, the other will give you a black screen and a cursor)

It seems sync is re-established when returning to the GUI.

This is far quicker than logging out and back in, and you're programs etc. remain open.

Button combination. Done. Hassle free.

This of course isn't a fix. It's just a quick keyboard combination to trick the HDMI to re-sync and thus get the audio back.

It works on my end.
Anyone else want to turn their TV off for a second and try it themselves?

2

I noticed that if you turn off the output to the TV and turn it back on it also resets the sound (Radeon HD6670). The aticonfig commands set the display to fill the screen on my TV. You need to find out your output name by running "xrandr -q" change "DFP1" to what is listed before "CONNECTED" in the output of the command (it is case sensitive). Only problem with this on my setup is that some windows jump part way off the top of the screen when running the on/off part of the script (Alt-Drag them back down if it happens to you). Maybe someone can code a better solution/workaround.

#! /bin/bash

# Turn off the DFP1 Output
xrandr --output DFP1 --off
# Turn DFP1 back on
xrandr --auto 

# Set Screen to fit TV
aticonfig --set-dispattrib=dfp1,positionX:0
aticonfig --set-dispattrib=dfp1,positionY:0
aticonfig --set-dispattrib=dfp1,sizeX:1920
aticonfig --set-dispattrib=dfp1,sizeY:1080
1

Same problem. The only hint I've got is after running pactl list

Sink #0
    State: SUSPENDED
    Name: alsa_output.pci-0000_01_00.1.hdmi-stereo
    Description: Turks HDMI Audio [Radeon HD 6000 Series] Digital Stereo (HDMI)
    Driver: module-alsa-card.c
    Sample Specification: s16le 2ch 44100Hz
    Channel Map: front-left,front-right
    Owner Module: 4
    Mute: no
    Volume: 0: 100% 1: 100%
            0: 0.00 dB 1: 0.00 dB
            balance 0.00
    Base Volume: 100%
                 0.00 dB
    Monitor Source: alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE DECIBEL_VOLUME LATENCY SET_FORMATS 
    Properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "HDMI 0"
        alsa.id = "HDMI 0"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "3"
        alsa.card = "1"
        alsa.card_name = "HD-Audio Generic"
        alsa.long_card_name = "HD-Audio Generic at 0xfddfc000 irq 48"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:01:00.1"
        sysfs.path = "/devices/pci0000:00/0000:00:02.0/0000:01:00.1/sound/card1"
        device.bus = "pci"
        device.vendor.id = "1002"
        device.vendor.name = "Advanced Micro Devices [AMD] nee ATI"
        device.product.name = "Turks HDMI Audio [Radeon HD 6000 Series]"
        device.string = "hdmi:1"
        device.buffering.buffer_size = "65536"
        device.buffering.fragment_size = "32768"
        device.access_mode = "mmap+timer"
        device.profile.name = "hdmi-stereo"
        device.profile.description = "Digital Stereo (HDMI)"
        device.description = "Turks HDMI Audio [Radeon HD 6000 Series] Digital Stereo (HDMI)"
        alsa.mixer_name = "ATI R6xx HDMI"
        alsa.components = "HDA:1002aa01,00aa0100,00100200"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    Ports:
        hdmi-output-0: HDMI / DisplayPort (priority: 5900, not available)
    Active Port: hdmi-output-0
    Formats:
        pcm

It seems turning off monitor disables sink? and does not re-enable when tv is turned on again. hdmi-output-0: HDMI / DisplayPort (priority: 5900, not available)

"not available" should be "available"

I assume you are using an ATI card with fglrx. try

aticonfig --acpi-services=off

Not sure it this setting is persistant. If so the command to turn on again is.

aticonfig --acpi-services=on

I doubt this will work. EDIT>(It didn't)

As user53740 posted. Logout/in restores audio. Switching monitor on or off disables HDMI audio. If you really don't want to logout you can remove hdmi plug an plugin again and hdmi audio will be restored. Don't do it too often. Only when you are desperate.

There is a thread here ond a dodgey bug report here

EDIT> Another workaround is go to System Settings>Display. Then click apply without changing anything.

1

Go to System Settings → Displays

Change resolution, apply, then change it back.

All Settings → Sound → select HDMI

0

Having the same problem.

Of course, ATI drivers are probably the cause of problems, again. Mine is Radeon HD 6xxx .

Logging out and back in gets the sound back, but I guess that there could be another simpler solution.

0

Solved GD Gents

Had same problem only my http with ATI 5770 was connected to receiver and then to TV. Solved this problem by downloading and installing latest BETA driver pack from AMD web site.

Here's the link ATI Radeon

Thank-you very much for the link to the Catalyst ™ 12.7 Beta Driver I had been searching Google for a long time and no-one had an easy answer for this annoying problem.

But after installing the AMD Catalyst 12.7 Beta Driver for Windows ® 7 and Windows Vista®

everything is hunky-dory!

Much obliged.:)

0

This works for me (Intel HD graphic card): killall pulseaudio

(found here: https://askubuntu.com/a/176276/45779)

1
0

Thankyou, thankyou!

I can't comment, so I have to add an answer instead.

Your approach worked for me on Ubuntu 20.04, I created a watcher script (executed as the user automatically logs in) based on yours, but just checking for whether the hdmi sink is active, and then restarting pulseaudio if it isn't :

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

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

def getDMESG():
    return executeCommand("pactl list sinks | grep -i hdmi")

def needsRefresh():
    list = getDMESG();
    if len(list) == 0:
        return True
    else:
        return False

def doTest():
    if needsRefresh() == True:
        os.popen("pulseaudio -k").read()

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .