summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin A Kamble <nitin.a.kamble@intel.com>2012-12-12 00:00:21 (GMT)
committerTom Zanussi <tom.zanussi@intel.com>2012-12-14 17:00:54 (GMT)
commit773a71c667d907b5851139046826f115c71d4886 (patch)
tree0f3de65a08e3d2b3a31b2edaed8c79bfd8762daa
parenta2d990eaad676ccd19491e8c5b433d81e3604e05 (diff)
downloadmeta-intel-773a71c667d907b5851139046826f115c71d4886.tar.gz
meta-nuc: init script for configuring HDMI audio
Provide an init script to check at boot time which HDMI port is connected and configure the default ALSA audio out to that port. Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com> Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
-rw-r--r--meta-nuc/recipes-core/initscripts/initscripts/hdmi_port_audio.sh28
-rw-r--r--meta-nuc/recipes-core/initscripts/initscripts_1.0.bbappend10
2 files changed, 38 insertions, 0 deletions
diff --git a/meta-nuc/recipes-core/initscripts/initscripts/hdmi_port_audio.sh b/meta-nuc/recipes-core/initscripts/initscripts/hdmi_port_audio.sh
new file mode 100644
index 0000000..69d8a53
--- /dev/null
+++ b/meta-nuc/recipes-core/initscripts/initscripts/hdmi_port_audio.sh
@@ -0,0 +1,28 @@
1#!/bin/sh
2### BEGIN INIT INFO
3# Provides:
4# Required-Start:
5# Required-Stop:
6# Default-Start: S
7# Default-Stop:
8# Short-Description: Configure ALSA audio output to the connected HDMI port
9### END INIT INFO
10
11#
12# If both HDMI ports are connected then use HDMI0 for default ALSA audio out..
13
14ALSA_CONF_FILE="/etc/asound.conf"
15
16HDMI0_STATUS_FILE="/sys/class/drm/card0-HDMI-A-1/status"
17HDMI1_STATUS_FILE="/sys/class/drm/card0-HDMI-A-2/status"
18
19HDMI0_ALSA_CONF="hw:0,3"
20HDMI1_ALSA_CONF="hw:0,7"
21
22if [ -f "${HDMI0_STATUS_FILE}" ] && [ "`cat ${HDMI0_STATUS_FILE}`" == "connected" ]
23then
24 sed -i "s/pcm *\"hw:[0-9]*,[0-9]*\"/pcm \"${HDMI0_ALSA_CONF}\"/" ${ALSA_CONF_FILE}
25elif [ -f "${HDMI1_STATUS_FILE}" ] && [ "`cat ${HDMI1_STATUS_FILE}`" == "connected" ]
26then
27 sed -i "s/pcm \"hw:[0-9]*,[0-9]*\"/pcm \"${HDMI1_ALSA_CONF}\"/" ${ALSA_CONF_FILE}
28fi
diff --git a/meta-nuc/recipes-core/initscripts/initscripts_1.0.bbappend b/meta-nuc/recipes-core/initscripts/initscripts_1.0.bbappend
new file mode 100644
index 0000000..abc5fe0
--- /dev/null
+++ b/meta-nuc/recipes-core/initscripts/initscripts_1.0.bbappend
@@ -0,0 +1,10 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3SRC_URI += "file://hdmi_port_audio.sh"
4
5PR .= ".1"
6
7do_install_append() {
8 install -m 0755 ${WORKDIR}/hdmi_port_audio.sh ${D}${sysconfdir}/init.d
9 ln -sf ../init.d/hdmi_port_audio.sh ${D}${sysconfdir}/rcS.d/S66hdmi_port_audio.sh
10}