diff options
Diffstat (limited to 'meta-nuc')
| -rw-r--r-- | meta-nuc/recipes-core/initscripts/initscripts/hdmi_port_audio.sh | 28 | ||||
| -rw-r--r-- | meta-nuc/recipes-core/initscripts/initscripts_1.0.bbappend | 10 |
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 00000000..69d8a53f --- /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 | |||
| 14 | ALSA_CONF_FILE="/etc/asound.conf" | ||
| 15 | |||
| 16 | HDMI0_STATUS_FILE="/sys/class/drm/card0-HDMI-A-1/status" | ||
| 17 | HDMI1_STATUS_FILE="/sys/class/drm/card0-HDMI-A-2/status" | ||
| 18 | |||
| 19 | HDMI0_ALSA_CONF="hw:0,3" | ||
| 20 | HDMI1_ALSA_CONF="hw:0,7" | ||
| 21 | |||
| 22 | if [ -f "${HDMI0_STATUS_FILE}" ] && [ "`cat ${HDMI0_STATUS_FILE}`" == "connected" ] | ||
| 23 | then | ||
| 24 | sed -i "s/pcm *\"hw:[0-9]*,[0-9]*\"/pcm \"${HDMI0_ALSA_CONF}\"/" ${ALSA_CONF_FILE} | ||
| 25 | elif [ -f "${HDMI1_STATUS_FILE}" ] && [ "`cat ${HDMI1_STATUS_FILE}`" == "connected" ] | ||
| 26 | then | ||
| 27 | sed -i "s/pcm \"hw:[0-9]*,[0-9]*\"/pcm \"${HDMI1_ALSA_CONF}\"/" ${ALSA_CONF_FILE} | ||
| 28 | fi | ||
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 00000000..abc5fe01 --- /dev/null +++ b/meta-nuc/recipes-core/initscripts/initscripts_1.0.bbappend | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
| 2 | |||
| 3 | SRC_URI += "file://hdmi_port_audio.sh" | ||
| 4 | |||
| 5 | PR .= ".1" | ||
| 6 | |||
| 7 | do_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 | } | ||
