- fixed (now really) for 2.6 modprobe.conf.

- clean up, modprobing without a temporary file.
- alsaconf will set up only the minimum aliases/options.
- cosmetic message changes.
This commit is contained in:
Takashi Iwai 2003-10-30 12:00:38 +00:00
parent 7152617a0e
commit 394fde8b0e

View file

@ -93,15 +93,15 @@ while true ; do
-L|--log) -L|--log)
do_logging=1; rm -f $LOGFILE; shift;; do_logging=1; rm -f $LOGFILE; shift;;
-p|--probe) -p|--probe)
legacy_probe_card=$2; shift 2;; legacy_probe_card="$2"; shift 2;;
-P|--listprobe) -P|--listprobe)
echo "$LEGACY_CARDS"; exit 0;; echo "$LEGACY_CARDS"; exit 0;;
-u|--uid) -u|--uid)
alsa_uid=$2; shift 2;; alsa_uid="$2"; shift 2;;
-g|--gid) -g|--gid)
alsa_gid=$2; shift 2;; alsa_gid="$2"; shift 2;;
-d|--devmode) -d|--devmode)
alsa_mode=$2; shift 2;; alsa_mode="$2"; shift 2;;
-r|--strict) -r|--strict)
alsa_uid=0; alsa_gid=17; alsa_mode=0660; shift;; alsa_uid=0; alsa_gid=17; alsa_mode=0660; shift;;
--) shift ; break ;; --) shift ; break ;;
@ -134,7 +134,18 @@ if modinfo -p snd | grep -q device_mode ; then
fi fi
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" cfgfile="/etc/alsa/modutils/0.9"
elif [ -e /etc/modules.conf ]; then elif [ -e /etc/modules.conf ]; then
cfgfile="/etc/modules.conf" cfgfile="/etc/modules.conf"
@ -231,6 +242,7 @@ remove_ac_block() {
# #
mixer() { mixer() {
amixer set "$1" "$2" unmute >/dev/null 2>&1 amixer set "$1" "$2" unmute >/dev/null 2>&1
amixer set "$1" unmute >/dev/null 2>&1
} }
set_mixers() { set_mixers() {
@ -238,18 +250,23 @@ set_mixers() {
mixer PCM 90% mixer PCM 90%
mixer Synth 90% mixer Synth 90%
mixer CD 90% mixer CD 90%
# mute mic
amixer set Mic 0% mute >/dev/null 2>&1
# ESS 1969 chipset has 2 PCM channels # ESS 1969 chipset has 2 PCM channels
mixer PCM,1 90% mixer PCM,1 90%
# Trident/YMFPCI/emu10k1 # Trident/YMFPCI/emu10k1
mixer Wave 100% mixer Wave 100%
mixer Music 100% mixer Music 100%
mixer AC97 100%
# CS4237B chipset: # CS4237B chipset:
mixer 'Master Digital' 75% mixer 'Master Digital' 75%
# Envy24 chips with analog outs # Envy24 chips with analog outs
mixer DAC 90%
mixer DAC,0 90% mixer DAC,0 90%
mixer DAC,1 90% mixer DAC,1 90%
# some notebooks use headphone instead of master # some notebooks use headphone instead of master
mixer Headphone 75% mixer Headphone 75%
mixer Playback 100%
} }
@ -494,11 +511,6 @@ ac_config_card () {
CARD_DRIVER=snd-$1 CARD_DRIVER=snd-$1
CARD_OPTS="${*:2}" CARD_OPTS="${*:2}"
if [ -z "$CARD_OPTS" ]; then
CARD_OPTS="${mpfx}index=0"
else
CARD_OPTS="${mpfx}index=0 $CARD_OPTS"
fi
# Configuration done # Configuration done
$DIALOG --yesno " $DIALOG --yesno "
@ -528,19 +540,30 @@ Do you want to modify ${cfgfile}?" 8 50 || acex 0
remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP
fi fi
echo "$ACB echo "$ACB
# --- ALSACONF verion $version --- # --- ALSACONF verion $version ---" >> $TMP
alias char-major-116 snd if [ -z "$have_alias" -a "$kernel" = "new" ]; then
alias snd-card-0 $CARD_DRIVER 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 char-major-14 $SOUND_CORE
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss alias sound-service-0-12 snd-pcm-oss" >> $TMP
options snd ${mpfx}major=116 ${mpfx}cards_limit=1$alsa_device_opts fi
options $CARD_DRIVER $CARD_OPTS if [ -n "$alsa_device_opts" ]; then
$ACE 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 " >> $TMP
if cp -f $cfgfile $cfgfile.old; then if cp -f $cfgfile $cfgfile.old; then
@ -603,7 +626,7 @@ If you have a big amplifier, lower your volumes or say no.
=============================================================================== ===============================================================================
Now ALSA is ready to use. 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! Have a lot of fun!
@ -638,15 +661,9 @@ check_irq_avail () {
# check playback # check playback
# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem) # return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
ac_try_load () { 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 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 $lsmod | grep -E '(snd-|snd_)' $1 >/dev/null 2>&1 || return 1
/sbin/modprobe -C $TMP snd-ioctl32 >/dev/null 2>&1
# mute mixers # mute mixers
amixer set Master 0% mute >/dev/null 2>&1 amixer set Master 0% mute >/dev/null 2>&1
@ -662,8 +679,7 @@ options snd-$1 ${*:2}
kill -9 $pp > /dev/null 2>&1 kill -9 $pp > /dev/null 2>&1
st=$? st=$?
ac_cardname=`head -n 1 /proc/asound/cards | sed -e 's/^[0-9].* - \(.*\)$/\1/'` 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 -r snd-$1 >/dev/null 2>&1
/sbin/modprobe -C $TMP -r snd-$1 >/dev/null 2>&1
if [ $st = 0 ]; then if [ $st = 0 ]; then
# irq problem? # irq problem?
test $do_logging = 1 && echo "no playback return" >> $LOGFILE test $do_logging = 1 && echo "no playback return" >> $LOGFILE
@ -679,15 +695,9 @@ options snd-$1 ${*:2}
# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem) # return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
# ac_try_capture card duplex opts # ac_try_capture card duplex opts
ac_try_capture () { 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 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 $lsmod | grep -E '(snd-|snd_)' $1 >/dev/null 2>&1 || return 1
/sbin/modprobe -C $TMP snd-ioctl32 >/dev/null 2>&1
# mute mixers # mute mixers
amixer set Master 0% mute >/dev/null 2>&1 amixer set Master 0% mute >/dev/null 2>&1
@ -710,8 +720,7 @@ options snd-$1 ${*:3}
st=$? st=$?
# kill playback process if any # kill playback process if any
test $play_pid != 0 && kill -9 $play_pid test $play_pid != 0 && kill -9 $play_pid
/sbin/modprobe -C $TMP -r snd-ioctl32 >/dev/null 2>&1 /sbin/modprobe -r snd-$1 >/dev/null 2>&1
/sbin/modprobe -C $TMP -r snd-$1 >/dev/null 2>&1
if [ $st = 0 ]; then if [ $st = 0 ]; then
test $do_logging = 1 && echo "capture no return" >> $LOGFILE test $do_logging = 1 && echo "capture no return" >> $LOGFILE
return 2 return 2