LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-29-2012, 05:27 PM   #1
quasifilmie
LQ Newbie
 
Registered: Aug 2011
Posts: 2

Rep: Reputation: Disabled
Question for acid_kewpie regarding his hdmi audio script


Hi acid_kewpie,

I have a question regarding this thread you made a few months ago.

http://www.linuxquestions.org/questi...g-hdmi-903802/

I modify it a bit using trial and error and I am a bash noob. Where should I put this script? In other words I want the system to read and adhere to the rules in the script.
 
Old 01-30-2012, 02:32 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
you'd have a file like /etc/udev/rules.d/hdmi.rules:

KERNEL=="card0", ACTION=="change", RUN+="/home/user/hdmi.sh"

But TBH, it never quite worked for me. I ended up converting into a script which I could run from a terminal without any parameters, which looked for the HDMI status and acted accordingly. I can post it later if you would find it useful.
 
Old 01-30-2012, 02:35 PM   #3
quasifilmie
LQ Newbie
 
Registered: Aug 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
No that's okay. What I really need is an alsa conf file that causes the hdmi to automatically output audio instead of my laptop speakers like s/pdif. Anyway, I found a udev rule on the arch forums. Works for a couple arch users. Not for me. I made your script a sh file and added it to startup in gnome-session but all it did would override my sound settings and always cause hdmi output even if hdmi was not plugged in. KDE has phonon which allows you to choose prefence of device but I found it cumbersome and unstable.
 
Old 01-30-2012, 02:38 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
ahh well I'm here now... someone else might be interested


Code:
#!/bin/sh

status="$(cat /sys/class/drm/card0-HDMI-A-1/status)"

export DISPLAY=:0.0

if [ "${status}" = disconnected ]
then
  xrandr --output HDMI1 --off
  pactl set-card-profile 0 output:analog-stereo+input:analog-stereo
elif [ "${status}" = connected ]
then
  xrandr --output HDMI1 --mode 1280x720 --right-of LVDS1
  pactl set-card-profile 0 output:hdmi-stereo+input:analog-stereo
fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with HDMI audio jrhorn424 Slackware 10 10-27-2012 12:07 AM
HDMI Audio doesn't work - Debian Squeeze (Intel HDMI) felipefv Linux - Hardware 8 02-06-2012 09:47 AM
HDMI Audio with 12.2 Woodsman Slackware 27 09-04-2009 10:53 PM
HDMI Audio with Current/13.0 Woodsman Slackware 2 08-24-2009 01:40 PM
Audio through HDMI Cable? Jeff91 Linux - Hardware 7 06-26-2009 09:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration