diff options
| author | Manuel Schneider | 2014-09-30 15:01:05 +0200 |
|---|---|---|
| committer | Manuel Schneider | 2014-09-30 15:01:05 +0200 |
| commit | 930cd28a80eaaf66d499efc72a5f938d6b9d5e6d (patch) | |
| tree | 4056c08a5fa07e117ca05eac223a0e6e2445b76c /remote/modules/alsa/data/opt/openslx/scripts | |
| parent | [cups] Do not accept color jobs on BW printers (diff) | |
| parent | [alsa] Disable alsa config generation - breaks vmware mic input (diff) | |
| download | tm-scripts-930cd28a80eaaf66d499efc72a5f938d6b9d5e6d.tar.gz tm-scripts-930cd28a80eaaf66d499efc72a5f938d6b9d5e6d.tar.xz tm-scripts-930cd28a80eaaf66d499efc72a5f938d6b9d5e6d.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/alsa/data/opt/openslx/scripts')
| -rwxr-xr-x | remote/modules/alsa/data/opt/openslx/scripts/alsa-default_card | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/remote/modules/alsa/data/opt/openslx/scripts/alsa-default_card b/remote/modules/alsa/data/opt/openslx/scripts/alsa-default_card new file mode 100755 index 00000000..4edfcdd5 --- /dev/null +++ b/remote/modules/alsa/data/opt/openslx/scripts/alsa-default_card @@ -0,0 +1,47 @@ +#!/bin/ash + +PROC="/proc/asound/cards" + +if [ ! -r "$PROC" ]; then + echo "'${PROC}' not found or not readable." + exit 1 +fi + +if [ -w "/etc" ]; then + FILE="/etc/asound.conf" +elif [ -n "$HOME" ]; then + FILE="${HOME}/.asoundrc" +else + FILE="$(getent passwd root | awk -F ':' '{print $6}')/.asoundrc" +fi + +if [ -e "${FILE}" -a "x$1" != "x--force" ]; then + echo "'${FILE}' already exists, use --force to overwrite." + exit 1 +fi + +# Try to filter HDMI cards first +CARD=$(grep -v -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) + +if [ -z "${CARD}" ]; then + echo "No sound card found." + exit 1 +fi + +cat > "${FILE}" <<HEREDOC +pcm.!default { + type hw + card $CARD +} +ctl.!default { + type hw + card $CARD +} +timer.!default { + type hw + card $CARD +} +HEREDOC + |
