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 | |
| 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')
| -rw-r--r-- | remote/modules/alsa/data/etc/systemd/system/alsa-default-card.service | 11 | ||||
| -rwxr-xr-x | remote/modules/alsa/data/opt/openslx/scripts/alsa-default_card | 47 |
2 files changed, 58 insertions, 0 deletions
diff --git a/remote/modules/alsa/data/etc/systemd/system/alsa-default-card.service b/remote/modules/alsa/data/etc/systemd/system/alsa-default-card.service new file mode 100644 index 00000000..db35eeb7 --- /dev/null +++ b/remote/modules/alsa/data/etc/systemd/system/alsa-default-card.service @@ -0,0 +1,11 @@ +[Unit] +Description=Set default card ALSA will use +DefaultDependencies=no +After=tmp.target +Wants=tmp.target + +[Service] +Type=oneshot +ExecStart=/opt/openslx/scripts/alsa-default_card +RemainAfterExit=yes + 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 + |
