-L|--log)
do_logging=1; rm -f $LOGFILE; shift;;
-p|--probe)
- legacy_probe_card=$2; shift 2;;
+ legacy_probe_card="$2"; shift 2;;
-P|--listprobe)
echo "$LEGACY_CARDS"; exit 0;;
-u|--uid)
- alsa_uid=$2; shift 2;;
+ alsa_uid="$2"; shift 2;;
-g|--gid)
- alsa_gid=$2; shift 2;;
+ alsa_gid="$2"; shift 2;;
-d|--devmode)
- alsa_mode=$2; shift 2;;
+ alsa_mode="$2"; shift 2;;
-r|--strict)
alsa_uid=0; alsa_gid=17; alsa_mode=0660; shift;;
--) shift ; break ;;
fi
fi
-if [ "$distribution" = "debian" ]; then
+case `uname -r` in
+2.6.*)
+ kernel="new"
+ ;;
+*)
+ kernel="old"
+ ;;
+esac
+
+if [ "$kernel" = "new" -a -f /etc/modprobe.conf ]; then
+ cfgfile="/etc/modprobe.conf"
+elif [ "$distribution" = "debian" ]; then
cfgfile="/etc/alsa/modutils/0.9"
elif [ -e /etc/modules.conf ]; then
cfgfile="/etc/modules.conf"
#
mixer() {
amixer set "$1" "$2" unmute >/dev/null 2>&1
+ amixer set "$1" unmute >/dev/null 2>&1
}
set_mixers() {
mixer PCM 90%
mixer Synth 90%
mixer CD 90%
+ # mute mic
+ amixer set Mic 0% mute >/dev/null 2>&1
# ESS 1969 chipset has 2 PCM channels
mixer PCM,1 90%
# Trident/YMFPCI/emu10k1
mixer Wave 100%
mixer Music 100%
+ mixer AC97 100%
# CS4237B chipset:
mixer 'Master Digital' 75%
# Envy24 chips with analog outs
+ mixer DAC 90%
mixer DAC,0 90%
mixer DAC,1 90%
# some notebooks use headphone instead of master
mixer Headphone 75%
+ mixer Playback 100%
}
CARD_DRIVER=snd-$1
CARD_OPTS="${*:2}"
- if [ -z "$CARD_OPTS" ]; then
- CARD_OPTS="${mpfx}index=0"
- else
- CARD_OPTS="${mpfx}index=0 $CARD_OPTS"
- fi
# Configuration done
$DIALOG --yesno "
remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP
fi
echo "$ACB
-# --- ALSACONF verion $version ---
-alias char-major-116 snd
-alias snd-card-0 $CARD_DRIVER
+# --- ALSACONF verion $version ---" >> $TMP
+ if [ -z "$have_alias" -a "$kernel" = "new" ]; then
+ if grep -q char-major-116 /lib/modules/`uname -r`/modules.alias; then
+ have_alias="yes"
+ fi
+ fi
+ if [ -z "$have_alias" ]; then
+echo "alias char-major-116 snd
alias char-major-14 $SOUND_CORE
-alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
-alias sound-service-0-12 snd-pcm-oss
-options snd ${mpfx}major=116 ${mpfx}cards_limit=1$alsa_device_opts
-options $CARD_DRIVER $CARD_OPTS
-$ACE
+alias sound-service-0-12 snd-pcm-oss" >> $TMP
+ fi
+ if [ -n "$alsa_device_opts" ]; then
+ echo "options snd $alsa_device_opts" >> $TMP
+ fi
+echo "alias snd-card-0 $CARD_DRIVER
+alias sound-slot-0 $CARD_DRIVER" >> $TMP
+ if [ -n "$CARD_OPTS" ]; then
+ echo "options $CARD_DRIVER $CARD_OPTS" >> $TMP
+ fi
+echo "$ACE
" >> $TMP
if cp -f $cfgfile $cfgfile.old; then
===============================================================================
Now ALSA is ready to use.
- For adjustment of volumes, please use alsamixer or gamix.
+ For adjustment of volumes, use your favorite mixer.
Have a lot of fun!
# check playback
# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
ac_try_load () {
- echo "alias char-major-116 snd
-alias snd-card-0 snd-card-$1
-options snd ${mpfx}major=116 ${mpfx}cards_limit=1
-options snd-$1 ${*:2}
-" > $TMP
test $do_logging = 1 && echo "$1 ${*:2}" >> $LOGFILE
- /sbin/modprobe -C $TMP snd-$1 >/dev/null 2>&1
+ /sbin/modprobe snd-$1 ${*:2} >/dev/null 2>&1
$lsmod | grep -E '(snd-|snd_)' $1 >/dev/null 2>&1 || return 1
- /sbin/modprobe -C $TMP snd-ioctl32 >/dev/null 2>&1
# mute mixers
amixer set Master 0% mute >/dev/null 2>&1
kill -9 $pp > /dev/null 2>&1
st=$?
ac_cardname=`head -n 1 /proc/asound/cards | sed -e 's/^[0-9].* - \(.*\)$/\1/'`
- /sbin/modprobe -C $TMP -r snd-ioctl32 >/dev/null 2>&1
- /sbin/modprobe -C $TMP -r snd-$1 >/dev/null 2>&1
+ /sbin/modprobe -r snd-$1 >/dev/null 2>&1
if [ $st = 0 ]; then
# irq problem?
test $do_logging = 1 && echo "no playback return" >> $LOGFILE
# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
# ac_try_capture card duplex opts
ac_try_capture () {
- echo "alias char-major-116 snd
-alias snd-card-0 snd-$1
-options snd ${mpfx}major=116 ${mpfx}cards_limit=1
-options snd-$1 ${*:3}
-" > $TMP
test $do_logging = 1 && echo "$1 ${*:2}" >> $LOGFILE
- /sbin/modprobe -C $TMP snd-$1 >/dev/null 2>&1
+ /sbin/modprobe snd-$1 ${*:3} >/dev/null 2>&1
$lsmod | grep -E '(snd-|snd_)' $1 >/dev/null 2>&1 || return 1
- /sbin/modprobe -C $TMP snd-ioctl32 >/dev/null 2>&1
# mute mixers
amixer set Master 0% mute >/dev/null 2>&1
st=$?
# kill playback process if any
test $play_pid != 0 && kill -9 $play_pid
- /sbin/modprobe -C $TMP -r snd-ioctl32 >/dev/null 2>&1
- /sbin/modprobe -C $TMP -r snd-$1 >/dev/null 2>&1
+ /sbin/modprobe -r snd-$1 >/dev/null 2>&1
if [ $st = 0 ]; then
test $do_logging = 1 && echo "capture no return" >> $LOGFILE
return 2