diff options
author | Simon Rettberg | 2018-09-27 14:33:53 +0200 |
---|---|---|
committer | Simon Rettberg | 2018-09-27 14:33:53 +0200 |
commit | f50c00d32eadddb1f157b06b358ab1e8bd2a76aa (patch) | |
tree | d7ce7311ef3108b2677f969f0769ef71dd6b2fe3 /core/modules/alsa/data | |
parent | [kernel-vanilla] ADD FILE IDIOT (diff) | |
download | mltk-f50c00d32eadddb1f157b06b358ab1e8bd2a76aa.tar.gz mltk-f50c00d32eadddb1f157b06b358ab1e8bd2a76aa.tar.xz mltk-f50c00d32eadddb1f157b06b358ab1e8bd2a76aa.zip |
[alsa] SLX_PREFERRED_SOUND_OUTPUT - HDMI/non-HDMI
When SLX_PREFERRED_SOUND_OUTPUT is set to HDMI, try to configure any
card containing HDMI in its name as the default card. Otherwise, the old
behaviour of picking a card that does *not* contain HDMI is kept.
Diffstat (limited to 'core/modules/alsa/data')
-rwxr-xr-x | core/modules/alsa/data/opt/openslx/scripts/alsa-default_card | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card b/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card index 1e28aa4c..d9120013 100755 --- a/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card +++ b/core/modules/alsa/data/opt/openslx/scripts/alsa-default_card @@ -12,7 +12,7 @@ if [ -w "/etc" ]; then elif [ -n "$HOME" ]; then FILE="${HOME}/.asoundrc" else - FILE="$(getent passwd root | awk -F ':' '{print $6}')/.asoundrc" + FILE="$(getent passwd "$(id -u)" | awk -F ':' '{print $6}')/.asoundrc" fi if [ -e "${FILE}" -a "x$1" != "x--force" ]; then @@ -20,8 +20,12 @@ if [ -e "${FILE}" -a "x$1" != "x--force" ]; then exit 1 fi +GREPOPT="-v" +if [ "x$SLX_PREFERRED_SOUND_OUTPUT" = "xHDMI" ]; then + GREPOPT= +fi # Try to filter HDMI cards first -CARD=$(grep -v -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) +CARD=$(grep $GREPOPT -i 'HDMI' "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) # If empty, try again with all [ -z "${CARD}" ] && CARD=$(cat "${PROC}" | grep -E -o '^[[:space:]]*[0-9]+[[:space:]]+' | head -n 1) |