alsaconf.in (35464B)
1 #!/bin/bash 2 # 3 # ALSA Configurator 4 # 5 # Copyright (c) 1999-2002 SuSE GmbH 6 # Jan ONDREJ 7 # 8 # written by Takashi Iwai <tiwai@suse.de> 9 # Bernd Kaindl <bk@suse.de> 10 # Jan ONDREJ (SAL) <ondrejj@salstar.sk> 11 # 12 # based on the original version of Jan ONDREJ's alsaconf for ALSA 0.4. 13 # 14 # This program is free software; you can redistribute it and/or modify 15 # it under the terms of the GNU General Public License as published by 16 # the Free Software Foundation; either version 2 of the License, or 17 # (at your option) any later version. 18 # 19 20 export TEXTDOMAIN=alsaconf 21 22 prefix=@prefix@ 23 exec_prefix=@exec_prefix@ 24 bindir=@bindir@ 25 sbindir=@sbindir@ 26 version=@VERSION@ 27 USE_NLS=@USE_NLS@ 28 29 # Useful for debugging 30 PROCFS="/proc" 31 SYSFS="/sys" 32 33 # i18n stuff 34 if test "$USE_NLS" = "yes" && type -p gettext > /dev/null; then 35 xecho() { 36 gettext -s "$*" 37 } 38 else 39 xecho() { 40 echo "$*" 41 } 42 gettext() { 43 echo -n "$*" 44 } 45 fi 46 xmsg() { 47 msg=$(gettext "$1") 48 shift 49 printf "$msg" $* 50 } 51 52 # Check for GNU/Linux distributions 53 if [ -f /etc/SuSE-release ]; then 54 distribution="suse" 55 suse_version=$(grep 'VERSION = ' /etc/SuSE-release | sed -e s/'VERSION = '//) 56 elif [ -f /etc/UnitedLinux-release ]; then 57 distribution="suse" 58 elif [ -f /etc/gentoo-release ]; then 59 distribution="gentoo" 60 elif [ -f /etc/debian_version ]; then 61 distribution="debian" 62 elif [ -f /etc/mandrake-release ]; then 63 distribution="mandrake" 64 elif test -f /etc/redhat-release && grep -q "Red Hat" /etc/redhat-release; then 65 distribution="redhat" 66 elif test -f /etc/fedora-release && grep -q "Fedora" /etc/fedora-release; then 67 distribution="fedora" 68 elif [ -f /etc/slackware-version -o -f /etc/slamd64-version ]; then 69 distribution="slackware" 70 else 71 distribution="unknown" 72 fi 73 74 for prog in lspci lsmod; do 75 for path in /sbin /usr/sbin /bin /usr/bin;do 76 test -x $path/$prog && eval $prog=$path/$prog 77 done 78 done 79 unset prog path 80 81 usage() { 82 xecho "ALSA configurator" 83 echo " version $version" 84 xecho "usage: alsaconf [options] 85 -l|--legacy check only legacy non-isapnp cards 86 -m|--modinfo read module descriptions instead of reading card db 87 -s|--sound wav-file 88 use the specified wav file as a test sound 89 -u|--uid uid set the uid for the ALSA devices (default = 0) [obsoleted] 90 -g|--gid gid set the gid for the ALSA devices (default = 0) [obsoleted] 91 -d|--devmode mode 92 set the permission for ALSA devices (default = 0666) [obs.] 93 -r|--strict set strict device mode (equiv. with -g 17 -d 0660) [obsoleted] 94 -L|--log file logging on the specified file (for debugging purpose only) 95 -p|--probe card-name 96 probe a legacy non-isapnp card and print module options 97 -P|--listprobe list the supported legacy card modules 98 -c|--config file 99 specify the module config file 100 -R|--resources list available DMA and IRQ resources with debug for legacy 101 -h|--help what you're reading" 102 } 103 104 OPTS=`getopt -o lmL:hp:Pu:g:d:rs:c:R --long legacy,modinfo,log:,help,probe:,listprobe,uid:,gid:,devmode:,strict,sound:,config:,resources -n alsaconf -- "$@"` || exit 1 105 eval set -- "$OPTS" 106 107 do_legacy_only=0 108 use_modinfo_db=0 109 alsa_uid=0 110 alsa_gid=0 111 alsa_mode=0666 112 legacy_probe_card="" 113 LOGFILE="" 114 TESTSOUND="@TESTSOUND@" 115 try_all_combination=0 116 resources="false" 117 118 # legacy support 119 LEGACY_CARDS="opl3sa2 cs4236 cs4232 cs4231 es18xx es1688 sb16 sb8" 120 121 while true ; do 122 case "$1" in 123 -l|--legacy) 124 do_legacy_only=1; shift ;; 125 -m|--modinfo) 126 use_modinfo_db=1; shift ;; 127 -s|--sound) 128 TESTSOUND=$2; shift 2;; 129 -h|--help) 130 usage; exit 0 ;; 131 -L|--log) 132 LOGFILE="$2"; shift 2;; 133 -p|--probe) 134 legacy_probe_card="$2"; shift 2;; 135 -P|--listprobe) 136 echo "$LEGACY_CARDS"; exit 0;; 137 -u|--uid) 138 alsa_uid="$2"; shift 2;; 139 -g|--gid) 140 alsa_gid="$2"; shift 2;; 141 -d|--devmode) 142 alsa_mode="$2"; shift 2;; 143 -r|--strict) 144 alsa_uid=0; alsa_gid=17; alsa_mode=0660; shift;; 145 -c|--config) 146 cfgfile="$2"; shift 2;; 147 -R|--resources) 148 resources="true"; shift;; 149 --) shift ; break ;; 150 *) usage ; exit 1 ;; 151 esac 152 done 153 154 # 155 # probe legacy ISA cards 156 # 157 158 check_dma_avail () { 159 list="" 160 if [ -d $SYSFS/bus/pnp/devices ]; then 161 for dma in $*; do 162 ok="true" 163 for i in $SYSFS/bus/pnp/devices/??:* ; do 164 if grep -q "state = active" $i/resources ; then 165 if grep -q '^dma '$dma'$' $i/resources; then 166 ok="false" 167 fi 168 fi 169 done 170 if [ -r $PROCFS/dma ]; then 171 if grep -q '^ *'$dma': ' $PROCFS/dma ; then 172 ok="false" 173 fi 174 fi 175 if [ "$ok" = "true" ]; then 176 list="$list $dma" 177 fi 178 done 179 else 180 if [ -r $PROCFS/dma ]; then 181 for dma in $*; do 182 grep -q '^ *'$dma': ' $PROCFS/dma || list="$list $dma" 183 done 184 fi 185 fi 186 if [ ! -z "$list" ]; then 187 echo $list 188 fi 189 } 190 191 check_irq_avail () { 192 list="" 193 if [ -d $SYSFS/bus/pnp/devices ]; then 194 for irq in $*; do 195 ok="true" 196 for i in $SYSFS/bus/pnp/devices/??:* ; do 197 if grep -q "state = active" $i/resources ; then 198 if grep -q '^irq '$irq'$' $i/resources; then 199 ok="false" 200 fi 201 fi 202 done 203 if [ -r $PROCFS/interrupts ]; then 204 if grep -q '^ *'$irq': ' $PROCFS/interrupts ; then 205 ok="false" 206 fi 207 fi 208 if [ "$ok" = "true" ]; then 209 list="$list $irq" 210 fi 211 done 212 else 213 if [ -r $PROCFS/interrupts ]; then 214 for irq in $*; do 215 grep -q '^ *'$irq': ' $PROCFS/interrupts || list="$list $irq" 216 done 217 fi 218 fi 219 if [ ! -z "$list" ]; then 220 echo $list 221 fi 222 } 223 224 # 225 # 226 # 227 228 if [ "$resources" = "true" ]; then 229 if [ -d $SYSFS/bus/pnp/devices ]; then 230 for i in $SYSFS/bus/pnp/devices/??:* ; do 231 if [ "$resources" = "true" ]; then 232 echo ">>>>> PnP file: $i/resources" 233 cat $i/resources 234 fi 235 done 236 fi 237 if [ -r $PROCFS/dma ]; then 238 echo ">>>>> Allocated dma channels:" 239 cat $PROCFS/dma 240 fi 241 if [ -r $PROCFS/interrupts ]; then 242 echo ">>>>> Allocated interrupt channels:" 243 cat $PROCFS/interrupts 244 fi 245 echo -n "Valid DMA channels: " 246 check_dma_avail 0 1 2 3 4 5 6 7 247 echo -n "Valid IRQ channels: " 248 check_irq_avail 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 249 exit 0 250 fi 251 252 # Check for root privileges 253 if [ `id -u` -ne 0 ]; then 254 xecho "You must be root to use this script." 255 exit 1 256 fi 257 258 # 259 # check the snd_ prefix for ALSA module options 260 # snd_ prefix is obsoleted since 0.9.0rc4. 261 # 262 if /sbin/modinfo -p snd | grep -q snd_ ; then 263 mpfx="snd_" 264 else 265 mpfx="" 266 fi 267 268 alsa_device_opts="" 269 if /sbin/modinfo -p snd | grep -q uid ; then 270 if [ x"$alsa_uid" != x0 ]; then 271 alsa_device_opts="$alsa_device_opts ${mpfx}device_uid=$alsa_uid" 272 fi 273 if [ x"$alsa_gid" != x0 ]; then 274 alsa_device_opts="$alsa_device_opts ${mpfx}device_gid=$alsa_gid" 275 fi 276 fi 277 if /sbin/modinfo -p snd | grep -q device_mode ; then 278 if [ x"$alsa_mode" != x0 ]; then 279 alsa_device_opts="$alsa_device_opts ${mpfx}device_mode=$alsa_mode" 280 fi 281 fi 282 283 case `uname -r` in 284 2.6.*) 285 kernel="new" 286 ;; 287 *) 288 kernel="old" 289 ;; 290 esac 291 292 # cfgfile = base config file to remove/update the sound setting 293 # cfgout = new config file to write the sound setting (if different from $cfgfile) 294 cfgout="" 295 cfgoldout="" 296 if [ -n "$cfgfile" ]; then 297 if [ ! -r "$cfgfile" ]; then 298 xecho "ERROR: The config file doesn't exist: " 299 echo $cfgfile 300 exit 1 301 fi 302 else 303 if [ "$kernel" = "new" ]; then 304 cfgfile="/etc/modprobe.conf" 305 if [ -d /etc/modprobe.d ]; then 306 cfgout="/etc/modprobe.d/50-sound.conf" 307 cfgoldout="/etc/modprobe.d/sound" 308 if [ ! -f $cfgout ]; then 309 case "$(modprobe -V)" in 310 "module-init-tools version "3.[789]*|\ 311 "module-init-tools version "3.1[0-9]*) 312 ;; 313 "kmod version "*) 314 ;; 315 *) 316 cfgout="/etc/modprobe.d/sound" 317 cfgoldout="" 318 ;; 319 esac 320 fi 321 fi 322 elif [ "$distribution" = "debian" ]; then 323 cfgfile="/etc/modutils/sound" 324 elif [ -e /etc/modules.conf ]; then 325 cfgfile="/etc/modules.conf" 326 elif [ -e /etc/conf.modules ]; then 327 cfgfile="/etc/conf.modules" 328 else 329 cfgfile="/etc/modules.conf" 330 touch /etc/modules.conf 331 fi 332 fi 333 334 # Check for dialog, whiptail, gdialog, awk, ... ? 335 if type -p dialog > /dev/null; then 336 DIALOG=dialog 337 else 338 if type -p whiptail > /dev/null; then 339 whiptail_wrapper() { 340 X1="$1" 341 X2="$2" 342 if [ $1 = --yesno ]; then 343 X3=`expr $3 + 2` 344 else 345 X3=$3 346 fi 347 shift 3 348 whiptail "$X1" "$X2" $X3 "$@" 349 } 350 DIALOG=whiptail_wrapper 351 else 352 xecho "Error, dialog or whiptail not found." 353 exit 1 354 fi 355 fi 356 if type -p awk > /dev/null; then : 357 else 358 xecho "Error, awk not found. Can't continue." 359 exit 1 360 fi 361 362 # 363 # remove entries by yast2 sound configurator 364 # 365 remove_y2_block() { 366 awk ' 367 /^alias sound-slot-[0-9]/ { next } 368 /^alias char-major-116 / { next } 369 /^alias char-major-14 / { next } 370 /^alias snd-card-[0-9] / { next } 371 /^options snd / { next } 372 /^options snd-/ { next } 373 /^options off / { next } 374 /^alias sound-service-[0-9]/ { next } 375 /^# YaST2: sound / { next } 376 { print }' 377 } 378 379 # 380 # remove entries by sndconfig sound configurator 381 # 382 # found strings to search for in WriteConfModules, 383 # from sndconfig 0.68-4 (rawhide version) 384 385 remove_sndconfig_block() { 386 awk ' 387 /^alias sound-slot-0/ { modulename = $3 ; next } 388 /^alias sound-slot-[0-9]/ { next } 389 /^post-install sound-slot-[0-9] / { next } 390 /^pre-remove sound-slot-[0-9] / { next } 391 /^options sound / { next } 392 /^alias synth0 opl3/ { next } 393 /^options opl3 / { next } 394 /^alias midi / { mididev = $3 ; next } 395 /^options / { if ($2 == mididev) next } 396 /^pre-install / { if ($2 == mididev) next } 397 /^alias synth0 / { synth = $3 ; next } 398 /^post-install / { if ($2 == synth) next } 399 /^options sb / { next } 400 /^post-install .+ \/bin\/modprobe "aci"/ { if ($2 == modulename) next } 401 /^options adlib_card / { next } 402 /^options .+ isapnp=1/ { if ($2 == modulename) next } 403 /^options i810_audio / { next } 404 /^options / {if ($2 == modulename) next } 405 { print }' 406 } 407 408 # 409 # remove the previous configuration by alsaconf 410 # 411 remove_ac_block() { 412 awk '/^'"$ACB"'$/,/^'"$ACE"'$/ { next } { print }' 413 } 414 415 # 416 # set default mixer volumes 417 # 418 set_mixers() { 419 amixer -s -q <<EOF 420 set Master 75% unmute 421 set Master -12dB 422 set 'Master Mono' 75% unmute 423 set 'Master Mono' -12dB 424 set Front 75% unmute 425 set Front -12dB 426 set PCM 90% unmute 427 set PCM 0dB 428 mixer Synth 90% unmute 429 mixer Synth 0dB 430 mixer CD 90% unmute 431 mixer CD 0dB 432 # mute mic 433 set Mic 0% mute 434 # ESS 1969 chipset has 2 PCM channels 435 set PCM,1 90% unmute 436 set PCM,1 0dB 437 # Trident/YMFPCI/emu10k1 438 set Wave 100% unmute 439 set Music 100% unmute 440 set AC97 100% unmute 441 # CS4237B chipset: 442 set 'Master Digital' 75% unmute 443 # Envy24 chips with analog outs 444 set DAC 90% unmute 445 set DAC -12dB 446 set DAC,0 90% unmute 447 set DAC,0 -12dB 448 set DAC,1 90% unmute 449 set DAC,1 -12dB 450 # some notebooks use headphone instead of master 451 set Headphone 75% unmute 452 set Headphone -12dB 453 set Playback 100% unmute 454 # turn off digital switches 455 set "SB Live Analog/Digital Output Jack" off 456 set "Audigy Analog/Digital Output Jack" off 457 EOF 458 } 459 460 461 # INTRO 462 intro() { 463 local msg=$(xmsg " 464 ALSA CONFIGURATOR 465 version %s 466 467 This script is a configurator for 468 Advanced Linux Sound Architecture (ALSA) driver. 469 470 471 If ALSA is already running, you should close all sound 472 apps now and stop the sound driver. 473 alsaconf will try to do this, but it's not 100%% sure." $version) 474 $DIALOG --msgbox "$msg" 20 63 || acex 0 475 } 476 477 # FAREWELL 478 farewell() { 479 local msg=$(gettext " 480 481 OK, sound driver is configured. 482 483 ALSA CONFIGURATOR 484 485 will prepare the card for playing now. 486 487 Now I'll run alsasound init script, then I'll use 488 amixer to raise the default volumes. 489 You can change the volume later via a mixer 490 program such as alsamixer or gamix. 491 492 ") 493 $DIALOG --msgbox "$msg" 17 60 || acex 0 494 } 495 496 # Exit function 497 acex() { 498 cleanup 499 clear 500 exit $1 501 } 502 503 # 504 # search for alsasound init script 505 # 506 507 if [ "$distribution" = "debian" ]; then 508 rcalsasound=/etc/init.d/alsa 509 elif [ -x /etc/rc.d/rc.alsa ]; then 510 rcalsasound=/etc/rc.d/rc.alsa 511 elif [ -x /etc/init.d/alsasound ]; then 512 rcalsasound=/etc/init.d/alsasound 513 elif [ -x /usr/sbin/rcalsasound ]; then 514 rcalsasound=/usr/sbin/rcalsasound 515 elif [ -x /sbin/rcalsasound ]; then 516 rcalsasound=/sbin/rcalsasound 517 elif [ -x /etc/rc.d/init.d/alsasound ]; then 518 rcalsasound=/etc/rc.d/init.d/alsasound 519 elif [ -x /etc/init.d/alsa ]; then 520 rcalsasound=/etc/init.d/alsa 521 else 522 rcalsasound=rcalsasound 523 fi 524 525 526 # MAIN 527 if [ -d $PROCFS/asound ]; then 528 $rcalsasound stop >/dev/null 2>&1 529 $rcalsasound unload >/dev/null 2>&1 530 /sbin/rmmod dmasound dmasound_awacs 2>/dev/null 531 fi 532 533 534 cleanup () { 535 killall -9 aplay arecord >/dev/null 2>&1 536 /sbin/modprobe -r isapnp >/dev/null 2>&1 537 /sbin/modprobe -r isa-pnp >/dev/null 2>&1 538 rm -f "$TMP" "$addcfg" "$FOUND" "$DUMP" 539 } 540 trap cleanup 0 541 542 TMP=`mktemp -q /tmp/alsaconf.XXXXXX` 543 if [ $? -ne 0 ]; then 544 xecho "Can't create temp file, exiting..." 545 exit 1 546 fi 547 addcfg=`mktemp -q /tmp/alsaconf.XXXXXX` 548 if [ $? -ne 0 ]; then 549 xecho "Can't create temp file, exiting..." 550 exit 1 551 fi 552 FOUND=`mktemp -q /tmp/alsaconf.XXXXXX` 553 if [ $? -ne 0 ]; then 554 xecho "Can't create temp file, exiting..." 555 exit 1 556 fi 557 DUMP=`mktemp -q /tmp/alsaconf.XXXXXX` 558 if [ $? -ne 0 ]; then 559 xecho "Can't create temp file, exiting..." 560 exit 1 561 fi 562 563 # convert ISA PnP id number to string 'ABC' 564 convert_isapnp_id () { 565 if [ -z "$1" ]; then 566 echo "XXXX" 567 return 568 fi 569 let a='('$1'>>2) & 0x3f' 570 let b='(('$1' & 0x03) << 3) | (('$1' >> 13) & 0x07)' 571 let c='('$1'>> 8) & 0x1f' 572 strs='@ABCDEFGHIJKLMNOPQRSTUVWXYZ' 573 echo ${strs:$a:1}${strs:$b:1}${strs:$c:1} 574 } 575 576 # swap high & low bytes 577 swap_number () { 578 if [ -z "$1" ]; then 579 echo "0000" 580 return 581 fi 582 let v='(('$1'>>8)&0xff)|(('$1'&0xff)<<8)' 583 printf "%04x" $v 584 } 585 586 # build card database 587 # build_card_db filename 588 build_card_db () { 589 MODDIR=/lib/modules/`uname -r` 590 last_driver="" 591 echo -n > $1 592 593 # list pci cards 594 while read driver vendor device dummy; do 595 if expr $driver : 'snd-.*' >/dev/null ; then 596 if [ "$last_driver" != "$driver" ]; then 597 echo $driver.o 598 last_driver=$driver 599 fi 600 id1=`printf '0x%04x' $vendor` 601 id2=`printf '0x%04x' $device` 602 echo "PCI: $id1=$id2" 603 fi 604 done < $MODDIR/modules.pcimap >> $1 605 606 # list isapnp cards 607 while read driver cardvendor carddevice data vendor func; do 608 if expr $driver : 'snd-.*' >/dev/null ; then 609 if [ "$last_driver" != "$driver" ]; then 610 echo $driver.o 611 last_driver=$driver 612 fi 613 id1=`convert_isapnp_id $cardvendor` 614 dev1=`swap_number $carddevice` 615 id2=`convert_isapnp_id $vendor` 616 dev2=`swap_number $func` 617 echo "ISAPNP: $id1$dev1=$id2$dev2" 618 fi 619 done < $MODDIR/modules.isapnpmap >> $1 620 } 621 622 # 623 # probe cards 624 # 625 probe_cards () { 626 found="0" 627 test -r $PROCFS/isapnp || /sbin/modprobe isapnp >/dev/null 2>&1 628 test -r $PROCFS/isapnp || /sbin/modprobe isa-pnp >/dev/null 2>&1 629 if [ -r $PROCFS/isapnp ]; then 630 cat $PROCFS/isapnp >"$DUMP" 631 found="1" 632 elif [ -d $SYSFS/bus/pnp/devices ]; then 633 # use 2.6 kernel's sysfs output 634 # fake the isapnp dump 635 index=0 636 bindex=0 637 for d1 in $SYSFS/devices/pnp* ; do 638 for d2 in $d1/*:* ; do 639 if [ -r $d2/card_id ]; then 640 id=`cat $d2/card_id` 641 name=`cat $d2/name` 642 echo "Card $index '$id:$name' " >> "$DUMP" 643 index=$[$index+1] 644 found="1" 645 else if [ -r $d2/id ]; then 646 # FIXME: multiple id might be present (separated with new-line) 647 id=`head -n 1 $d2/id` 648 echo "BIOS $bindex '$id' " >> "$DUMP" 649 bindex=$[$bindex+1] 650 found="1" 651 fi 652 fi 653 done 654 done 655 fi 656 if [ "$found" = "0" ]; then 657 echo -n >"$DUMP" 658 fi 659 CARDID_DB=/var/tmp/alsaconf.cards 660 if [ ! -r $CARDID_DB ]; then 661 use_modinfo_db=1 662 fi 663 if [ $use_modinfo_db != 1 ]; then 664 if [ $CARDID_DB -ot /lib/modules/`uname -r`/modules.dep ]; then 665 use_modinfo_db=1 666 fi 667 fi 668 if [ $use_modinfo_db = 1 ]; then 669 xecho "Building card database.." 670 build_card_db $CARDID_DB 671 fi 672 if [ ! -r $CARDID_DB ]; then 673 xecho "No card database is found.." 674 exit 1 675 fi 676 ncards=`grep '^snd-.*\.o$' $CARDID_DB | wc -w` 677 678 msg=$(gettext "Searching sound cards") 679 awk ' 680 BEGIN { 681 format="%-40s %s\n"; 682 ncards='"$ncards"'; 683 idx=0; 684 } 685 /^snd-.*\.o$/{ 686 sub(/.o$/, ""); 687 driver=$0; 688 perc=(idx * 100) / (ncards + 1); 689 print int(perc); 690 idx++; 691 } 692 /^[<literal space><literal tab>]*PCI: /{ 693 gsub(/0x/, ""); 694 gsub(/=/, ":"); 695 x = sprintf ("'$lspci' -n 2>/dev/null| grep '"' 04..: '"' | grep %s", $2); 696 if (system (x) == 0) 697 printf "%s %s\n", $2, driver >>"'"$FOUND"'" 698 } 699 /^[<literal space><literal tab>]*ISAPNP: /{ 700 id2 = substr($0, index($0, "=")+1); 701 gsub(/=.*/, ""); 702 x = sprintf ("grep '\''^Card [0-9] .%s:'\'' '"$DUMP"'", $2); 703 if (system (x) == 0) 704 printf "%s %s\n", $2, driver >>"'"$FOUND"'" 705 else if (index($2, "ffff") > 0) { 706 x = sprintf ("grep '\''^BIOS [0-9]* .%s.'\'' '"$DUMP"'", id2); 707 if (system (x) == 0) 708 printf "%s %s\n", id2, driver >>"'"$FOUND"'" 709 } 710 }' < $CARDID_DB |\ 711 $DIALOG --gauge "$msg" 6 40 0 712 713 # 714 # PowerMac 715 # 716 if grep -q MacRISC $PROCFS/cpuinfo; then 717 MODDIR=/lib/modules/`uname -r` 718 find $MODDIR -name 'snd-powermac*' -print | \ 719 while read i; do 720 i=${i##*/} 721 i=${i%%.o} 722 i=${i%%.ko} 723 echo "PowerMac $i" >> $FOUND 724 done 725 fi 726 727 # 728 # Sparc 729 # 730 if grep -q Sparc $PROCFS/cpuinfo; then 731 test -r $PROCFS/openprom/name || /bin/mount -t openpromfs none $PROCFS/openprom >/dev/null 2>&1 732 # Check for an "audio" device 733 audio= 734 compat= 735 if test -r $PROCFS/openprom; then 736 audio=`find $PROCFS/openprom -follow -type d -name "audio*" -print` 737 fi 738 if test -n "$audio"; then 739 compat=`cat $audio/compatible` 740 compat=${compat#\'} 741 compat=${compat%\'} 742 compat=${compat#SUNW,} 743 fi 744 # Go through all cards we have 745 MODDIR=/lib/modules/`uname -r` 746 find $MODDIR -name 'snd-sun-*' -print | \ 747 while read i; do 748 i=${i##*/} 749 i=${i%%.o} 750 i=${i%%.ko} 751 sdev=`echo ${i#snd-sun-} | tr "[a-z]" "[A-Z]"` 752 753 if test "$sdev" = "$compat"; then 754 echo "$sdev $i" >> $FOUND 755 elif test -r $PROCFS/openprom; then 756 find $PROCFS/openprom -follow -type d -name "SUNW,${sdev}*" \ 757 -exec echo "$sdev $i" \; 2>/dev/null >> $FOUND 758 else 759 echo "$sdev $i" >> $FOUND 760 fi 761 done 762 fi 763 } 764 765 # 766 # look for a descriptive device name from the given device id 767 # 768 find_device_name () { 769 if expr "$1" : '[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:[0-9a-f][0-9a-f][0-9a-f][0-9a-f]' >/dev/null; then 770 $lspci -d $1 2>/dev/null| sed -e 's/^.*:..\.. [^:]*: //g' 771 return 772 elif expr "$1" : '[A-Z@][A-Z@][A-Z@][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' >/dev/null; then 773 cardname=`grep '^Card [0-9]\+ .'$1':' $DUMP | head -n 1 | sed -e 's/^Card [0-9]\+ '\''.*:\(.*\)'\'' .*$/\1/'` 774 echo $cardname 775 else 776 echo $1 777 fi 778 } 779 780 # get hwcfg file type from the given driver name 781 get_hwcfg_type () { 782 while read dev driver; do 783 if [ "$driver" = "$1" ]; then 784 case "$dev" in 785 *:*) 786 # FIXME: need to look around /sys/bus/pci/* (or use vpid-* ?) 787 devid=`$lspci -d "$dev" | head -n 1 | sed -e 's/ .*$//'` 788 case "$devid" in 789 *:*:*.*) ;; 790 *) devid="0000:$devid" ;; 791 esac 792 echo bus-pci-$devid 793 ;; 794 *) 795 echo $driver 796 ;; 797 esac 798 break 799 fi 800 done 801 } 802 803 # clean up all hwcfg-* files containing ALSA modules 804 # alsaconf sets up exclusively 805 cleanup_hwcfg () { 806 for i in /etc/sysconfig/hardware/hwcfg-*; do 807 grep -q "MODULE='snd-" $i && rm -f $i 808 done 809 } 810 811 # 812 # set up /etc/sysconfig/hardware/hwcfg-* stuff 813 # 814 setup_hwcfg () { 815 card=$1 816 cleanup_hwcfg 817 cfg=`echo "$devs_olist" | get_hwcfg_type $card` 818 echo "MODULE='$card'" > /etc/sysconfig/hardware/hwcfg-$cfg 819 echo "STARTMODE='auto'" >> /etc/sysconfig/hardware/hwcfg-$cfg 820 } 821 822 823 # 824 # configure and try test sound 825 # 826 ac_config_card () { 827 828 CARD_DRIVER=snd-$1 829 CARD_OPTS="${*:2}" 830 831 if [ -n "$cfgout" ]; then 832 msg=$(xmsg " 833 Configuring %s 834 Do you want to modify %s (and %s if present)?" $CARD_DRIVER $cfgout $cfgfile) 835 $DIALOG --yesno "$msg" 10 50 || acex 0 836 else 837 msg=$(xmsg " 838 Configuring %s 839 Do you want to modify %s?" $CARD_DRIVER $cfgfile) 840 $DIALOG --yesno "$msg" 8 50 || acex 0 841 fi 842 clear 843 844 # Copy conf.modules and make changes. 845 ACB="# --- BEGIN: Generated by ALSACONF, do not edit. ---" 846 ACE="# --- END: Generated by ALSACONF, do not edit. ---" 847 848 # Detect 2.2.X kernel 849 KVER=`uname -r | tr ".-" " "` 850 KVER1=`echo $KVER | cut -d" " -f1` 851 KVER2=`echo $KVER | cut -d" " -f2` 852 if [ $KVER1 -ge 2 ] && [ $KVER2 -ge 2 ]; then 853 SOUND_CORE="soundcore" 854 else 855 SOUND_CORE="snd" 856 fi 857 858 if [ -r $cfgfile ] ; then 859 if [ "$distribution" = "redhat" -o "$distribution" = "fedora" ] ; then 860 remove_ac_block < $cfgfile | remove_sndconfig_block | uniq > $TMP 861 else 862 remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP 863 fi 864 fi 865 866 if [ -z "$have_alias" -a "$kernel" = "new" ]; then 867 if grep -q char-major-116 /lib/modules/`uname -r`/modules.alias; then 868 have_alias="yes" 869 fi 870 fi 871 if [ -z "$have_alias" ]; then 872 echo "alias char-major-116 snd 873 alias char-major-14 $SOUND_CORE 874 alias sound-service-0-0 snd-mixer-oss 875 alias sound-service-0-1 snd-seq-oss 876 alias sound-service-0-3 snd-pcm-oss 877 alias sound-service-0-8 snd-seq-oss 878 alias sound-service-0-12 snd-pcm-oss" >> $addcfg 879 fi 880 if [ -n "$alsa_device_opts" ]; then 881 echo "options snd $alsa_device_opts" >> $addcfg 882 fi 883 echo "alias snd-card-0 $CARD_DRIVER 884 alias sound-slot-0 $CARD_DRIVER" >> $addcfg 885 if [ -n "$CARD_OPTS" ]; then 886 echo "options $CARD_DRIVER $CARD_OPTS" >> $addcfg 887 fi 888 889 if [ -n "$cfgout" ]; then 890 [ ! -r "$cfgfile" ] || cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile" 891 cmp -s "$addcfg" "$cfgout" || cat "$addcfg" > "$cfgout" 892 test -n "$cfgoldout" && rm -f "$cfgoldout" 893 else 894 echo "$ACB 895 # --- ALSACONF version $version ---" >> $TMP 896 cat "$addcfg" >> "$TMP" 897 echo "$ACE 898 " >> $TMP 899 cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile" 900 fi 901 902 /sbin/depmod -a 2>/dev/null 903 904 # remove yast2 entries (- only for suse distro) 905 if [ -f /var/lib/YaST/unique.inf ]; then 906 awk ' 907 BEGIN { in_sound=0; } 908 /^\[sound\]$/ { print; in_sound=1; next; } 909 /^\[.+\]$/ { print; in_sound=0; next; } 910 { if (in_sound == 0) { print; } } 911 ' < /var/lib/YaST/unique.inf > $TMP 912 cp -f $TMP /var/lib/YaST/unique.inf 913 fi 914 915 # set up /etc/sysconfig/hardware/* 916 if [ "$distribution" = "suse" ]; then 917 case "$suse_version" in 918 10.[012]*|10) 919 setup_hwcfg $CARD_DRIVER 920 ;; 921 esac 922 fi 923 924 farewell 925 clear 926 case "$distribution" in 927 gentoo | debian) 928 xecho "Running update-modules..." 929 update-modules 930 ;; 931 esac 932 if [ -x $rcalsasound ] ; then 933 echo Loading driver... 934 $rcalsasound restart 935 fi 936 echo Setting default volumes... 937 if [ -x $bindir/set_default_volume ]; then 938 $bindir/set_default_volume -f 939 else 940 set_mixers 941 fi 942 if [ -f $TESTSOUND ]; then 943 msg=$(gettext " 944 The mixer is set up now for for playing. 945 Shall I try to play a sound sample now? 946 947 NOTE: 948 If you have a big amplifier, lower your volumes or say no. 949 Otherwise check that your speaker volume is open, 950 and look if you can hear test sound. 951 ") 952 if $DIALOG --yesno "$msg" 13 65 953 then 954 clear 955 echo 956 aplay -N $TESTSOUND 957 fi 958 fi 959 mkdir -p -m 0755 @ASOUND_STATE_DIR@ 960 if [ ! -r @ASOUND_STATE_DIR@/asound.state ]; then 961 xecho "Saving the mixer setup used for this in @ASOUND_STATE_DIR@/asound.state." 962 $sbindir/alsactl store 963 fi 964 clear 965 xecho " 966 =============================================================================== 967 968 Now ALSA is ready to use. 969 For adjustment of volumes, use your favorite mixer. 970 971 Have a lot of fun! 972 973 " 974 } 975 976 # check playback 977 # return 0 - OK, 1 - NG, 2 - not working (irq/dma problem) 978 ac_try_load () { 979 test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE" 980 /sbin/modprobe snd-$1 ${*:2} >/dev/null 2>&1 981 if $lsmod | grep -q -E '^(snd-|snd_)'$1' '; then 982 : ; 983 else 984 /sbin/modprobe -r snd-$1 >/dev/null 2>&1 985 return 1 986 fi 987 988 # mute mixers 989 amixer set Master 0% mute >/dev/null 2>&1 990 amixer set PCM 0% mute >/dev/null 2>&1 991 992 # output 0.5 sec 993 head -c 4000 < /dev/zero | aplay -N -r8000 -fS16_LE -traw -c1 > /dev/null 2>&1 & 994 # remember pid 995 pp=$! 996 # sleep for 2 seconds (to be sure -- 1 sec would be enough) 997 sleep 2 998 # kill the child process if still exists. 999 kill -9 $pp > /dev/null 2>&1 1000 st=$? 1001 ac_cardname=`head -n 1 $PROCFS/asound/cards | sed -e 's/^[0-9].* - \(.*\)$/\1/'` 1002 /sbin/modprobe -r snd-$1 >/dev/null 2>&1 1003 if [ $st = 0 ]; then 1004 # irq problem? 1005 test -n "$LOGFILE" && echo "no playback return" >> "$LOGFILE" 1006 return 2 1007 else 1008 # seems ok! 1009 test -n "$LOGFILE" && echo "playback OK" >> "$LOGFILE" 1010 return 0 1011 fi 1012 } 1013 1014 # check capture 1015 # return 0 - OK, 1 - NG, 2 - not working (irq/dma problem) 1016 # ac_try_capture card duplex opts 1017 ac_try_capture () { 1018 test -n "$LOGFILE" && echo "$1 ${*:2}" >> "$LOGFILE" 1019 /sbin/modprobe snd-$1 ${*:3} >/dev/null 2>&1 1020 if $lsmod | grep -q -E '^(snd-|snd_)'$1' '; then 1021 : ; 1022 else 1023 /sbin/modprobe -r snd-$1 >/dev/null 2>&1 1024 return 1 1025 fi 1026 1027 # mute mixers 1028 amixer set Master 0% mute >/dev/null 2>&1 1029 amixer set PCM 0% mute >/dev/null 2>&1 1030 1031 play_pid=0 1032 if [ $2 = yes ]; then 1033 # try duplex - start dummy playing 1034 aplay -N -r8000 -fS16_LE -traw -c1 < /dev/zero > /dev/null 2>&1 & 1035 play_pid=$! 1036 fi 1037 # record 1sec 1038 arecord -N -d1 > /dev/null 2>&1 & 1039 # remember pid 1040 pp=$! 1041 # sleep for 2 seconds 1042 sleep 2 1043 # kill the child process if still exists. 1044 kill -9 $pp > /dev/null 2>&1 1045 st=$? 1046 # kill playback process if any 1047 test $play_pid != 0 && kill -9 $play_pid 1048 /sbin/modprobe -r snd-$1 >/dev/null 2>&1 1049 if [ $st = 0 ]; then 1050 test -n "$LOGFILE" && echo "capture no return" >> "$LOGFILE" 1051 return 2 1052 else 1053 test -n "$LOGFILE" && echo "capture OK" >> "$LOGFILE" 1054 return 0 1055 fi 1056 } 1057 1058 get_dma_pair () { 1059 case $1 in 1060 0) 1061 echo 1 3 5;; 1062 1) 1063 echo 0 3 5;; 1064 3) 1065 echo 1 0 5;; 1066 5) 1067 echo 3 1 0;; 1068 esac 1069 } 1070 1071 # 1072 # check playback on specified irqs 1073 # 1074 # ac_try_irq card opts irqs... 1075 # return 0 - OK, 1 - NG, 2 - not working (dma problem?) 1076 # 1077 ac_try_irq () { 1078 card=$1 1079 opts="$2 ${mpfx}irq=$3" 1080 ac_try_load $card $opts >/dev/null 2>&1 1081 result=$? 1082 case $result in 1083 0) 1084 ac_opts="$opts" 1085 return 0 1086 ;; 1087 2) 1088 for irq in ${*:4}; do 1089 opts="$2 ${mpfx}irq=$irq" 1090 ac_try_load $card $opts >/dev/null 2>&1 1091 if [ $? = 0 ]; then 1092 ac_opts="$opts" 1093 return 0 1094 fi 1095 done 1096 return 2 1097 ;; 1098 esac 1099 return 1 1100 } 1101 1102 # 1103 # check playback/capture on dma1 & dma2 & specified irqs 1104 # 1105 # ac_try_dmas card opts irqs... 1106 # return 0 - OK, 1 - NG 1107 # 1108 ac_try_dmas () { 1109 dma_list=`check_dma_avail 1 0 3 5` 1110 for irq in ${*:3}; do 1111 for dma1 in $dma_list; do 1112 for dma2 in `get_dma_pair $dma1`; do 1113 opts="$2 ${mpfx}dma1=$dma1 ${mpfx}dma2=$dma2 ${mpfx}irq=$irq" 1114 ac_try_load $1 $opts >/dev/null 2>&1 1115 result=$? 1116 if [ $result = 1 ]; then 1117 if [ $try_all_combination = 1 ]; then 1118 continue 1119 else 1120 return 1 1121 fi 1122 elif [ $result = 0 ]; then 1123 test -n "$LOGFILE" && echo "Now checking capture..." >> "$LOGFILE" 1124 ac_opts="$opts" 1125 ac_try_capture $1 yes $opts >/dev/null 2>&1 && return 0 1126 for d in yes no; do 1127 for dma2 in $dma_list; do 1128 if [ $dma1 != $dma2 ]; then 1129 opts="$2 ${mpfx}dma1=$dma1 ${mpfx}dma2=$dma2 ${mpfx}irq=$irq" 1130 ac_opts="$opts" 1131 ac_try_capture $1 $d $opts >/dev/null 2>&1 && return 0 1132 fi 1133 done 1134 done 1135 return 0 1136 fi 1137 done 1138 done 1139 done 1140 return 1 1141 } 1142 1143 # check if the option $2 exists in card $1: set value $3 1144 ac_check_option () { 1145 if /sbin/modinfo -p snd-$1 | grep -q $2; then 1146 echo "$2=$3" 1147 fi 1148 } 1149 1150 ac_try_card_sb8 () { 1151 card=sb8 1152 irq_list=`check_irq_avail 5 3 9 10 7` 1153 for dma8 in `check_dma_avail 1 3`; do 1154 opts="${mpfx}dma8=$dma8" 1155 ac_try_irq $card "$opts" $irq_list && return 0 1156 done 1157 return 1 1158 } 1159 1160 ac_try_card_sb16 () { 1161 card=sb16 1162 isapnp=`ac_check_option $card ${mpfx}isapnp 0` 1163 opts="$isapnp" 1164 irq_list=`check_irq_avail 5 9 10 7 3` 1165 dma_list=`check_dma_avail 0 1 3` 1166 dma16_list=`check_dma_avail 5 6 7` 1167 # at first try auto-probing by driver itself 1168 ac_try_load $card $opts >/dev/null 2>&1 1169 result=$? 1170 case $result in 1171 0) 1172 ac_opts="$opts" 1173 ac_try_capture $card yes $opts >/dev/null 2>&1 && return 0 1174 for d in yes no; do 1175 for dma8 in $dma_list; do 1176 for irq in $irq_list; do 1177 opts="${mpfx}dma8=$dma8 ${mpfx}irq=$irq $isapnp" 1178 ac_try_capture $card $d $opts >/dev/null 2>&1 && return 0 1179 done 1180 done 1181 done 1182 return 0 1183 ;; 1184 2) 1185 for dma16 in $dma16_list; do 1186 opts="${mpfx}dma16=$dma16 $isapnp" 1187 if ac_try_irq $card "$opts" $irq_list ; then 1188 ac_try_capture $card yes $ac_opts >/dev/null 2>&1 && return 0 1189 ac_opts_saved="$ac_opts" 1190 for d in yes no; do 1191 for dma8 in $dma_list; do 1192 ac_opts="$ac_opts_saved ${mpfx}dma8=$dma8" 1193 ac_try_capture $card $d $ac_opts >/dev/null 2>&1 && return 0 1194 done 1195 done 1196 # return anyway here.. 1197 return 0 1198 fi 1199 done 1200 ;; 1201 esac 1202 return 1 1203 } 1204 1205 ac_try_card_es1688 () { 1206 card=es1688 1207 opts="" 1208 irq_list=`check_irq_avail 5 9 10 7` 1209 for dma8 in `check_dma_avail 1 3 0`; do 1210 opts="${mpfx}dma8=$dma8 ${mpfx}mpu_irq=-1" 1211 ac_try_irq $card "$opts" $irq_list && return 0 1212 done 1213 return 1 1214 } 1215 1216 ac_try_card_es18xx () { 1217 card=es18xx 1218 opts=`ac_check_option $card ${mpfx}isapnp 0` 1219 ac_try_dmas $card "$opts" `check_irq_avail 5 9 10 7` && return 0 1220 return 1 1221 } 1222 1223 ac_try_card_cs4236 () { 1224 card=cs4236 1225 irq_list=`check_irq_avail 5 7 9 11 12 15` 1226 isapnp=`ac_check_option $card ${mpfx}isapnp 0` 1227 for cport in 0x538 0x210 0xf00; do 1228 for port in 0x530 0x534; do 1229 opts="${mpfx}port=$port ${mpfx}cport=$cport $isapnp" 1230 ac_try_dmas $card "$opts" $irq_list && return 0 1231 done 1232 done 1233 return 1 1234 } 1235 1236 ac_try_card_cs4232 () { 1237 card=cs4232 1238 irq_list=`check_irq_avail 5 7 9 11 12 15` 1239 isapnp=`ac_check_option $card ${mpfx}isapnp 0` 1240 for cport in 0x538 0x210 0xf00; do 1241 for port in 0x530 0x534; do 1242 opts="${mpfx}port=$port ${mpfx}cport=$cport $isapnp" 1243 ac_try_dmas $card "$opts" $irq_list && return 0 1244 done 1245 done 1246 return 1 1247 } 1248 1249 ac_try_card_cs4231 () { 1250 card=cs4231 1251 irq_list=`check_irq_avail 5 7 9 11 12 15` 1252 for port in 0x530 0x534; do 1253 opts="${mpfx}port=$port" 1254 ac_try_dmas $card "$opts" $irq_list && return 0 1255 done 1256 return 1 1257 } 1258 1259 ac_try_card_opl3sa2 () { 1260 card=opl3sa2 1261 irq_list=`check_irq_avail 5 9 3 1 11 12 15 0` 1262 isapnp=`ac_check_option $card ${mpfx}isapnp 0` 1263 for port in 0x370 0x538 0xf86 0x100; do 1264 for wss_port in 0x530 0xe80 0xf40 0x604; do 1265 opts="${mpfx}fm_port=-1 ${mpfx}midi_port=-1 ${mpfx}port=$port ${mpfx}wss_port=$wss_port $isapnp" 1266 ac_try_dmas $card "$opts" $irq_list && return 0 1267 done 1268 done 1269 return 1 1270 } 1271 1272 ac_config_legacy () { 1273 title=$(gettext "WARNING") 1274 msg=$(gettext " 1275 Probing legacy ISA cards might make 1276 your system unstable. 1277 1278 Do you want to proceed? 1279 1280 ") 1281 $DIALOG --title "$title" --yesno "$msg" 10 50 || acex 0 1282 1283 if [ x"$1" = x ]; then 1284 probe_list="$LEGACY_CARDS" 1285 else 1286 probe_list=$* 1287 fi 1288 menu_args=() 1289 1290 for card in $probe_list; do 1291 cardname=`/sbin/modinfo -d snd-$card | sed -e 's/^\"\(.*\)\"$/\1/g'` 1292 if [ x"$cardname" != x ]; then 1293 menu_args=("${menu_args[@]}" "$card" "$cardname" "on") 1294 fi 1295 done 1296 if [ x$menu_args = x ]; then 1297 msg=$(gettext "No legacy drivers are available 1298 for your machine") 1299 $DIALOG --msgbox "$msg" 5 50 1300 return 1 1301 fi 1302 title=$(gettext "Driver Selection") 1303 msg=$(gettext " Probing legacy ISA cards 1304 1305 Please select the drivers to probe:") 1306 $DIALOG --title "$title" --checklist "$msg" \ 1307 17 64 8 "${menu_args[@]}" 2> $FOUND || acex 0 1308 1309 if [ $try_all_combination != 1 ]; then 1310 msg=$(gettext " 1311 Shall I try all possible DMA and IRQ combinations? 1312 With this option, some unconventional configuration 1313 might be found, but it will take much longer time.") 1314 if $DIALOG --yesno "$msg" 10 60 1315 then 1316 try_all_combination=1 1317 fi 1318 fi 1319 1320 xecho "Probing legacy cards.. This may take a few minutes.." 1321 echo -n $(gettext "Probing: ") 1322 cards=`cat $FOUND | tr -d \"` 1323 for card in $cards; do 1324 echo -n " $card" 1325 ac_opts="" 1326 if eval ac_try_card_$card ; then 1327 xecho " : FOUND!!" 1328 ac_config_card $card $ac_opts 1329 return 0 1330 fi 1331 done 1332 echo 1333 title=$(gettext "Result") 1334 msg=$(gettext "No legacy cards found") 1335 $DIALOG --title "$title" --msgbox "$msg" 5 50 1336 return 1 1337 } 1338 1339 # 1340 # main part continued.. 1341 # 1342 1343 if test -n "$LOGFILE" ; then 1344 touch "$LOGFILE" 1345 echo -n "Starting alsaconf: " >> "$LOGFILE" 1346 date >> "$LOGFILE" 1347 fi 1348 1349 if [ x"$legacy_probe_card" != x ]; then 1350 ac_opts="" 1351 if eval ac_try_card_$legacy_probe_card >/dev/null 2>&1; then 1352 echo "$ac_opts" 1353 echo "$ac_cardname" 1354 exit 0 1355 else 1356 echo "FAILED" 1357 exit 1 1358 fi 1359 fi 1360 1361 intro 1362 1363 if [ $do_legacy_only = 1 ]; then 1364 ac_config_legacy 1365 exit 0 1366 fi 1367 1368 probe_cards 1369 1370 devs_found=() 1371 devs_olist="" 1372 1373 if [ -s "$FOUND" ]; then 1374 while read dev card ; do 1375 MODDIR=/lib/modules/`uname -r` 1376 find $MODDIR -type f | grep -q -E $card'\.(o|ko)' || continue 1377 cardname=`find_device_name $dev | cut -c 1-64` 1378 if [ -z "$cardname" ]; then 1379 cardname="$card" 1380 fi 1381 card=${card##snd-} 1382 devs_found=("${devs_found[@]}" "$card" "$cardname") 1383 devs_devs=("${devs_devs[@]}" "$card" "$dev") 1384 done <"$FOUND" 1385 devs_olist=`cat $FOUND` 1386 fi 1387 if [ x$devs_found != x ]; then 1388 # 1389 # check for TP600E 1390 # 1391 if [ ${devs_found[0]} = cs46xx ]; then 1392 if $lspci -nv 2>/dev/null| grep -q "Subsystem: 1014:1010"; then 1393 msg=$(gettext " 1394 Looks like you having a Thinkpad 600E or 770 notebook. 1395 On this notebook, CS4236 driver should be used 1396 although CS46xx chip is detected. 1397 1398 Shall I try to snd-cs4236 driver and probe 1399 the legacy ISA configuration?") 1400 if $DIALOG --yesno "$msg" 13 60 1401 then 1402 try_all_combination=1 1403 ac_config_legacy cs4236 1404 exit 0 1405 fi 1406 elif $lspci -nv 2>/dev/null| grep -q "Subsystem: 8086:8080"; then 1407 msg=$(gettext " 1408 Looks like you having a Dell Dimension machine. 1409 On this machine, CS4232 driver should be used 1410 although CS46xx chip is detected. 1411 1412 Shall I try to snd-cs4232 driver and probe 1413 the legacy ISA configuration?") 1414 if $DIALOG --yesno "$msg" 13 60 1415 then 1416 try_all_combination=1 1417 ac_config_legacy cs4232 1418 exit 0 1419 fi 1420 fi 1421 fi 1422 1423 devs_found=("${devs_found[@]}" "legacy" "Probe legacy ISA (non-PnP) chips") 1424 title=$(gettext "Soundcard Selection") 1425 msg=$(gettext " 1426 Following card(s) are found on your system. 1427 Choose a soundcard to configure: 1428 ") 1429 $DIALOG --title "$title" --menu "$msg" 17 76 8 "${devs_found[@]}" --output-fd 3 3> $FOUND || acex 0 1430 card=`head -n 1 $FOUND` 1431 if [ "$card" = "legacy" ]; then 1432 ac_config_legacy 1433 else 1434 ac_config_card "$card" 1435 fi 1436 exit 0 1437 else 1438 msg=$(gettext " 1439 No supported PnP or PCI card found. 1440 1441 Would you like to probe legacy ISA sound cards/chips? 1442 1443 ") 1444 if $DIALOG --yesno "$msg" 9 60 ; then 1445 ac_config_legacy 1446 exit 0 1447 fi 1448 fi 1449 1450 rm -f "$FOUND" "$DUMP" 1451 exit 0