diff --git a/.alsa-utils.metadata b/.alsa-utils.metadata new file mode 100644 index 0000000..f87edb1 --- /dev/null +++ b/.alsa-utils.metadata @@ -0,0 +1 @@ +dfec4691dde6b2cee292bbd10f0f368158713e8f SOURCES/alsa-utils-1.0.27.2.tar.bz2 diff --git a/README.md b/README.md deleted file mode 100644 index 0e7897f..0000000 --- a/README.md +++ /dev/null @@ -1,5 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 - -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/alsa-delay b/SOURCES/alsa-delay new file mode 100755 index 0000000..a412188 --- /dev/null +++ b/SOURCES/alsa-delay @@ -0,0 +1,979 @@ +#!/bin/bash + +version=0.1.0 +tmpdir=$TMPDIR +if test -z "$tmpdir"; then + tmpdir="/tmp" +fi +tmpdir=$tmpdir/alsa-delay-script + +delay= +pcard= +pdev= +ccard= +cdev= + +yes= +quiet= +clean= +remove= + +pdevice="default:%s" +pdevice_set= +cdevice="plughw:%s,%s,%s" +pctl= +cctl= +one= +arg= +mix= +pa= + +useprocfs=yes + +fuser_prg=fuser +insmod_prg=insmod +rmmod_prg=rmmod +lsmod_prg=lsmod +modprobe_prg=modprobe +chkconfig_prg=chkconfig +systemctl_prg=systemctl +pidof_prg=pidof +alsaloop_prg=alsaloop +amixer_prg=amixer +test -x /sbin/fuser && fuser_prg=/sbin/fuser +test -x /sbin/insmod && insmod_prg=/sbin/insmod +test -x /sbin/rmmod && rmmod_prg=/sbin/rmmod +test -x /sbin/lsmod && lsmod_prg=/sbin/lsmod +test -x /sbin/modprobe && modprobe_prg=/sbin/modprobe +test -x /sbin/chkconfig && chkconfig_prg=/sbin/chkconfig +test -x /bin/systemctl && systemctl_prg=/bin/systemctl +test -x /sbin/pidof && pidof_prg=/sbin/pidof +test -x /usr/bin/alsaloop && alsaloop_prg=/usr/bin/alsaloop +test -x /usr/local/bin/alsaloop && alsaloop_prg=/usr/local/bin/alsaloop +test -x /usr/bin/amixer && amixer_prg=/usr/bin/amixer + +modprobeconf=/etc/modprobe.d/alsa.conf +test -r /etc/modprobe.conf && modprobeconf=/etc/modprobe.conf && useprocfs="" +alsaloopconf=/etc/alsaloop.conf + +test -r modprobe.work && modprobeconf=modprobe.work +test -r modprobe.work && alsaloopconf=alsaloop.conf + +usage() { + echo "Usage: $0 [OPTION]... [[,]]" + cat < is ALSA card index (number) or string card identifier + is ALSA device number + +Use 'aplay -l' to list available cards and devices. + +Operation modes: + -h, --help print this help, then exit + -q, --quiet quiet mode + -y, --yes do not ask any questions - answer is always yes + -c, --clean clean temporary directory and exit + -r, --remove remove the alsa-delay config modifications and exit + --tmpdir= set temporary directory +Alsaloop options: + --pdevice= force playback device + --cdevice= force capture device + --pctl= force playback ctl device + --cctl= force capture ctl device + --one= pass this argument to last thread + --arg= pass this argument to all threads + --mix= redirect ALSA mixer controls to OSS mixer + (default is Master) + --pa Redirect PA to alsaloop + +Note: For devices, the string %s is replaced with the card index + and second string %s is replaced with the device index + and third string %s is replaced the substream index (0-7). + Example: hw:%s,%s,%s (card, device, substream) +EOF +} + +while : +do + case "$1" in + -h|--help) + usage + exit 0 + ;; + -q|--quiet) + quiet=true ;; + -y|--yes) + yes=true ;; + -c|--clean) + clean="full" ;; + -r|--remove) + remove="full" ;; + --tmpdir*) + case "$#,$1" in + *,*=*) + tmpdir=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; + 1,*) + usage ;; + *) + tmpdir="$2" + shift ;; + esac + tmpdir="$tmpdir/alsa-compile-script" + ;; + --pdevice*) + case "$#,$1" in + *,*=*) + pdevice=`expr "z$1" : 'z-[^=]*=\(.*\)'` + pdevice_set=yes ;; + 1,*) + usage ;; + *) + pdevice="$2" + pdevice_set=yes + shift ;; + esac + ;; + --cdevice*) + case "$#,$1" in + *,*=*) + cdevice=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; + 1,*) + usage ;; + *) + cdevice="$2" + shift ;; + esac + ;; + --pctl*) + case "$#,$1" in + *,*=*) + pctl=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; + 1,*) + usage ;; + *) + pctl="$2" + shift ;; + esac + ;; + --cctl*) + case "$#,$1" in + *,*=*) + cctl=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; + 1,*) + usage ;; + *) + cctl="$2" + shift ;; + esac + ;; + --one*) + case "$#,$1" in + *,*=*) + one1=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; + 1,*) + usage ;; + *) + one1="$2" + shift ;; + esac + one="$one $one1" + ;; + --arg*) + case "$#,$1" in + *,*=*) + arg1=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; + 1,*) + usage ;; + *) + arg1="$2" + shift ;; + esac + arg="$arg $arg1" + ;; + --mix*) + case "$#,$1" in + *,*=*) + mix=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; + 1,*) + usage ;; + *) + mix="$2" + shift ;; + esac + arg="$arg $arg1" + ;; + --pa) + pa=true + ;; + *) + if test -n "$1"; then + ok= + if test -z "$delay"; then + delay="$1" + if test "$delay" -lt 1000; then + delay=$[$delay * 1000] + fi + ok=true + fi + if test -z "$ok" -a -z "$pcard"; then + pcard="$1" + ok=true + fi + if test -z "$ok"; then + echo "Unknown parameter '$1'" + break + fi + else + break + fi + ;; + esac + shift +done + +test -z "$pdevice_set" -a -n "$pa" && pdevice="plug:dmix:%s" +test -z "$delay" && delay="50000" +test -z "$pcard" && pcard="1" +pdev=$(echo $pcard | cut -s -d , -f 2) +pcard=$(echo $pcard | cut -d , -f 1) +test -z "$pdev" && pdev="0" +test -z "$ccard" && ccard="Loopback,1" +cdev=$(echo $ccard | cut -s -d , -f 2) +ccard=$(echo $ccard | cut -d , -f 1) +test -z "$cdev" && cdev="0" + +# Echo "true" or "false", depending on $yes and user response to prompt +# $1 is prompt message +question_bool() { + if test "$yes" = "yes"; then + echo "true" + else + echo >&2 -n "$1 (Y/ ) " + read i + local i=${i:0:1} + if test "$i" = "Y" -o "$i" = "y"; then + echo "true" + else + echo "false" + fi + fi +} + +# Safe exit +safe_exit() { + if test -r /etc/pulse/client.conf ; then + if grep "# alsa-delay-line-to-be-removed-1234" /etc/pulse/client.conf 2> /dev/null > /dev/null ; then + grep -v alsa-delay-line-to-be-removed-1234 /etc/pulse/client.conf > /etc/pulse/client.conf.new + if test -s /etc/pulse/client.conf.new; then + mv /etc/pulse/client.conf.new /etc/pulse/client.conf + fi + fi + fi + exit $1 +} + +# Log and execute $@ and check success +do_cmd() { + if test -z "$quiet"; then + echo "> $@" + fi + $@ || safe_exit 1 +} + +# Cache or restore $protocol and $url and $package in $tmpdir +check_environment() { + if ! test -d $tmpdir ; then + mkdir -p $tmpdir + if ! test -d $tmpdir; then + echo >&2 "Unable to create directory $tmpdir." + exit 1 + fi + fi + echo "Using temporary tree: $tmpdir" + test -x /bin/depmod && depmodbin=/bin/depmod + test -x /sbin/depmod && depmodbin=/sbin/depmod + if test -z "$depmodbin"; then + echo >&2 "Unable to find depmod utility." + exit 1 + fi + test -x /bin/modinfo && modinfobin=/bin/modinfo + test -x /sbin/modinfo && modinfobin=/sbin/modinfo + if test -z "$modinfobin"; then + echo >&2 "Unable to find modinfo utility." + exit 1 + fi +} + +# Kill processes currently accessing the audio devices +kill_audio_apps() { + local pids0=$($fuser_prg /dev/snd/* 2> /dev/null) + local pids1=$($fuser_prg /dev/mixer* 2> /dev/null) + local pids2=$($fuser_prg /dev/sequencer* 2> /dev/null) + local pids= + for pid in $pids0 $pids1 $pids2; do + local pids="$pids $pid" + done + if ! test -z "$pids"; then + echo + echo "WARNING! An audio application uses ALSA driver:" + echo + for pid in $pids; do + ps --no-headers -p $pids || safe_exit 1 + done + echo + if test $(question_bool "Would you like to kill these apps?") = "true"; then + if test -w /etc/pulse/client.conf ; then + echo "autospawn = no # alsa-delay-line-to-be-removed-1234" >> /etc/pulse/client.conf + fi + for pid in $pids; do + do_cmd kill $pid + done + sleep 2 + local killed= + for pid in $pids; do + local a=$(ps --no-headers -p $pids) + if test -n "$a"; then + do_cmd kill -9 $pid + local killed="true" + fi + done + if test "$killed" = "true"; then + sleep 2 + for pid in $pids; do + local a=$(ps --no-headers -p $pids) + if test -n "$a"; then + echo >&2 "Unable to kill application:" + echo >&2 " $a" + safe_exit 1 + fi + done + fi + else + echo >&2 "Cannot continue with running audio applications." + safe_exit 1 + fi + fi +} + +# Echo the list of configured sound modules +configured_modules() { + if test -z "$useprocfs"; then + cat $modprobeconf | grep -E "^alias snd-card-" | cut -d ' ' -f 3 + else + cat /proc/asound/modules | colrm 1 3 + fi +} + +# Echo the list of loaded sound modules +current_modules() { + $lsmod_prg | cut -d ' ' -f 1 | grep -E "^(snd[_-])" +} + +# The loopback kernel driver detection +aloop_present() { + if test -r /proc/asound/card0/id; then + local id=$(cat /proc/asound/card0/id) + else + local id="" + fi + if test "$id" = "Loopback"; then + echo "yes" + fi +} + +# Remove kernel modules, using two phases +# $@ is module names +my_rmmod() { + local phase2= + while test -n "$1"; do + if ! $rmmod_prg $1 2> /dev/null > /dev/null; then + local phase2="$phase2 $1" + else + echo "> rmmod $1" + fi + shift + done + for mod in $phase2; do + echo "> rmmod $mod" + if ! $rmmod_prg $mod ; then + echo >&2 "Unable to remove kernel module $mod." + safe_exit 1 + fi + done +} + +# Reload kernel modules +kernel_modules() { + kill_audio_apps + if test "$1" = "unload"; then + local present=$(aloop_present) + if test "$present" = "yes"; then + if ! $rmmod_prg snd-aloop; then + echo >&2 "Unable to remove kernel module snd-aloop." + safe_exit 1 + fi + fi + fi + local curmods=$(current_modules) + local usermods=$(configured_modules) + my_rmmod $curmods + $modprobe_prg soundcore || safe_exit 1 + if test "$1" = "load"; then + if ! $modprobe_prg snd-aloop; then + echo >&2 "Unable to install kernel module snd-aloop." + safe_exit 1 + fi + fi + for mod in $usermods; do + if ! $modprobe_prg $mod; then + echo >&2 "Unable to install kernel module $mod." + safe_exit 1 + fi + done + echo "Kernel modules ready:" + cat /proc/asound/cards + sleep 0.5 +} + +# If $package is alsa-driver then remove current modules +kernel_modules_remove() { + local curmods=$(current_modules) + if test -z "$curmods"; then + echo "No ALSA kernel modules to remove." + safe_exit 0 + fi + kill_audio_apps + my_rmmod $curmods + echo "ALSA kernel modules removed." +} + +function clean() { + echo -n "Removing tree $tmpdir:" + if test -d "$tmpdir"; then + if ! rm -rf "$tmpdir"; then + echo " failed" + safe_exit 1 + fi + fi + echo " success" +} + +function reindex_modprobe_conf() { + if test -z "$useprocfs"; then + cat > $tmpdir/run.awk < 1) + printf(",") + printf("%i", c) + } + continue + } + printf(" %s", l[i]) + } + printf("\n") + } else if (l[1] == "remove") { + printf(l[1]) + flag = 0 + for (i = 2; i <= length(l); i++) { + if (l[i] == "/usr/sbin/alsactl" || l[i] == "store") { + flag++; + printf(" %s", l[i]); + continue; + } + if (flag == 2) { + c = int(l[i]) + 1; + printf(" %i", c); + flag = 0; + continue; + } + flag = 0; + printf(" %s", l[i]); + } + printf("\n") + } else { + print line + } +} + +BEGIN { aloop=0; } +/alias snd-card-0 snd-aloop/ { aloop=1; next; } +/options snd-card-0 index=0/ { if (aloop) next; } +/options snd-aloop/ { next; } +/alias snd-card-/ { rewrite_line(\$0); next; } +/options snd-/ { rewrite_line(\$0); next; } +/remove snd-/ { rewrite_line(\$0); next; } + { print \$0; } +EOF + cat $modprobeconf | awk -f $tmpdir/run.awk > $modprobeconf.new + rm $tmpdir/run.awk || safe_exit 1 + else + local index=1 + echo -n "" > $modprobeconf.new + declare -a modules printed + for mod in $(cat /proc/asound/modules | grep -Ev "^2[6789]" | colrm 1 3); do + if test "$mod" != "snd_aloop" -a "$mod" != "snd-aloop"; then + if test -z ${modules[$mod]}; then + modules[$mod]=$index + else + modules[$mod]="${modules[mod]},$index" + fi + echo "alias snd-card-$index $mod" >> $modprobeconf.new + echo "options snd-card-$index index=$index" >> $modprobeconf.new + fi + index=$(expr $index + 1) + done + for mod in $(cat /proc/asound/modules | grep -Ev "^2[6789]" | colrm 1 3); do + if test "$mod" != "snd_aloop" -a "$mod" != "snd-aloop"; then + if test -z ${printed[$mod]}; then + echo "options $mod index=${modules[$mod]}" >> $modprobeconf.new + printed[$mod]=yes + fi + fi + done + fi +cat >> $modprobeconf.new < /dev/null | grep -E "^alias snd-card-0 snd-aloop") + local present=$(aloop_present) + if test -n "$check"; then + echo "Module snd-aloop is already installed." + if ! test "$present" = "yes"; then + kernel_modules load + fi + else + reindex_modprobe_conf + if ! test "$present" = "yes"; then + kernel_modules load + else + kernel_modules + fi + fi +} + +function myprintf() { + local cnt=$(echo "$1" | grep -o "%" | wc -l) + if test $cnt -eq 1; then + printf "$1" "$2" + else if test $cnt -eq 2; then + printf "$1" "$2" "$3" + else + printf "$1" "$2" "$3" "$4" + fi + fi +} + +function check_ctl_name() { + $amixer_prg -D "$1" contents | grep "name='$2'" +} + +function check_oss_mixer() { + grep ": mixer" /proc/asound/oss/devices +} + +function get_card_id() { + $amixer_prg -D "$1" info | head -1 | cut -d '/' -f 1 | cut -d ' ' -f 3- | awk '{ print substr($0, 2, length($0)-2) }' +} + +function generate_alsaloop_line() { + local file="$1" + local idx="$2" + local carg=$(myprintf "$cdevice" $ccard $cdev $idx) + local parg=$(myprintf "$pdevice" $pcard $pdev $idx) + local res="-C $carg -P $parg -T $idx -t $delay" + if test -n "$cctl"; then + local carg=$(myprintf "$cctl" $pcard $cdev $idx) + local res="$res -Y $carg" + fi + if test -n "$pctl"; then + local parg=$(myprintf "$pctl" $pcard $pdev $idx) + local res="$res -X $parg" + fi + if test -n "$arg"; then + local res="$res $arg" + fi + if test $idx -eq 7; then + if test -n "$one"; then + local res="$res $one" + fi + if test -z "$pctl"; then + local res="$res -X hw:$pcard" + fi + local mymix="$mix" + if test -z "$mymix"; then + local mymix="Master" + for mymix in Master "Master Mono" Headphone Headphone2 PCM Speaker \ + "Desktop Speaker" Beep Front Rear Center LFE Side \ + Surround ; do + local check=$(check_ctl_name hw:$pcard "$mymix Playback Switch") + if test -n "$check"; then + local res="$res -m \"name='$mymix Playback Switch'\"" + fi + local check=$(check_ctl_name hw:$pcard "$mymix Playback Volume") + if test -n "$check"; then + local res="$res -m \"name='$mymix Playback Volume'\"" + fi + done + else + local check=$(check_ctl_name hw:$pcard "$mymix Playback Switch") + if test -n "$check"; then + local res="$res -m \"name='$mymix Playback Switch'\"" + fi + local check=$(check_ctl_name hw:$pcard "$mymix Playback Volume") + if test -n "$check"; then + local res="$res -m \"name='$mymix Playback Volume'\"" + fi + fi + local check=$(check_oss_mixer) + if test -n "$check"; then + local res="$res -O \"$mymix@VOLUME\"" + fi + fi + echo $res >> $file +} + +function generate_alsaloop_conf() { + local idx=0 + rm -f $alsaloopconf.new + while test $idx -lt 8; do + generate_alsaloop_line $alsaloopconf.new $idx + idx=$(expr $idx + 1) + done + mv $alsaloopconf.new $alsaloopconf || safe_exit 1 +} + +function kill_alsaloop() { + local pid=$($pidof_prg alsaloop) + if test -n "$pid"; then + echo "Killing alsaloop..." + fi + while test -n "$pid"; do + kill $pid + sleep 0.01 + pid=$($pidof_prg alsaloop) + done +} + +function restart_alsaloop() { + echo "Restarting alsaloop: delay $delay us." + if test -d /etc/systemd/system; then + systemctl start alsaloop.service + else + /etc/init.d/alsaloop start + fi + sleep 0.4 + local pid=$($pidof_prg alsaloop) + if test -z "$pid"; then + echo "ERROR: Not started, check /var/log/messages for details" + else + if test -d /etc/systemd/system; then + systemctl status alsaloop.service + else + ps -p $pid + fi + fi +} + +function create_systemd_service() { + if test -r /etc/systemd/system/alsaloop.service; then + echo "/etc/systemd/system/alsaloop.service exists" + else + cat >> /etc/systemd/system/alsaloop.service <> /etc/init.d/alsaloop < + +# For RedHat and cousins: +# chkconfig: 2345 99 01 +# description: Start alsaloop daemon +# processname: alsaloop + +### BEGIN INIT INFO +# Provides: alsaloop +# Required-Start: \$local_fs +# Required-Stop: \$local_fs +# Should-Start: +# Short-Description: ALSALOOP +# Description: ALSALOOP +### END INIT INFO + +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. +# You should have received a copy of the GNU General Public License (for +# example COPYING); if not, write to the Free Software Foundation, Inc., 675 +# Mass Ave, Cambridge, MA 02139, USA. +# This code was originally developed as a Senior Thesis by Michael Cornwell +# at the Concurrent Systems Laboratory (now part of the Storage Systems +# Research Center), Jack Baskin School of Engineering, University of +# California, Santa Cruz. http://ssrc.soe.ucsc.edu/. + +alsaloop_opts="--daemonize --workaround serialopen --config $alsaloopconf" + +ALSALOOP_BIN=/usr/bin/alsaloop +test -x /usr/local/bin/alsaloop && ALSALOOP_BIN=/usr/local/bin/alsaloop + +# Source function library +. /etc/rc.d/init.d/functions + +RETVAL=0 +prog=alsaloop +pidfile=/var/lock/subsys/alsaloop + +start() +{ + modprobe snd-aloop + echo -n \$"Starting \$prog: " + daemon \$ALSALOOP_BIN \$alsaloop_opts + RETVAL=\$? + echo + [ \$RETVAL = 0 ] && touch \$pidfile + return \$RETVAL +} + +stop() +{ + echo -n \$"Shutting down \$prog: " + killproc \$ALSALOOP_BIN + RETVAL=\$? + echo + rm -f \$pidfile + return \$RETVAL +} + +case "\$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop + start + ;; + try-restart) + if [ -f \$pidfile ]; then + stop + start + fi + ;; + status) + status $prog + RETVAL=$? + ;; + *) + echo \$"Usage: \$0 {start|stop|restart|try-restart}" + RETVAL=3 +esac + +exit \$RETVAL +EOF + chmod 755 /etc/init.d/alsaloop || safe_exit 1 + $chkconfig_prg --add alsaloop + $chkconfig_prg alsaloop on + fi +} + +function modify_pa_conf() { + + if grep Loopback /etc/pulse/default.pa > /dev/null; then + echo "/etc/pulse/default.pa already modified" + else + if test -f /etc/pulse/default.pa; then + local pcardid=$(get_card_id "hw:$pcard") + if ! test -f /etc/pulse/default.pa.alsa-delay.save ; then + cp /etc/pulse/default.pa /etc/pulse/default.pa.alsa-delay.save + fi + cat /etc/pulse/default.pa | \ + sed -e 's/^load-module module-udev-detect/#load-module module-udev-detect # commented by alsa-delay/' \ + -e 's/^load-module module-detect/#load-module module-detect # commented by alsa-delay/' \ + -e "s/^### Automatically load driver modules for Bluetooth hardware/load-module module-alsa-card device_id=Loopback\nload-module module-alsa-card device_id=$pcardid\n\n### Automatically load driver modules for Bluetooth hardware/" > /etc/pulse/default.pa.new + if test -s /etc/pulse/default.pa.new; then + mv /etc/pulse/default.pa.new /etc/pulse/default.pa + echo "/etc/pulse/default.pa changed" + fi + fi + fi + + local file= + local asoundconf= + if test -d /etc/alsa -a -f /etc/alsa/pulse-default.conf; then + file=/etc/alsa/alsaloop-default.conf + asoundconf=yes + fi + if test -f /usr/share/alsa/alsa.conf.d/99-pulseaudio-default.conf ; then + file=/usr/share/alsa/alsa.conf.d/A0-alsaloop-default.conf + fi + if test -z "$file"; then + echo "unknown PulseAudio setup (asound.conf)" + elif test -f $file; then + echo "$file exists" + else + cat >> $file < /etc/asound.conf.new + if test -s /etc/asound.conf.new; then + mv /etc/asound.conf.new /etc/asound.conf + fi + fi + fi +} + +function remove() { + if test -f /etc/pulse/default.pa.alsa-delay.save ; then + echo "Restoring /etc/pulse/default.pa" + mv /etc/pulse/default.pa.alsa-delay.save /etc/pulse/default.pa + fi + if test -f /etc/init.d/alsaloop ; then + echo "Removing /etc/init.d/alsaloop service" + $chkconfig_prg alsaloop off + $chkconfig_prg --del alsaloop + rm /etc/init.d/alsaloop + fi + if test -f /etc/systemd/system/alsaloop.service ; then + echo "Removing /etc/systemd/system/alsaloop.service" + $systemctl_prg disable alsaloop.service + rm /etc/systemd/system/alsaloop.service + fi + if test -f $alsaloopconf ; then + echo "Removing $alsaloopconf" + rm $alsaloopconf + fi + if test -f /etc/alsa/alsaloop-default.conf ; then + echo "Removing /etc/alsa/alsaloop-default.conf" + rm /etc/alsa/alsaloop-default.conf + fi + if test -f /usr/share/alsa/alsa.conf.d/A0-alsaloop-default.conf ; then + echo "Removing /usr/share/alsa/alsa.conf.d/A0-alsaloop-default.conf" + rm /usr/share/alsa/alsa.conf.d/A0-alsaloop-default.conf + fi + if grep "alsaloop-default.conf" /etc/asound.conf > /dev/null 2> /dev/null ; then + echo "Modifying /etc/asound.conf" + cat /etc/asound.conf | sed 's/alsaloop-default.conf/pulse-default.conf/g' > /etc/asound.conf.new + if test -s /etc/asound.conf.new; then + mv /etc/asound.conf.new /etc/asound.conf + fi + fi + if test -f $modprobeconf.alsa-delay.save ; then + echo "Restoring $modprobeconf" + if test -s $modprobeconf.alsa-delay.save ; then + mv $modprobeconf.alsa-delay.save $modprobeconf + else + rm $modprobeconf.alsa-delay.save + rm $modprobeconf + fi + fi + if test $(aloop_present) = "yes"; then + kernel_modules unload + fi +} + +rundir=$(pwd) +export LC_ALL=C +export LANGUAGE=C + +check_environment + +if test -n "$clean"; then + clean + safe_exit 0 +fi + +if test -n "$remove"; then + kill_alsaloop + remove + clean + safe_exit 0 +fi + +kill_alsaloop +if test -d /etc/systemd/system ; then + create_systemd_service +else + create_initd +fi +modify_modprobe_conf +generate_alsaloop_conf +if test -n "$pa"; then + modify_pa_conf +fi +restart_alsaloop + +clean + +safe_exit 0 diff --git a/SOURCES/alsa-info.sh b/SOURCES/alsa-info.sh new file mode 100644 index 0000000..9d996aa --- /dev/null +++ b/SOURCES/alsa-info.sh @@ -0,0 +1,930 @@ +#!/bin/bash + +SCRIPT_VERSION=0.4.62 +CHANGELOG="http://www.alsa-project.org/alsa-info.sh.changelog" + +################################################################################# +#Copyright (C) 2007 Free Software Foundation. + +#This program is free software; you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation; either version 2 of the License, or +#(at your option) any later version. + +#This program is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with this program; if not, write to the Free Software +#Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +################################################################################## + +#The script was written for 2 main reasons: +# 1. Remove the need for the devs/helpers to ask several questions before we can easily help the user. +# 2. Allow newer/inexperienced ALSA users to give us all the info we need to help them. + +#Set the locale (this may or may not be a good idea.. let me know) +export LC_ALL=C + +#Change the PATH variable, so we can run lspci (needed for some distros) +PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin +BGTITLE="ALSA-Info v $SCRIPT_VERSION" +PASTEBINKEY="C9cRIO8m/9y8Cs0nVs0FraRx7U0pHsuc" +#Define some simple functions + +pbcheck(){ + [[ $UPLOAD = "no" ]] && return + + if [[ -z $PASTEBIN ]]; then + [[ $(ping -c1 www.alsa-project.org) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes" + else + [[ $(ping -c1 www.pastebin.ca) ]] || KEEP_FILES="yes" UPLOAD="no" PBERROR="yes" + fi +} + +update() { + SHFILE=`mktemp -t alsa-info.XXXXXXXXXX` || exit 1 + wget -O $SHFILE "http://www.alsa-project.org/alsa-info.sh" >/dev/null 2>&1 + REMOTE_VERSION=`grep SCRIPT_VERSION $SHFILE |head -n1 |sed 's/.*=//'` + if [ "$REMOTE_VERSION" != "$SCRIPT_VERSION" ]; then + if [[ -n $DIALOG ]] + then + OVERWRITE= + if [ -w $0 ]; then + dialog --yesno "Newer version of ALSA-Info has been found\n\nDo you wish to install it?\nNOTICE: The original file $0 will be overwritten!" 0 0 + DIALOG_EXIT_CODE=$? + if [[ $DIALOG_EXIT_CODE = 0 ]]; then + OVERWRITE=yes + fi + fi + if [ -z "$OVERWRITE" ]; then + dialog --yesno "Newer version of ALSA-Info has been found\n\nDo you wish to download it?" 0 0 + DIALOG_EXIT_CODE=$? + fi + if [[ $DIALOG_EXIT_CODE = 0 ]] + then + echo "Newer version detected: $REMOTE_VERSION" + echo "To view the ChangeLog, please visit $CHANGELOG" + if [ "$OVERWRITE" = "yes" ]; then + cp $SHFILE $0 + echo "ALSA-Info script has been updated to v $REMOTE_VERSION" + echo "Please re-run the script" + rm $SHFILE 2>/dev/null + else + echo "ALSA-Info script has been downloaded as $SHFILE." + echo "Please re-run the script from new location." + fi + exit + else + rm $SHFILE 2>/dev/null + fi + else + echo "Newer version detected: $REMOTE_VERSION" + echo "To view the ChangeLog, please visit $CHANGELOG" + if [ -w $0 ]; then + echo "The original file $0 will be overwritten!" + echo -n "If you do not like to proceed, press Ctrl-C now.." ; read inp + cp $SHFILE $0 + echo "ALSA-Info script has been updated. Please re-run it." + rm $SHFILE 2>/dev/null + else + echo "ALSA-Info script has been downloaded $SHFILE." + echo "Please, re-run it from new location." + fi + exit + fi + else + rm $SHFILE 2>/dev/null + fi +} + +cleanup() { + if [ -n "$TEMPDIR" -a "$KEEP_FILES" != "yes" ]; then + rm -rf "$TEMPDIR" 2>/dev/null + fi + test -n "$KEEP_OUTPUT" || rm -f "$NFILE" +} + + +withaplay() { + echo "!!Aplay/Arecord output" >> $FILE + echo "!!--------------------" >> $FILE + echo "" >> $FILE + echo "APLAY" >> $FILE + echo "" >> $FILE + aplay -l >> $FILE 2>&1 + echo "" >> $FILE + echo "ARECORD" >> $FILE + echo "" >> $FILE + arecord -l >> $FILE 2>&1 + echo "" >> $FILE +} + +withlsmod() { + echo "!!All Loaded Modules" >> $FILE + echo "!!------------------" >> $FILE + echo "" >> $FILE + lsmod |awk {'print $1'} >> $FILE + echo "" >> $FILE + echo "" >> $FILE +} + +withamixer() { + echo "!!Amixer output" >> $FILE + echo "!!-------------" >> $FILE + echo "" >> $FILE + for i in `grep "]: " /proc/asound/cards | awk -F ' ' '{ print $1} '` ; do + CARD_NAME=`grep "^ *$i " $TEMPDIR/alsacards.tmp|awk {'print $2'}` + echo "!!-------Mixer controls for card $i $CARD_NAME]" >> $FILE + echo "" >>$FILE + amixer -c$i info>> $FILE 2>&1 + amixer -c$i>> $FILE 2>&1 + echo "" >> $FILE + done + echo "" >> $FILE +} + +withalsactl() { + echo "!!Alsactl output" >> $FILE + echo "!!--------------" >> $FILE + echo "" >> $FILE + exe="" + if [ -x /usr/sbin/alsactl ]; then + exe="/usr/sbin/alsactl" + fi + if [ -x /usr/local/sbin/alsactl ]; then + exe="/usr/local/sbin/alsactl" + fi + if [ -z "$exe" ]; then + exe=`whereis alsactl | cut -d ' ' -f 2` + fi + $exe -f $TEMPDIR/alsactl.tmp store + echo "--startcollapse--" >> $FILE + cat $TEMPDIR/alsactl.tmp >> $FILE + echo "--endcollapse--" >> $FILE + echo "" >> $FILE + echo "" >> $FILE +} + +withdevices() { + echo "!!ALSA Device nodes" >> $FILE + echo "!!-----------------" >> $FILE + echo "" >> $FILE + ls -la /dev/snd/* >> $FILE + echo "" >> $FILE + echo "" >> $FILE +} + +withconfigs() { +if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] || [[ -e $HOME/.asoundrc.asoundconf ]] +then + echo "!!ALSA configuration files" >> $FILE + echo "!!------------------------" >> $FILE + echo "" >> $FILE + + #Check for ~/.asoundrc + if [[ -e $HOME/.asoundrc ]] + then + echo "!!User specific config file (~/.asoundrc)" >> $FILE + echo "" >> $FILE + cat $HOME/.asoundrc >> $FILE + echo "" >> $FILE + echo "" >> $FILE + fi + #Check for .asoundrc.asoundconf (seems to be Ubuntu specific) + if [[ -e $HOME/.asoundrc.asoundconf ]] + then + echo "!!asoundconf-generated config file" >> $FILE + echo "" >> $FILE + cat $HOME/.asoundrc.asoundconf >> $FILE + echo "" >> $FILE + echo "" >> $FILE + fi + #Check for /etc/asound.conf + if [[ -e /etc/asound.conf ]] + then + echo "!!System wide config file (/etc/asound.conf)" >> $FILE + echo "" >> $FILE + cat /etc/asound.conf >> $FILE + echo "" >> $FILE + echo "" >> $FILE + fi +fi +} + +withsysfs() { + local i f + local printed="" + for i in /sys/class/sound/*; do + case "$i" in + */hwC?D?) + if [ -f $i/init_pin_configs ]; then + if [ -z "$printed" ]; then + echo "!!Sysfs Files" >> $FILE + echo "!!-----------" >> $FILE + echo "" >> $FILE + fi + for f in init_pin_configs driver_pin_configs user_pin_configs init_verbs hints; do + echo "$i/$f:" >> $FILE + cat $i/$f >> $FILE + echo >> $FILE + done + printed=yes + fi + ;; + esac + done + if [ -n "$printed" ]; then + echo "" >> $FILE + fi +} + +withdmesg() { + echo "!!ALSA/HDA dmesg" >> $FILE + echo "!!--------------" >> $FILE + echo "" >> $FILE + dmesg | grep -C1 -E 'ALSA|HDA|HDMI|sound|hda.codec|hda.intel' >> $FILE + echo "" >> $FILE + echo "" >> $FILE +} + +withall() { + withdevices + withconfigs + withaplay + withamixer + withalsactl + withlsmod + withsysfs + withdmesg +} + +get_alsa_library_version() { + ALSA_LIB_VERSION=`grep VERSION_STR /usr/include/alsa/version.h 2>/dev/null|awk {'print $3'}|sed 's/"//g'` + + if [ -z "$ALSA_LIB_VERSION" ]; then + if [ -f /etc/lsb-release ]; then + . /etc/lsb-release + case "$DISTRIB_ID" in + Ubuntu) + if which dpkg > /dev/null ; then + ALSA_LIB_VERSION=`dpkg -l libasound2 | tail -1 | awk '{print $3}' | cut -f 1 -d -` + fi + + if [ "$ALSA_LIB_VERSION" = "" ]; then + ALSA_LIB_VERSION="" + fi + return + ;; + *) + return + ;; + esac + elif [ -f /etc/debian_version ]; then + if which dpkg > /dev/null ; then + ALSA_LIB_VERSION=`dpkg -l libasound2 | tail -1 | awk '{print $3}' | cut -f 1 -d -` + fi + + if [ "$ALSA_LIB_VERSION" = "" ]; then + ALSA_LIB_VERSION="" + fi + return + fi + fi +} + + +#Run checks to make sure the programs we need are installed. +LSPCI=$(which lspci 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null); +TPUT=$(which tput 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null); +DIALOG=$(which dialog 2>/dev/null | sed 's|^[^/]*||' 2>/dev/null); + +#Check to see if sysfs is enabled in the kernel. We'll need this later on +SYSFS=$(mount |grep sysfs|awk {'print $3'}); + +#Check modprobe config files for sound related options +SNDOPTIONS=$(modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p') + +KEEP_OUTPUT= +NFILE="" + +PASTEBIN="" +WWWSERVICE="www.alsa-project.org" +WELCOME="yes" +PROCEED="yes" +UPLOAD="ask" +REPEAT="" +while [ -z "$REPEAT" ]; do +REPEAT="no" +case "$1" in + --update|--help|--about) + WELCOME="no" + PROCEED="no" + ;; + --upload) + UPLOAD="yes" + WELCOME="no" + ;; + --no-upload) + UPLOAD="no" + WELCOME="no" + ;; + --pastebin) + PASTEBIN="yes" + WWWSERVICE="pastebin" + ;; + --no-dialog) + DIALOG="" + REPEAT="" + shift + ;; + --stdout) + DIALOG="" + UPLOAD="no" + WELCOME="no" + TOSTDOUT="yes" + ;; +esac +done + + +#Script header output. +if [ "$WELCOME" = "yes" ]; then +greeting_message="\ + +This script visits the following commands/files to collect diagnostic +information about your ALSA installation and sound related hardware. + + dmesg + lspci + lsmod + aplay + amixer + alsactl + /proc/asound/ + /sys/class/sound/ + ~/.asoundrc (etc.) + +See '$0 --help' for command line options. +" +if [ -n "$DIALOG" ]; then + dialog --backtitle "$BGTITLE" \ + --title "ALSA-Info script v $SCRIPT_VERSION" \ + --msgbox "$greeting_message" 20 80 +else + echo "ALSA Information Script v $SCRIPT_VERSION" + echo "--------------------------------" + echo "$greeting_message" +fi # dialog +fi # WELCOME + +#Set the output file +TEMPDIR=`mktemp -t -d alsa-info.XXXXXXXXXX` || exit 1 +FILE="$TEMPDIR/alsa-info.txt" +if [ -z "$NFILE" ]; then + NFILE=`mktemp -t alsa-info.txt.XXXXXXXXXX` || exit 1 +fi + +trap cleanup 0 + +if [ "$PROCEED" = "yes" ]; then + +if [ -z "$LSPCI" ]; then + echo "This script requires lspci. Please install it, and re-run this script." + exit 0 +fi + +#Fetch the info and store in temp files/variables +DISTRO=`grep -ihs "buntu\|SUSE\|Fedora\|PCLinuxOS\|MEPIS\|Mandriva\|Debian\|Damn\|Sabayon\|Slackware\|KNOPPIX\|Gentoo\|Zenwalk\|Mint\|Kubuntu\|FreeBSD\|Puppy\|Freespire\|Vector\|Dreamlinux\|CentOS\|Arch\|Xandros\|Elive\|SLAX\|Red\|BSD\|KANOTIX\|Nexenta\|Foresight\|GeeXboX\|Frugalware\|64\|SystemRescue\|Novell\|Solaris\|BackTrack\|KateOS\|Pardus" /etc/{issue,*release,*version}` +KERNEL_VERSION=`uname -r` +KERNEL_PROCESSOR=`uname -p` +KERNEL_MACHINE=`uname -m` +KERNEL_OS=`uname -o` +[[ `uname -v | grep SMP` ]] && KERNEL_SMP="Yes" || KERNEL_SMP="No" +ALSA_DRIVER_VERSION=`cat /proc/asound/version |head -n1|awk {'print $7'} |sed 's/\.$//'` +get_alsa_library_version +ALSA_UTILS_VERSION=`amixer -v |awk {'print $3'}` +VENDOR_ID=`lspci -vn | grep 040[1-3] | awk -F':' '{print $3}'| awk {'print substr($0, 2);}' >$TEMPDIR/vendor_id.tmp` +DEVICE_ID=`lspci -vn | grep 040[1-3] | awk -F':' '{print $4}'| awk {'print $1'} >$TEMPDIR/device_id.tmp` +LAST_CARD=$((`grep "]: " /proc/asound/cards | wc -l` - 1 )) + +ESDINST=$(which esd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null) +PAINST=$(which pulseaudio 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null) +ARTSINST=$(which artsd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null) +JACKINST=$(which jackd 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null) +ROARINST=$(which roard 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null) +DMIDECODE=$(which dmidecode 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null) + +#Check for DMI data +if [ -d /sys/class/dmi/id ]; then + # No root privileges are required when using sysfs method + DMI_SYSTEM_MANUFACTURER=$(cat /sys/class/dmi/id/sys_vendor 2>/dev/null) + DMI_SYSTEM_PRODUCT_NAME=$(cat /sys/class/dmi/id/product_name 2>/dev/null) + DMI_SYSTEM_PRODUCT_VERSION=$(cat /sys/class/dmi/id/product_version 2>/dev/null) + DMI_SYSTEM_FIRMWARE_VERSION=$(cat /sys/class/dmi/id/bios_version 2>/dev/null) +elif [ -x $DMIDECODE ]; then + DMI_SYSTEM_MANUFACTURER=$($DMIDECODE -s system-manufacturer 2>/dev/null) + DMI_SYSTEM_PRODUCT_NAME=$($DMIDECODE -s system-product-name 2>/dev/null) + DMI_SYSTEM_PRODUCT_VERSION=$($DMIDECODE -s system-version 2>/dev/null) + DMI_SYSTEM_FIRMWARE_VERSION=$($DMIDECODE -s bios-version 2>/dev/null) +fi + +cat /proc/asound/modules 2>/dev/null|awk {'print $2'}>$TEMPDIR/alsamodules.tmp +cat /proc/asound/cards >$TEMPDIR/alsacards.tmp +lspci |grep -i "multi\|audio">$TEMPDIR/lspci.tmp + +#Check for HDA-Intel cards codec#* +cat /proc/asound/card*/codec\#* > $TEMPDIR/alsa-hda-intel.tmp 2> /dev/null + +#Check for AC97 cards codec +cat /proc/asound/card*/codec97\#0/ac97\#0-0 > $TEMPDIR/alsa-ac97.tmp 2> /dev/null +cat /proc/asound/card*/codec97\#0/ac97\#0-0+regs > $TEMPDIR/alsa-ac97-regs.tmp 2> /dev/null + +#Check for USB mixer setup +cat /proc/asound/card*/usbmixer > $TEMPDIR/alsa-usbmixer.tmp 2> /dev/null + +#Fetch the info, and put it in $FILE in a nice readable format. +if [[ -z $PASTEBIN ]]; then +echo "upload=true&script=true&cardinfo=" > $FILE +else +echo "name=$USER&type=33&description=/tmp/alsa-info.txt&expiry=&s=Submit+Post&content=" > $FILE +fi +echo "!!################################" >> $FILE +echo "!!ALSA Information Script v $SCRIPT_VERSION" >> $FILE +echo "!!################################" >> $FILE +echo "" >> $FILE +echo "!!Script ran on: `LANG=C TZ=UTC date`" >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Linux Distribution" >> $FILE +echo "!!------------------" >> $FILE +echo "" >> $FILE +echo $DISTRO >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!DMI Information" >> $FILE +echo "!!---------------" >> $FILE +echo "" >> $FILE +echo "Manufacturer: $DMI_SYSTEM_MANUFACTURER" >> $FILE +echo "Product Name: $DMI_SYSTEM_PRODUCT_NAME" >> $FILE +echo "Product Version: $DMI_SYSTEM_PRODUCT_VERSION" >> $FILE +echo "Firmware Version: $DMI_SYSTEM_FIRMWARE_VERSION" >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Kernel Information" >> $FILE +echo "!!------------------" >> $FILE +echo "" >> $FILE +echo "Kernel release: $KERNEL_VERSION" >> $FILE +echo "Operating System: $KERNEL_OS" >> $FILE +echo "Architecture: $KERNEL_MACHINE" >> $FILE +echo "Processor: $KERNEL_PROCESSOR" >> $FILE +echo "SMP Enabled: $KERNEL_SMP" >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!ALSA Version" >> $FILE +echo "!!------------" >> $FILE +echo "" >> $FILE +echo "Driver version: $ALSA_DRIVER_VERSION" >> $FILE +echo "Library version: $ALSA_LIB_VERSION" >> $FILE +echo "Utilities version: $ALSA_UTILS_VERSION" >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Loaded ALSA modules" >> $FILE +echo "!!-------------------" >> $FILE +echo "" >> $FILE +cat $TEMPDIR/alsamodules.tmp >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Sound Servers on this system" >> $FILE +echo "!!----------------------------" >> $FILE +echo "" >> $FILE +if [[ -n $PAINST ]];then +[[ `pgrep '^(.*/)?pulseaudio$'` ]] && PARUNNING="Yes" || PARUNNING="No" +echo "Pulseaudio:" >> $FILE +echo " Installed - Yes ($PAINST)" >> $FILE +echo " Running - $PARUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -n $ESDINST ]];then +[[ `pgrep '^(.*/)?esd$'` ]] && ESDRUNNING="Yes" || ESDRUNNING="No" +echo "ESound Daemon:" >> $FILE +echo " Installed - Yes ($ESDINST)" >> $FILE +echo " Running - $ESDRUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -n $ARTSINST ]];then +[[ `pgrep '^(.*/)?artsd$'` ]] && ARTSRUNNING="Yes" || ARTSRUNNING="No" +echo "aRts:" >> $FILE +echo " Installed - Yes ($ARTSINST)" >> $FILE +echo " Running - $ARTSRUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -n $JACKINST ]];then +[[ `pgrep '^(.*/)?jackd$'` ]] && JACKRUNNING="Yes" || JACKRUNNING="No" +echo "Jack:" >> $FILE +echo " Installed - Yes ($JACKINST)" >> $FILE +echo " Running - $JACKRUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -n $ROARINST ]];then +[[ `pgrep '^(.*/)?roard$'` ]] && ROARRUNNING="Yes" || ROARRUNNING="No" +echo "RoarAudio:" >> $FILE +echo " Installed - Yes ($ROARINST)" >> $FILE +echo " Running - $ROARRUNNING" >> $FILE +echo "" >> $FILE +fi +if [[ -z "$PAINST" && -z "$ESDINST" && -z "$ARTSINST" && -z "$JACKINST" && -z "$ROARINST" ]];then +echo "No sound servers found." >> $FILE +echo "" >> $FILE +fi +echo "" >> $FILE +echo "!!Soundcards recognised by ALSA" >> $FILE +echo "!!-----------------------------" >> $FILE +echo "" >> $FILE +cat $TEMPDIR/alsacards.tmp >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!PCI Soundcards installed in the system" >> $FILE +echo "!!--------------------------------------" >> $FILE +echo "" >> $FILE +cat $TEMPDIR/lspci.tmp >> $FILE +echo "" >> $FILE +echo "" >> $FILE +echo "!!Advanced information - PCI Vendor/Device/Subsystem ID's" >> $FILE +echo "!!-------------------------------------------------------" >> $FILE +echo "" >> $FILE +lspci -vvn |grep -A1 040[1-3] >> $FILE +echo "" >> $FILE +echo "" >> $FILE + +if [ "$SNDOPTIONS" ] +then +echo "!!Modprobe options (Sound related)" >> $FILE +echo "!!--------------------------------" >> $FILE +echo "" >> $FILE +modprobe -c|sed -n 's/^options \(snd[-_][^ ]*\)/\1:/p' >> $FILE +echo "" >> $FILE +echo "" >> $FILE +fi + +if [ -d "$SYSFS" ] +then +echo "!!Loaded sound module options" >> $FILE +echo "!!---------------------------" >> $FILE +echo "" >> $FILE +for mod in `cat /proc/asound/modules|awk {'print $2'}`;do +echo "!!Module: $mod" >> $FILE +for params in `echo $SYSFS/module/$mod/parameters/*`; do + echo -ne "\t"; + echo "$params : `cat $params`" | sed 's:.*/::'; +done >> $FILE +echo "" >> $FILE +done +echo "" >> $FILE +fi + +if [ -s "$TEMPDIR/alsa-hda-intel.tmp" ]; then + echo "!!HDA-Intel Codec information" >> $FILE + echo "!!---------------------------" >> $FILE + echo "--startcollapse--" >> $FILE + echo "" >> $FILE + cat $TEMPDIR/alsa-hda-intel.tmp >> $FILE + echo "--endcollapse--" >> $FILE + echo "" >> $FILE + echo "" >> $FILE +fi + +if [ -s "$TEMPDIR/alsa-ac97.tmp" ]; then + echo "!!AC97 Codec information" >> $FILE + echo "!!----------------------" >> $FILE + echo "--startcollapse--" >> $FILE + echo "" >> $FILE + cat $TEMPDIR/alsa-ac97.tmp >> $FILE + echo "" >> $FILE + cat $TEMPDIR/alsa-ac97-regs.tmp >> $FILE + echo "--endcollapse--" >> $FILE + echo "" >> $FILE + echo "" >> $FILE +fi + +if [ -s "$TEMPDIR/alsa-usbmixer.tmp" ]; then + echo "!!USB Mixer information" >> $FILE + echo "!!---------------------" >> $FILE + echo "--startcollapse--" >> $FILE + echo "" >> $FILE + cat $TEMPDIR/alsa-usbmixer.tmp >> $FILE + echo "--endcollapse--" >> $FILE + echo "" >> $FILE + echo "" >> $FILE +fi + +#If no command line options are specified, then run as though --with-all was specified +if [ -z "$1" ]; then + update + withall + pbcheck +fi + +fi # proceed + +#loop through command line arguments, until none are left. +if [ -n "$1" ]; then + until [ -z "$1" ] + do + case "$1" in + --pastebin) + update + withall + pbcheck + ;; + --update) + update + exit + ;; + --upload) + UPLOAD="yes" + withall + ;; + --no-upload) + UPLOAD="no" + withall + ;; + --output) + shift + NFILE="$1" + KEEP_OUTPUT="yes" + ;; + --debug) + echo "Debugging enabled. $FILE and $TEMPDIR will not be deleted" + KEEP_FILES="yes" + echo "" + withall + ;; + --with-all) + withall + ;; + --with-aplay) + withaplay + ;; + --with-amixer) + withamixer + ;; + --with-alsactl) + withalsactl + ;; + --with-devices) + withdevices + ;; + --with-dmesg) + withdmesg + ;; + --with-configs) + if [[ -e $HOME/.asoundrc ]] || [[ -e /etc/asound.conf ]] + then + echo "!!ALSA configuration files" >> $FILE + echo "!!------------------------" >> $FILE + echo "" >> $FILE + + #Check for ~/.asoundrc + if [[ -e $HOME/.asoundrc ]] + then + echo "!!User specific config file ($HOME/.asoundrc)" >> $FILE + echo "" >> $FILE + cat $HOME/.asoundrc >> $FILE + echo "" >> $FILE + echo "" >> $FILE + fi + + #Check for /etc/asound.conf + if [[ -e /etc/asound.conf ]] + then + echo "!!System wide config file (/etc/asound.conf)" >> $FILE + echo "" >> $FILE + cat /etc/asound.conf >> $FILE + echo "" >> $FILE + echo "" >> $FILE + fi + fi + ;; + --stdout) + UPLOAD="no" + withall + cat $FILE + rm $FILE + ;; + --about) + echo "Written/Tested by the following users of #alsa on irc.freenode.net:" + echo "" + echo " wishie - Script author and developer / Testing" + echo " crimsun - Various script ideas / Testing" + echo " gnubien - Various script ideas / Testing" + echo " GrueMaster - HDA Intel specific items / Testing" + echo " olegfink - Script update function" + echo " TheMuso - display to stdout functionality" + exit 0 + ;; + *) + echo "alsa-info.sh version $SCRIPT_VERSION" + echo "" + echo "Available options:" + echo " --with-aplay (includes the output of aplay -l)" + echo " --with-amixer (includes the output of amixer)" + echo " --with-alsactl (includes the output of alsactl)" + echo " --with-configs (includes the output of ~/.asoundrc and" + echo " /etc/asound.conf if they exist)" + echo " --with-devices (shows the device nodes in /dev/snd/)" + echo " --with-dmesg (shows the ALSA/HDA kernel messages)" + echo "" + echo " --output FILE (specify the file to output for no-upload mode)" + echo " --update (check server for script updates)" + echo " --upload (upload contents to remote server)" + echo " --no-upload (do not upload contents to remote server)" + echo " --pastebin (use http://pastebin.ca) as remote server" + echo " instead www.alsa-project.org" + echo " --stdout (print alsa information to standard output" + echo " instead of a file)" + echo " --about (show some information about the script)" + echo " --debug (will run the script as normal, but will not" + echo " delete $FILE)" + exit 0 + ;; + esac + shift 1 + done +fi + +if [ "$PROCEED" = "no" ]; then + exit 1 +fi + +if [ "$UPLOAD" = "ask" ]; then + if [ -n "$DIALOG" ]; then + dialog --backtitle "$BGTITLE" --title "Information collected" --yes-label " UPLOAD / SHARE " --no-label " SAVE LOCALLY " --defaultno --yesno "\n\nAutomatically upload ALSA information to $WWWSERVICE?" 10 80 + DIALOG_EXIT_CODE=$? + if [ $DIALOG_EXIT_CODE != 0 ]; then + UPLOAD="no" + else + UPLOAD="yes" + fi + else + echo -n "Automatically upload ALSA information to $WWWSERVICE? [y/N] : " + read -e CONFIRM + if [ "$CONFIRM" != "y" ]; then + UPLOAD="no" + else + UPLOAD="yes" + fi + fi + +fi + +if [ "$UPLOAD" = "no" ]; then + + if [ -z "$TOSTDOUT" ]; then + mv -f $FILE $NFILE || exit 1 + KEEP_OUTPUT="yes" + fi + + if [[ -n $DIALOG ]] + then + if [[ -n $PBERROR ]]; then + dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "An error occurred while contacting the $WWWSERVICE.\n Your information was NOT automatically uploaded.\n\nYour ALSA information is in $NFILE" 10 100 + else + dialog --backtitle "$BGTITLE" --title "Information collected" --msgbox "\n\nYour ALSA information is in $NFILE" 10 60 + fi + else + echo + + if [[ -n $PBERROR ]]; then + echo "An error occurred while contacting the $WWWSERVICE." + echo "Your information was NOT automatically uploaded." + echo "" + echo "Your ALSA information is in $NFILE" + echo "" + else + if [ -z "$TOSTDOUT" ]; then + echo "" + echo "Your ALSA information is in $NFILE" + echo "" + fi + fi + fi + + exit + +fi # UPLOAD + +#Test that wget is installed, and supports --post-file. Upload $FILE if it does, and prompt user to upload file if it doesnt. +if +WGET=$(which wget 2>/dev/null| sed 's|^[^/]*||' 2>/dev/null); [[ -n "${WGET}" ]] && [[ -x "${WGET}" ]] && [[ `wget --help |grep post-file` ]] +then + +if [[ -n $DIALOG ]] +then + +if [[ -z $PASTEBIN ]]; then + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://www.alsa-project.org/cardinfo-db/" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" + { for i in 10 20 30 40 50 60 70 80 90; do + echo $i + sleep 0.2 + done + echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.alsa-project.org ..." 6 70 0 +else + wget -O - --tries=5 --timeout=60 --post-file=$FILE "http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY&encrypt=t&encryptpw=blahblah" &>$TEMPDIR/wget.tmp || echo "Upload failed; exit" + { for i in 10 20 30 40 50 60 70 80 90; do + echo $i + sleep 0.2 + done + echo; } |dialog --backtitle "$BGTITLE" --guage "Uploading information to www.pastebin.ca ..." 6 70 0 +fi + +dialog --backtitle "$BGTITLE" --title "Information uploaded" --yesno "Would you like to see the uploaded information?" 5 100 +DIALOG_EXIT_CODE=$? +if [ $DIALOG_EXIT_CODE = 0 ]; then + grep -v "alsa-info.txt" $FILE >$TEMPDIR/uploaded.txt + dialog --backtitle "$BGTITLE" --textbox $TEMPDIR/uploaded.txt 0 0 +fi + +clear + +# no dialog +else + +if [[ -z $PASTEBIN ]]; then + echo -n "Uploading information to www.alsa-project.org ... " + wget -O - --tries=5 --timeout=60 --post-file=$FILE http://www.alsa-project.org/cardinfo-db/ &>$TEMPDIR/wget.tmp & +else + echo -n "Uploading information to www.pastebin.ca ... " + wget -O - --tries=5 --timeout=60 --post-file=$FILE http://pastebin.ca/quiet-paste.php?api=$PASTEBINKEY &>$TEMPDIR/wget.tmp & +fi + +#Progess spinner for wget transfer. +i=1 +sp="/-\|" +echo -n ' ' +while pgrep wget &>/dev/null +do + echo -en "\b${sp:i++%${#sp}:1}" +done + +echo -e "\b Done!" +echo "" + +fi #dialog + +#See if tput is available, and use it if it is. +if [ -n "$TPUT" ]; then + if [[ -z $PASTEBIN ]]; then + FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2 ; tput sgr0` + else + FINAL_URL=`tput setaf 1; grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p';tput sgr0` + fi +else + if [[ -z $PASTEBIN ]]; then + FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp | cut -d ' ' -f 2` + else + FINAL_URL=`grep "SUCCESS:" $TEMPDIR/wget.tmp | sed -n 's/.*\:\([0-9]\+\).*/http:\/\/pastebin.ca\/\1/p'` + fi +fi + +# Output the URL of the uploaded file. +echo "Your ALSA information is located at $FINAL_URL" +echo "Please inform the person helping you." +echo "" + +# We couldnt find a suitable wget, so tell the user to upload manually. +else + mv -f $FILE $NFILE || exit 1 + KEEP_OUTPUT="yes" + if [[ -z $DIALOG ]] + then + if [[ -z $PASTEBIN ]]; then + echo "" + echo "Could not automatically upload output to http://www.alsa-project.org" + echo "Possible reasons are:" + echo " 1. Couldnt find 'wget' in your PATH" + echo " 2. Your version of wget is less than 1.8.2" + echo "" + echo "Please manually upload $NFILE to http://www.alsa-project.org/cardinfo-db/ and submit your post." + echo "" + else + echo "" + echo "Could not automatically upload output to http://www.pastebin.ca" + echo "Possible reasons are:" + echo " 1. Couldnt find 'wget' in your PATH" + echo " 2. Your version of wget is less than 1.8.2" + echo "" + echo "Please manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." + echo "" + fi + else + if [[ -z $PASTEBIN ]]; then + dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.alsa-project.org.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.alsa-project,org/cardinfo-db/ and submit your post." 25 100 + else + dialog --backtitle "$BGTITLE" --msgbox "Could not automatically upload output to http://www.pastebin.ca.\nPossible reasons are:\n\n 1. Couldn't find 'wget' in your PATH\n 2. Your version of wget is less than 1.8.2\n\nPlease manually upload $NFILE to http://www.pastebin.ca/upload.php and submit your post." 25 100 + fi + fi +fi diff --git a/SOURCES/alsa-restore.service b/SOURCES/alsa-restore.service new file mode 100644 index 0000000..4e9466b --- /dev/null +++ b/SOURCES/alsa-restore.service @@ -0,0 +1,17 @@ +# +# Note that two different ALSA card state management schemes exist and they +# can be switched using a file exist check - /etc/alsa/state-daemon.conf . +# + +[Unit] +Description=Restore Sound Card State +ConditionPathExists=!/etc/alsa/state-daemon.conf +DefaultDependencies=no +After=alsa-state.service +Before=shutdown.target +Conflicts=shutdown.target + +[Service] +Type=oneshot +ExecStart=-/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main restore +StandardOutput=syslog diff --git a/SOURCES/alsa-state.service b/SOURCES/alsa-state.service new file mode 100644 index 0000000..9b906de --- /dev/null +++ b/SOURCES/alsa-state.service @@ -0,0 +1,17 @@ +# +# Note that two different ALSA card state management schemes exist and they +# can be switched using a file exist check - /etc/alsa/state-daemon.conf . +# + +[Unit] +Description=Manage Sound Card State (restore and store) +ConditionPathExists=/etc/alsa/state-daemon.conf +DefaultDependencies=no +After=sysinit.target +Before=shutdown.target +Conflicts=shutdown.target + +[Service] +Type=simple +ExecStart=-/usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main rdaemon +ExecStop=-/usr/sbin/alsactl -s kill save_and_quit diff --git a/SOURCES/alsa-store.service b/SOURCES/alsa-store.service new file mode 100644 index 0000000..87a6cb1 --- /dev/null +++ b/SOURCES/alsa-store.service @@ -0,0 +1,15 @@ +# +# Note that two different ALSA card state management schemes exist and they +# can be switched using a file exist check - /etc/alsa/state-daemon.conf . +# + +[Unit] +Description=Store Sound Card State +ConditionPathExists=!/etc/alsa/state-daemon.conf +DefaultDependencies=no +Before=shutdown.target + +[Service] +Type=oneshot +ExecStart=/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf store +StandardOutput=syslog diff --git a/SOURCES/alsa.rules b/SOURCES/alsa.rules new file mode 100644 index 0000000..6a4a0c3 --- /dev/null +++ b/SOURCES/alsa.rules @@ -0,0 +1,8 @@ +ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS!="card*", GOTO="alsa_restore_go" +GOTO="alsa_restore_end" + +LABEL="alsa_restore_go" +TEST!="/etc/alsa/state-daemon.conf", RUN+="/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main restore /dev/$name" +TEST=="/etc/alsa/state-daemon.conf", RUN+="/sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main nrestore /dev/$name" + +LABEL="alsa_restore_end" diff --git a/SOURCES/alsactl.conf b/SOURCES/alsactl.conf new file mode 100644 index 0000000..71f0d80 --- /dev/null +++ b/SOURCES/alsactl.conf @@ -0,0 +1,14 @@ +# +# ALSA library configuration file for alsactl tool +# (/usr/share/alsa tree is not necessary for alsactl) +# + +ctl.hw { + @args [ CARD ] + @args.CARD { + type string + default "0" + } + type hw + card $CARD +} diff --git a/SOURCES/alsaloop-syslog.patch b/SOURCES/alsaloop-syslog.patch new file mode 100644 index 0000000..d36e5f3 --- /dev/null +++ b/SOURCES/alsaloop-syslog.patch @@ -0,0 +1,64 @@ +diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c +index 20150dd..3b20682 100644 +--- a/alsaloop/alsaloop.c ++++ b/alsaloop/alsaloop.c +@@ -195,6 +195,7 @@ void help(void) + "-w,--workaround use workaround (serialopen)\n" + "-U,--xrun xrun profiling\n" + "-W,--wake process wake timeout in ms\n" ++"-z,--syslog use syslog for errors\n" + ); + printf("\nRecognized sample formats are:"); + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { +@@ -334,6 +335,14 @@ static int add_oss_mixers(struct loopback *loop, + return 0; + } + ++static void enable_syslog(void) ++{ ++ if (!use_syslog) { ++ use_syslog = 1; ++ openlog("alsaloop", LOG_NDELAY|LOG_PID, LOG_DAEMON); ++ } ++} ++ + static int parse_config_file(const char *file, snd_output_t *output); + + static int parse_config(int argc, char *argv[], snd_output_t *output, +@@ -368,6 +377,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + {"ossmixer", 1, NULL, 'O'}, + {"workaround", 1, NULL, 'w'}, + {"xrun", 0, NULL, 'U'}, ++ {"syslog", 0, NULL, 'z'}, + {NULL, 0, NULL, 0}, + }; + int err, morehelp; +@@ -405,7 +415,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + while (1) { + int c; + if ((c = getopt_long(argc, argv, +- "hdg:P:C:X:Y:l:t:F:f:c:r:s:benvA:S:a:m:T:O:w:UW:", ++ "hdg:P:C:X:Y:l:t:F:f:c:r:s:benvA:S:a:m:T:O:w:UW:z", + long_option, NULL)) < 0) + break; + switch (c) { +@@ -417,8 +427,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + break; + case 'd': + daemonize = 1; +- use_syslog = 1; +- openlog("alsaloop", LOG_NDELAY|LOG_PID, LOG_DAEMON); ++ enable_syslog(); + break; + case 'P': + arg_pdevice = strdup(optarg); +@@ -561,6 +570,9 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + if (cmdline) + arg_default_wake = arg_wake; + break; ++ case 'z': ++ enable_syslog(); ++ break; + } + } + diff --git a/SOURCES/alsaunmute b/SOURCES/alsaunmute new file mode 100755 index 0000000..3f772ea --- /dev/null +++ b/SOURCES/alsaunmute @@ -0,0 +1,6 @@ +#!/bin/sh + +exec /sbin/alsactl \ + -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf \ + --initfile=/lib/alsa/init/00main \ + init diff --git a/SOURCES/alsaunmute.1 b/SOURCES/alsaunmute.1 new file mode 100644 index 0000000..057ae50 --- /dev/null +++ b/SOURCES/alsaunmute.1 @@ -0,0 +1,28 @@ +.TH ALSAUNMUTE 1 "21 April 2010" +.SH NAME +alsaunmute \- a simple script to initialize ALSA sound devices + +.SH DESCRIPTION +\fBalsaunmute\fP is a shell script which runs the \fBalsactl(1)\fP +utility with \fIinit\fP argument (see the script for details). + +.SH OPTIONS +None + +.SS +Example: +\fBalsaunmute\fR + +.SH SEE ALSO +\fB +alsactl(1), +alsamixer(1), +amixer(1) +\fP + +.SH BUGS +None known. + +.SH AUTHOR +\fBalsaunmute\fP is by Jaroslav Kysela + diff --git a/SPECS/alsa-utils.spec b/SPECS/alsa-utils.spec new file mode 100644 index 0000000..bf35c2a --- /dev/null +++ b/SPECS/alsa-utils.spec @@ -0,0 +1,491 @@ +%define baseversion 1.0.27 +%define fixversion .2 + +Summary: Advanced Linux Sound Architecture (ALSA) utilities +Name: alsa-utils +Version: %{baseversion}%{?fixversion} +Release: 3%{?dist} +License: GPLv2+ +Group: Applications/Multimedia +URL: http://www.alsa-project.org/ +Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.bz2 +Source4: alsaunmute +Source5: alsaunmute.1 +Source6: alsa-info.sh +Source7: alsa-delay +Source10: alsa.rules +Source11: alsactl.conf +Source20: alsa-restore.service +Source21: alsa-store.service +Source22: alsa-state.service +Patch0: alsaloop-syslog.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: alsa-lib-devel >= %{baseversion} +BuildRequires: libsamplerate-devel +BuildRequires: ncurses-devel +BuildRequires: gettext-devel +BuildRequires: xmlto +BuildRequires: systemd-units >= 39-2 +Conflicts: udev <= 179-2 +# use latest alsa-lib - the executables in this package requires latest API +Requires: alsa-lib%{?_isa} >= %{baseversion}, systemd-units >= 39-2 +Conflicts: filesystem < 3 + +%description +This package contains command line utilities for the Advanced Linux Sound +Architecture (ALSA). + +%prep +%setup -q -n %{name}-%{version} +%patch0 -p1 -b .alsaloop-syslog + +%build +%configure CFLAGS="$RPM_OPT_FLAGS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" --disable-alsaconf \ + --with-udev-rules-dir=%{_prefix}/lib/udev/rules.d \ + --with-systemdsystemunitdir=%{_unitdir} +%{__make} %{?_smp_mflags} +%{__cp} %{SOURCE4} . + +%install +make install DESTDIR=$RPM_BUILD_ROOT +%find_lang %{name} + +# Install ALSA udev rules +mkdir -p $RPM_BUILD_ROOT/%{_prefix}/lib/udev/rules.d +install -p -m 644 %{SOURCE10} $RPM_BUILD_ROOT/%{_prefix}/lib/udev/rules.d/90-alsa-restore.rules +mkdir -p $RPM_BUILD_ROOT/%{_unitdir} +install -p -m 644 %{SOURCE20} $RPM_BUILD_ROOT/%{_unitdir}/alsa-restore.service +install -p -m 644 %{SOURCE21} $RPM_BUILD_ROOT/%{_unitdir}/alsa-store.service +install -p -m 644 %{SOURCE22} $RPM_BUILD_ROOT/%{_unitdir}/alsa-state.service + +# Install support utilities +mkdir -p -m755 $RPM_BUILD_ROOT/%{_bindir} +install -p -m 755 alsaunmute %{buildroot}/%{_bindir} +mkdir -p -m755 $RPM_BUILD_ROOT/%{_mandir}/man1 +install -p -m 644 %{SOURCE5} %{buildroot}/%{_mandir}/man1/alsaunmute.1 + +# Move /usr/share/alsa/init to /usr/lib/alsa/init +mkdir -p -m 755 %{buildroot}/%{_prefix}/lib/alsa +mv %{buildroot}%{_datadir}/alsa/init %{buildroot}/%{_prefix}/lib/alsa + +# Link /usr/lib/alsa/init to /usr/share/alsa/init back +ln -s ../../lib/alsa/init %{buildroot}%{_datadir}/alsa/init + +# Create a place for global configuration +mkdir -p -m 755 %{buildroot}/etc/alsa +install -p -m 644 %{SOURCE11} %{buildroot}/etc/alsa + +# Create /var/lib/alsa tree +mkdir -p -m 755 %{buildroot}/var/lib/alsa + +# Install alsa-info.sh script +install -p -m 755 %{SOURCE6} %{buildroot}/usr/bin/alsa-info +ln -s alsa-info %{buildroot}/usr/bin/alsa-info.sh + +# Install alsa-delay script +install -p -m 755 %{SOURCE7} %{buildroot}/usr/bin/alsa-delay + +%files -f %{name}.lang +%defattr(-,root,root,-) +%doc COPYING ChangeLog README TODO +%config /etc/alsa/* +%{_prefix}/lib/udev/rules.d/* +%{_unitdir}/* +%{_unitdir}/basic.target.wants/* +%{_unitdir}/shutdown.target.wants/* +%{_prefix}/lib/alsa/init/* +%{_bindir}/* +%{_sbindir}/* +%{_datadir}/alsa/ +%{_datadir}/sounds/* +%{_mandir}/man?/* +%dir /etc/alsa/ +%dir %{_prefix}/lib/alsa/ +%dir %{_prefix}/lib/alsa/init/ +%dir /var/lib/alsa/ + +%pre +if [ ! -r /lib/systemd/system/alsa-state.service ]; then + [ -d /etc/alsa ] || mkdir -m 0755 /etc/alsa + echo "# Remove this file to disable the alsactl daemon mode" > \ + /etc/alsa/state-daemon.conf +fi + +%post +if [ -s /etc/alsa/asound.state -a ! -s /etc/asound.state ] ; then + mv /etc/alsa/asound.state /etc/asound.state +fi +if [ -s /etc/asound.state -a ! -s /var/lib/alsa/asound.state ] ; then + mv /etc/asound.state /var/lib/alsa/asound.state +fi + +%changelog +* Tue Jul 30 2013 Jaroslav Kysela - 1.0.27.2-3 +- Added an updated alsa-delay script from RHEL 6 + +* Fri Jul 19 2013 Jaroslav Kysela - 1.0.27.2-2 +- Fix alsa-state.service (rkill -> kill) - rhbz#986141 + +* Wed Jul 10 2013 Jaroslav Kysela - 1.0.27.2-1 +- Updated to 1.0.27.2 + +* Tue May 21 2013 Jaroslav Kysela - 1.0.27.1-1 +- Updated to 1.0.27.1 +- Updated alsa-info.sh to 0.4.61 +- Remove dependency on the dialog package (it is optional for alsa-info.sh) + +* Mon Apr 15 2013 Jaroslav Kysela - 1.0.27-2 +- Fix the new udev rules (missing GOTO) - bug#951750 +- Fix the string size in alsactl (underflow) + +* Fri Apr 12 2013 Jaroslav Kysela - 1.0.27-1 +- Updated to 1.0.27, activated the alsactl daemon mode +- Updated alsa-info.sh to 0.4.61 + +* Wed Feb 13 2013 Fedora Release Engineering - 1.0.26-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Sep 6 2012 Jaroslav Kysela - 1.0.26-1 +- Updated to 1.0.26 + +* Wed Jul 18 2012 Fedora Release Engineering - 1.0.25-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue Apr 3 2012 Peter Robinson - 1.0.25-8 +- bump Release to be larger than F-16 + +* Tue Jan 31 2012 Jaroslav Kysela 1.0.25-1 +- update to 1.0.25 final + +* Wed Jan 25 2012 Harald Hoyer 1.0.24.1-8 +- install everything in /usr + https://fedoraproject.org/wiki/Features/UsrMove + +* Thu Jan 12 2012 Fedora Release Engineering - 1.0.24.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri Jan 6 2012 Lennart Poettering - 1.0.24.1-6 +- Always build with systemd support + +* Fri Jan 6 2012 Lennart Poettering - 1.0.24.1-5 +- When installing the Fedora service files make sure to override the + actual service files with them instead of the symlinks to them +- Drop StandardOutput=syslog since that is the default now and we + don't want to needlessly override the default + +* Mon Oct 31 2011 Bastien Nocera 1.0.24.1-4 +- Add patch to unmute MacBookAir4,1 speakers + +* Mon Feb 07 2011 Fedora Release Engineering - 1.0.24.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Fri Jan 28 2011 Jaroslav Kysela 1.0.24.1-2 +- add missing systemd files, add dependency on systemd-units +- use own udev rule file for /lib/udev/rules.d +- create /var/lib/alsa directory for asound.state + +* Fri Jan 28 2011 Jaroslav Kysela 1.0.24.1-1 +- updated to 1.0.24.1 final (new automake/autoconf) + +* Fri Jan 28 2011 Jaroslav Kysela 1.0.24-1 +- updated to 1.0.24 final +- updated alsa-info.sh script to 0.4.60 + +* Thu Jan 13 2011 Ville Skyttä - 1.0.23-4 +- Fix alsaunmute man page permissions, let rpmbuild compress it. + +* Mon Jun 28 2010 Jaroslav Kysela 1.0.23-3 +- add requires line (bug#526492) for specific alsa-lib package +- add requires line for dialog package (bug#561988) +- added man page for alsaunmute (bug#526174) +- updated alsa-info.sh script to 0.4.59 + +* Mon Jun 28 2010 Jaroslav Kysela 1.0.23-1 +- updated to 1.0.23 final + +* Sun Apr 18 2010 Thomas Spura 1.0.22-2 +- don't own %%{_datadir}/sounds (#569425) + +* Fri Jan 1 2010 Jaroslav Kysela 1.0.22-1 +- updated to 1.0.22 final + +* Thu Sep 3 2009 Jaroslav Kysela 1.0.21-2 +- added missing patch file + +* Thu Sep 3 2009 Jaroslav Kysela 1.0.21-1 +- updated to 1.0.21 final +- updated alsa-info.sh script to 0.4.58 + +* Fri Jul 24 2009 Fedora Release Engineering - 1.0.20-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Fri May 15 2009 Jaroslav Kysela 1.0.20-3 +- added missing Headphone Volume patch + +* Fri May 15 2009 Jaroslav Kysela 1.0.20-2 +- fixed Headphone Volume issue (bz#500956) + +* Wed May 06 2009 Jaroslav Kysela 1.0.20-1 +- updated to 1.0.20 final +- updated alsa-info.sh script to 0.4.56 + +* Mon Feb 23 2009 Fedora Release Engineering - 1.0.19-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 09 2009 Jaroslav Kysela 1.0.19-3 +- fixed volume initialization for some HDA codecs +- updated alsa-info.sh to 0.4.54 + +* Wed Feb 04 2009 Jaroslav Kysela 1.0.19-2 +- add %dir directive for /lib/alsa and /lib/alsa/init directories (bz#483324) + +* Tue Jan 20 2009 Jaroslav Kysela 1.0.19-1 +- updated to 1.0.19 final + +* Tue Nov 04 2008 Jaroslav Kysela 1.0.18-5 +- fixed building + +* Tue Nov 04 2008 Jaroslav Kysela 1.0.18-4 +- updated to 1.0.18 final +- updated alsa-info.sh script + +* Thu Sep 18 2008 Jaroslav Kysela 1.0.18-3.rc3 +- fixed alsa-info.sh link + +* Thu Sep 18 2008 Jaroslav Kysela 1.0.18-2.rc3 +- fixed /lib/alsa/init path for x86_64 (was /lib64/alsa/init) +- added /etc/alsa/asound.state -> /etc/asound.state shift to %post section +- fix udev rules (ommited /dev/ prefix for the alsactl utility) +- added --ignore option for alsactl (added also to upstream) + +* Thu Sep 11 2008 Jaroslav Kysela 1.0.18-1.rc3 +- updated to 1.0.18rc3 +- updated alsa-info.sh script to 0.4.51 +- removed alsacard utility +- removed salsa utility +- changed alsaunmute to use 'alsactl init' now +- updated ALSA udevd rules to use alsactl +- moved /etc/alsa/asound.state back to /etc/asound.state + +* Mon Jul 21 2008 Jaroslav Kysela 1.0.17-1 +- updated to 1.0.17 final +- updated alsa-info.sh script to 0.4.48 + +* Mon Apr 28 2008 Martin Stransky 1.0.16-3 +- Added alsa-info.sh script to /usr/bin/alsa-info + +* Tue Feb 19 2008 Fedora Release Engineering - 1.0.16-2 +- Autorebuild for GCC 4.3 + +* Mon Feb 18 2008 Martin Stransky 1.0.16-1 +- updated to 1.0.16 final + +* Tue Jan 15 2008 Mikel Ward +- add salsa man page + +* Mon Oct 29 2007 Martin Stransky 1.0.15-1 +- updated to 1.0.15 final + +* Mon Oct 1 2007 Martin Stransky 1.0.15-0.4.rc1 +- moved saved volume settings back to /etc/alsa + (per discussion at #293301) + +* Mon Sep 24 2007 Martin Stransky 1.0.15-0.3.rc1 +- fixed #303151 - wrong salsa dir in /etc/udev/rules.d/90-alsa.rules + +* Thu Sep 20 2007 Matthias Saou 1.0.15-0.2.rc1 +- Update License field. +- Mark udev rule as config. +- Use find_lang macro again to include translations (why was it removed?). + +* Wed Sep 19 2007 Martin Stransky 1.0.15-0.1.rc1 +- new upstream +- moved saved volume settings to /var/lib (#293301) +- patched alsactl for that (#255421) + +* Thu Aug 16 2007 Martin Stransky 1.0.14-2 +- added an entry to alsaunmute for HP xw4550 (#252171) + +* Wed Jul 25 2007 Martin Stransky 1.0.14-1 +- release bump + +* Thu Jun 7 2007 Martin Stransky 1.0.14-0.8 +- new upstream + +* Wed May 30 2007 Martin Stransky 1.0.14-0.7.rc2 +- updated alsanumute for Siemens Lifebook S7020 (#241639) +- unmute Master Mono for all drivers + +* Wed May 2 2007 Martin Stransky 1.0.14-0.6.rc2 +- added fix for #238442 (unmute Mono channel for w4550, + xw4600, xw6600, and xw8600) + +* Wed Apr 18 2007 Martin Stransky 1.0.14-0.5.rc2 +- added more funcionality to salsa (save/load sound settings), + moved volume settings to /etc/alsa/ + +* Thu Apr 10 2007 Martin Stransky 1.0.14-0.4.rc2 +- added support for large files +- minor fix in alsaunmute +- fixed #209239 - alsaconf: Stale language-dependent files +- fixed #233765 - alsa-utils : unowned directories + +* Fri Jan 19 2007 Martin Stransky 1.0.14-0.3.rc2 +- new upstream + +* Wed Jan 10 2007 Martin Stransky 1.0.14-0.2.rc1 +- added a config line for hda-intel driver + +* Mon Dec 11 2006 Martin Stransky 1.0.14-0.1.rc1 +- new upstream + +* Mon Oct 2 2006 Martin Stransky 1.0.12-3 +- fix for #207384 - Audio test fails during firstboot + +* Fri Aug 25 2006 Martin Stransky 1.0.12-2 +- new upstream + +* Mon Aug 07 2006 Martin Stransky 1.0.12-1.rc2 +- new upstream + +* Thu Jul 20 2006 Martin Stransky 1.0.12-1.rc1 +- new upstream + +* Wed Jul 12 2006 Jesse Keating - sh: line 0: fg: no job control +- rebuild + +* Tue May 30 2006 Martin Stransky 1.0.11-7 +- new upstream + +* Wed May 3 2006 Martin Stransky 1.0.11-6.rc2 +- removed HW specific switch - it should be set by driver + +* Thu Apr 6 2006 Martin Stransky 1.0.11-5.rc2 +- fixed rules file (#186494) +- fixed Audigi mixer switch (#187807) + +* Mon Feb 20 2006 Martin Stransky 1.0.11-3.rc2 +- removed autoreconf + +* Fri Feb 10 2006 Jesse Keating - 1.0.11-2.rc2.2 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 1.0.11-2.rc2.1 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Wed Jan 25 2006 Martin Stransky 1.0.11-2.rc2 +- added volume option to alsaunmute utility (for s-c-s) + +* Thu Jan 12 2006 Martin Stransky 1.0.11-1.rc2 +- new upstream + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Thu Nov 24 2005 Martin Stransky 1.0.10rf-1 +- new upstream version +- added alias for snd-azx + +* Wed Nov 9 2005 Martin Stransky 1.0.10rc1-2 +- fix for #169292 - RHEL4U2 xw4300 IntelHD internal speakers muted by default + +* Tue Sep 27 2005 Martin Stransky 1.0.10rc1-1 +- new upstream version + +* Tue Aug 23 2005 Martin Stransky 1.0.9-5 +- unmute External Amplifier by default (#166153) + +* Wed Jul 13 2005 Bill Nottingham 1.0.9-4 +- migrate the alsa restore program to a udev rule, not a dev.d program +- conflict with appropriate udev +- move alsaunmute, alsacard to /bin + +* Mon Jul 11 2005 Martin Stransky 1.0.9-3 +- New alsaunmute utility +- Add autoconf to BuildRequires (#162483) + +* Thu Jun 16 2005 Martin Stransky 1.0.9-2 +- New upstream version + +* Mon May 30 2005 Martin Stransky 1.0.9-1 +- New upstream version. +- moved alsacard utility from alsa-lib to alsa-tools + +* Mon May 16 2005 Bill Nottingham 1.0.9rc2-2 +- make sure 'Wave' playback channel isn't muted (#157850) + +* Mon Apr 25 2005 Martin Stransky 1.0.9rc2-1 +- New upstream version +- add %%find_lang macro (#155719) + +* Fri Apr 1 2005 Bill Nottingham 1.0.8-4 +- replace the dev.d script with a program that calls alsactl to + restore the volume if there is a saved config, and just unmutes + the playback channels if there isn't one (#132575) + +* Mon Mar 7 2005 Martin Stransky +- rebuilt + +* Wed Feb 16 2005 Martin Stransky 1.0.8-2 +- fix #148011 (add gettext-devel to BuildRequires) +- add $RPM_OPT_FLAGS to CFLAGS + +* Wed Jan 26 2005 Martin Stransky 1.0.8-1 +- update to 1.0.8 +- temporarily removed alsa-lauch.patch + +* Sat Jan 08 2005 Colin Walters 1.0.7-2 +- New patch alsa-utils-1.0.7-alsa-launch.patch, adds the + alsa-launch command. +- New source file xinit-alsa-launch.sh, integrates alsa-launch + into X startup +- BR xorg-x11-devel + +* Thu Jan 06 2005 Colin Walters 1.0.7-1 +- New upstream version + +* Tue Oct 19 2004 Bill Nottingham 1.0.6-3 +- tweak dev.d sound restore script (#133535, revisited) + +* Thu Oct 14 2004 Bill Nottingham 1.0.6-2 +- move alsactl to /sbin +- include a dev.d script for mixer restoring (#133535) + +* Mon Aug 30 2004 Bill Nottingham 1.0.6-1 +- update to 1.0.6 + +* Fri Jul 2 2004 Bill Nottingham 1.0.5-1 +- update to 1.0.5 + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Thu Mar 11 2004 Bill Nottingham 1.0.3-1 +- update to 1.0.3 + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Wed Jan 28 2004 Bill Nottingham 1.0.2-1 +- update to 1.0.2 + +* Wed Dec 17 2003 Bill Nottingham 1.0.0-0.rc2 +- import fedora.us RPM, take out save-alsamixer & alsaconf for now + +* Thu Dec 11 2003 Thorsten Leemhuis 1.0.0-0.fdr.0.4.rc2 +- rename alsamixer-saver save-alsamixer + +* Mon Dec 8 2003 Thorsten Leemhuis 1.0.0-0.fdr.0.3.rc2 +- Integrate Michael Schwendt's script alsamixer-saver; Still not quite sure if + this script is the right way -- but mine didn't work... + +* Sat Dec 6 2003 Thorsten Leemhuis 1.0.0-0.fdr.0.2.rc2 +- Update to 1.0.0rc2 +- added alsamixer Script -- stores settings on shutdown, does nothing on startup +- some minor corrections in spec-file style + +* Wed Dec 3 2003 Thorsten Leemhuis 1.0.0-0.fdr.0.1.rc1 +- Update to 1.0.0rc1 + +* Wed Aug 6 2003 Dams 0:utils-0.fdr.1 +- Initial build.