home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / sbin / alsaconf next >
Encoding:
Text File  |  2006-05-21  |  30.3 KB  |  1,252 lines

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