⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 alsaconf.in

📁 alsa-utils-1.0.14编译声卡驱动所需要的一些文件源码
💻 IN
📖 第 1 页 / 共 3 页
字号:
# check playback# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)ac_try_load () {    test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE"    /sbin/modprobe snd-$1 ${*:2} >/dev/null 2>&1    if $lsmod | grep -q -E '^(snd-|snd_)'$1' '; then	: ;    else	/sbin/modprobe -r snd-$1 >/dev/null 2>&1	return 1    fi    # mute mixers    amixer set Master 0% mute >/dev/null 2>&1    amixer set PCM 0% mute >/dev/null 2>&1        # output 0.5 sec    head -c 4000 < /dev/zero | aplay -N -r8000 -fS16_LE -traw -c1 > /dev/null 2>&1 &    # remember pid    pp=$!    # sleep for 2 seconds (to be sure -- 1 sec would be enough)    sleep 2    # kill the child process if still exists.    kill -9 $pp > /dev/null 2>&1    st=$?    ac_cardname=`head -n 1 $PROCFS/asound/cards | sed -e 's/^[0-9].* - \(.*\)$/\1/'`    /sbin/modprobe -r snd-$1 >/dev/null 2>&1    if [ $st = 0 ]; then	# irq problem?	test -n "$LOGFILE" && echo "no playback return" >> "$LOGFILE"	return 2    else	# seems ok!	test -n "$LOGFILE" && echo "playback OK" >> "$LOGFILE"	return 0    fi}# check capture# return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)# ac_try_capture card duplex optsac_try_capture () {    test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE"    /sbin/modprobe snd-$1 ${*:3} >/dev/null 2>&1    if $lsmod | grep -q -E '^(snd-|snd_)'$1' '; then	: ;    else	/sbin/modprobe -r snd-$1 >/dev/null 2>&1	return 1    fi    # mute mixers    amixer set Master 0% mute >/dev/null 2>&1    amixer set PCM 0% mute >/dev/null 2>&1    play_pid=0    if [ $2 = yes ]; then	# try duplex - start dummy playing	aplay -N -r8000 -fS16_LE -traw -c1 < /dev/zero > /dev/null 2>&1 &	play_pid=$!    fi    # record 1sec    arecord -N -d1 > /dev/null 2>&1 &    # remember pid    pp=$!    # sleep for 2 seconds    sleep 2    # kill the child process if still exists.    kill -9 $pp > /dev/null 2>&1    st=$?    # kill playback process if any    test $play_pid != 0 && kill -9 $play_pid    /sbin/modprobe -r snd-$1 >/dev/null 2>&1    if [ $st = 0 ]; then	test -n "$LOGFILE" && echo "capture no return" >> "$LOGFILE"	return 2    else	test -n "$LOGFILE" && echo "capture OK" >> "$LOGFILE"	return 0    fi}get_dma_pair () {    case $1 in    0)	echo 1 3 5;;    1)	echo 0 3 5;;    3)	echo 1 0 5;;    5)	echo 3 1 0;;    esac}## check playback on specified irqs## ac_try_irq card opts irqs...# return 0 - OK, 1 - NG, 2 - not working (dma problem?)#ac_try_irq () {    card=$1    opts="$2 ${mpfx}irq=$3"    ac_try_load $card $opts >/dev/null 2>&1    result=$?    case $result in    0)	ac_opts="$opts"	return 0	;;    2)	for irq in ${*:4}; do	    opts="$2 ${mpfx}irq=$irq"	    ac_try_load $card $opts >/dev/null 2>&1	    if [ $? = 0 ]; then		ac_opts="$opts"		return 0	    fi	done	return 2	;;    esac    return 1}## check playback/capture on dma1 & dma2 & specified irqs## ac_try_dmas card opts irqs...# return 0 - OK, 1 - NG#ac_try_dmas () {    dma_list=`check_dma_avail 1 0 3 5`    for irq in ${*:3}; do	for dma1 in $dma_list; do	    for dma2 in `get_dma_pair $dma1`; do		opts="$2 ${mpfx}dma1=$dma1 ${mpfx}dma2=$dma2 ${mpfx}irq=$irq"		ac_try_load $1 $opts >/dev/null 2>&1		result=$?		if [ $result = 1 ]; then		    if [ $try_all_combination = 1 ]; then			continue		    else			return 1		    fi		elif [ $result = 0 ]; then		    test -n "$LOGFILE" && echo "Now checking capture..." >> "$LOGFILE"		    ac_opts="$opts"		    ac_try_capture $1 yes $opts >/dev/null 2>&1 && return 0		    for d in yes no; do			for dma2 in $dma_list; do			    if [ $dma1 != $dma2 ]; then				opts="$2 ${mpfx}dma1=$dma1 ${mpfx}dma2=$dma2 ${mpfx}irq=$irq"				ac_opts="$opts"				ac_try_capture $1 $d $opts >/dev/null 2>&1 && return 0			    fi			done		    done		    return 0		fi	    done	done    done    return 1}# check if the option $2 exists in card $1: set value $3ac_check_option () {    if /sbin/modinfo -p snd-$1 | grep -q $2; then      echo "$2=$3"    fi}ac_try_card_sb8 () {    card=sb8    irq_list=`check_irq_avail 5 3 9 10 7`    for dma8 in `check_dma_avail 1 3`; do	opts="${mpfx}dma8=$dma8"	ac_try_irq $card "$opts" $irq_list && return 0    done    return 1}ac_try_card_sb16 () {    card=sb16    isapnp=`ac_check_option $card ${mpfx}isapnp 0`    opts="$isapnp"    irq_list=`check_irq_avail 5 9 10 7 3`    dma_list=`check_dma_avail 0 1 3`    dma16_list=`check_dma_avail 5 6 7`    # at first try auto-probing by driver itself    ac_try_load $card $opts >/dev/null 2>&1    result=$?    case $result in    0)	ac_opts="$opts"	ac_try_capture $card yes $opts >/dev/null 2>&1 && return 0	for d in yes no; do	    for dma8 in $dma_list; do		for irq in $irq_list; do		    opts="${mpfx}dma8=$dma8 ${mpfx}irq=$irq $isapnp"		    ac_try_capture $card $d $opts >/dev/null 2>&1 && return 0		done	    done	done	return 0	;;    2)	for dma16 in $dma16_list; do	    opts="${mpfx}dma16=$dma16 $isapnp"	    if ac_try_irq $card "$opts" $irq_list ; then		ac_try_capture $card yes $ac_opts >/dev/null 2>&1 && return 0		ac_opts_saved="$ac_opts"		for d in yes no; do		    for dma8 in $dma_list; do			ac_opts="$ac_opts_saved ${mpfx}dma8=$dma8"			ac_try_capture $card $d $ac_opts >/dev/null 2>&1 && return 0		    done		done		# return anyway here..		return 0	    fi	done	;;    esac    return 1}ac_try_card_es1688 () {    card=es1688    opts=""    irq_list=`check_irq_avail 5 9 10 7`    for dma8 in `check_dma_avail 1 3 0`; do	opts="${mpfx}dma8=$dma8 ${mpfx}mpu_irq=-1"	ac_try_irq $card "$opts" $irq_list && return 0    done    return 1}ac_try_card_es18xx () {    card=es18xx    opts=`ac_check_option $card ${mpfx}isapnp 0`    ac_try_dmas $card "$opts" `check_irq_avail 5 9 10 7` && return 0    return 1}ac_try_card_cs4236 () {    card=cs4236    irq_list=`check_irq_avail 5 7 9 11 12 15`    isapnp=`ac_check_option $card ${mpfx}isapnp 0`    for cport in 0x538 0x210 0xf00; do	for port in 0x530 0x534; do	    opts="${mpfx}port=$port ${mpfx}cport=$cport $isapnp"	    ac_try_dmas $card "$opts" $irq_list && return 0	done    done    return 1}ac_try_card_cs4232 () {    card=cs4232    irq_list=`check_irq_avail 5 7 9 11 12 15`    isapnp=`ac_check_option $card ${mpfx}isapnp 0`    for cport in 0x538 0x210 0xf00; do	for port in 0x530 0x534; do	    opts="${mpfx}port=$port ${mpfx}cport=$cport $isapnp"	    ac_try_dmas $card "$opts" $irq_list && return 0	done    done    return 1}ac_try_card_cs4231 () {    card=cs4231    irq_list=`check_irq_avail 5 7 9 11 12 15`    for port in 0x530 0x534; do	opts="${mpfx}port=$port"	ac_try_dmas $card "$opts" $irq_list && return 0    done    return 1}ac_try_card_opl3sa2 () {    card=opl3sa2    irq_list=`check_irq_avail 5 9 3 1 11 12 15 0`    isapnp=`ac_check_option $card ${mpfx}isapnp 0`    for port in 0x370 0x538 0xf86 0x100; do	for wss_port in 0x530 0xe80 0xf40 0x604; do	    opts="${mpfx}fm_port=-1 ${mpfx}midi_port=-1 ${mpfx}port=$port ${mpfx}wss_port=$wss_port $isapnp"	    ac_try_dmas $card "$opts" $irq_list && return 0	done    done    return 1}ac_config_legacy () {   title=$(gettext "WARNING")   msg=$(gettext "   Probing legacy ISA cards might make   your system unstable.        Do you want to proceed?")    $DIALOG --title "$title" --yesno "$msg" 10 50 || acex 0    if [ x"$1" = x ]; then	probe_list="$LEGACY_CARDS"    else	probe_list=$*    fi    menu_args=()    for card in $probe_list; do	cardname=`/sbin/modinfo -d snd-$card | sed -e 's/^\"\(.*\)\"$/\1/g'`	if [ x"$cardname" != x ]; then	    menu_args=("${menu_args[@]}" "$card" "$cardname" "on")	fi    done    if [ x$menu_args = x ]; then	msg=$(gettext "No legacy drivers are available   for your machine")	$DIALOG --msgbox "$msg" 5 50	return 1    fi    title=$(gettext "Driver Selection")    msg=$(gettext "           Probing legacy ISA cards        Please select the drivers to probe:")    $DIALOG --title "$title" --checklist "$msg" \	17 64 8 "${menu_args[@]}" 2> $FOUND || acex 0    if [ $try_all_combination != 1 ]; then	msg=$(gettext " Shall I try all possible DMA and IRQ combinations? With this option, some unconventional configuration might be found, but it will take much longer time.")	if $DIALOG --yesno "$msg" 10 60	    then	    try_all_combination=1	fi    fi    xecho "Probing legacy cards..   This may take a few minutes.."    echo -n $(gettext "Probing: ")    cards=`cat $FOUND | tr -d \"`    for card in $cards; do	echo -n " $card"	ac_opts=""	if eval ac_try_card_$card ; then	    xecho " : FOUND!!"	    ac_config_card $card $ac_opts	    return 0	fi    done    echo    title=$(gettext "Result")    msg=$(gettext "No legacy cards found")    $DIALOG --title "$title" --msgbox "$msg" 5 50    return 1}## main part continued..#if test -n "$LOGFILE" ; then    touch "$LOGFILE"    echo -n "Starting alsaconf: " >> "$LOGFILE"    date >> "$LOGFILE"fiif [ x"$legacy_probe_card" != x ]; then    ac_opts=""    if eval ac_try_card_$legacy_probe_card >/dev/null 2>&1; then	echo "$ac_opts"	echo "$ac_cardname"	exit 0    else	echo "FAILED"	exit 1    fifiintroif [ $do_legacy_only = 1 ]; then    ac_config_legacy    exit 0fi    probe_cardsdevs_found=()devs_olist=""if [ -s "$FOUND" ]; then    while read dev card ; do	MODDIR=/lib/modules/`uname -r`	find $MODDIR -type f | grep -q -E $card'\.(o|ko)' || continue	cardname=`find_device_name $dev | cut -c 1-64`	if [ -z "$cardname" ]; then	    cardname="$card"	fi	card=${card##snd-}	devs_found=("${devs_found[@]}" "$card" "$cardname")	devs_devs=("${devs_devs[@]}" "$card" "$dev")    done <"$FOUND"    devs_olist=`cat $FOUND`fiif [ x$devs_found != x ]; then    #    # check for TP600E    #    if [ ${devs_found[0]} = cs46xx ]; then	if $lspci -nv 2>/dev/null| grep -q "Subsystem: 1014:1010"; then	    msg=$(gettext " Looks like you having a Thinkpad 600E or 770 notebook. On this notebook, CS4236 driver should be used although CS46xx chip is detected. Shall I try to snd-cs4236 driver and probe the legacy ISA configuration?")	    if $DIALOG --yesno "$msg" 13 60	    then		try_all_combination=1		ac_config_legacy cs4236		exit 0	    fi	elif $lspci -nv 2>/dev/null| grep -q "Subsystem: 8086:8080"; then	    msg=$(gettext " Looks like you having a Dell Dimension machine. On this machine, CS4232 driver should be used although CS46xx chip is detected. Shall I try to snd-cs4232 driver and probe the legacy ISA configuration?")	    if $DIALOG --yesno "$msg" 13 60	    then		try_all_combination=1		ac_config_legacy cs4232		exit 0	    fi        fi	    fi       devs_found=("${devs_found[@]}" "legacy" "Probe legacy ISA (non-PnP) chips")    title=$(gettext "Soundcard Selection")    msg=$(gettext "         Following card(s) are found on your system.         Choose a soundcard to configure:")    $DIALOG --title "$title" --menu "$msg" 17 76 8 "${devs_found[@]}" 2> $FOUND || acex 0    card=`head -n 1 $FOUND`    if [ "$card" = "legacy" ]; then	ac_config_legacy    else	ac_config_card "$card"    fi    exit 0else    msg=$(gettext "        No supported PnP or PCI card found. Would you like to probe legacy ISA sound cards/chips?")    if $DIALOG --yesno "$msg" 9 60 ; then	ac_config_legacy	exit 0    fifirm -f "$FOUND" "$DUMP"exit 0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -