View previous topic :: View next topic |
Author |
Message |
anthonyk n00b
Joined: 21 Nov 2005 Posts: 46
|
Posted: Sun Oct 17, 2021 7:40 pm Post subject: Audio on Radeon gpu HDMI doesn't work after suspending |
|
|
I am outputting audio to a monitor through HDMI on a Radeon gpu (Caicos HDMI Audio [Radeon HD 6450 / 7450/8450/8490 OEM / R5 230/235/235X OEM]
), after I suspend and resume the audio stops working.
If I go to the sound settings (`mate-audio-control`), go to Hardware and change Profile for the card to Off and then on again the audio works again. I'm not sure what state the card/drivers has ended up in and what needs to be changed, but i'd like to find a way for audio through the card to work again after resuming.
thanks |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3875
|
|
Back to top |
|
|
anthonyk n00b
Joined: 21 Nov 2005 Posts: 46
|
Posted: Thu Oct 21, 2021 10:14 am Post subject: |
|
|
Thanks for the tip. Running as user from the command line works to fix the audio after resuming, although the hook script isn't working to do it automatically. Code: | /etc/init.d/elogind | is active. i'll have a look into the details a bit more |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21498
|
Posted: Thu Oct 21, 2021 3:29 pm Post subject: |
|
|
Is the hook script not running, or is it running and not producing the desired result? If the latter, as what user did the hook script run the command? |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3875
|
Posted: Thu Oct 21, 2021 3:48 pm Post subject: |
|
|
Elaborating a bit on Hu's response
you might need
Code: |
sudo -H -u <user> pulseaudio -k
sudo -H -u <user> pulseaudio -D
|
You might need also some env variables exported either via "export" or "env" commands.
I am not sure which ones you need.
run as your user
and try to figure out what you need. _________________
|
|
Back to top |
|
|
anthonyk n00b
Joined: 21 Nov 2005 Posts: 46
|
Posted: Thu Oct 21, 2021 11:21 pm Post subject: |
|
|
ok I did a bit more digging around and I think this works, although it seems to fail sometimes so i'll need to test it a bit more for reliability
Code: |
#!/bin/bash
case $1/$2 in
pre/*)
# Put here any commands expected to be run when suspending or hibernating.
;;
post/*)
# Put here any commands expected to be run when resuming from suspension or thawing from hibernation.
pulse_users=`ps waux | grep pulseaudio | awk '{print $1;}' | sort | uniq`
for username in $pulse_users
do
uid=`id -u $username`
#sudo -H -u $username PULSE_RUNTIME_PATH=/run/user/$uid/pulse pasuspender /bin/true
sudo -H -u $username PULSE_RUNTIME_PATH=/run/user/$uid/pulse pulseaudio -k
done
;;
esac
|
I was trying to use pasuspender instead as it is a softer reset and slightly preferred over pulseaudio -k, but I have tested it sometimes (manually, with a direct call when the audio was stopped) and not had it fix the audio so i'm not sure. and I think the -k option has failed too. anyway i'll test it a bit more and see how it works
also there is a strange case where the /run/user/1001/pulse directory gets owned by root and then the call fails (but calling pulse commands from a normal xterm works), I did chown on the directory but not sure if it will last a reboot.
thanks for the tips |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21498
|
Posted: Fri Oct 22, 2021 1:13 am Post subject: |
|
|
That script could be simpler and cleaner. Untested: Code: | ps -C pulseaudio -o user=,uid= | sort | uniq -f1 | while read username uid; do
sudo -H -u "$username" "PULSE_RUNTIME_PATH=/run/user/$uid/pulse" pulseaudio -k
done |
- Use ps's -C to find the target program, instead of using grep, which can trigger hits for unrelated processes. (For example, your command would flag an xterm that was invoked as xterm -e /usr/bin/pulseaudio.)
- Use ps's -o to print only the needed fields.
- Use uniq -f1 to filter only on one field.
- Get the uid from ps, so it does not need to be recomputed in the loop body.
- Pipe the data directly into a loop so it can begin immediately.
- The sudo command is unchanged.
|
|
Back to top |
|
|
|