slitaz-tools diff tinyutils/soundconf @ rev 183

Rewrited 'mountbox', better inerface, gen list automaicaly, add e2fsck and more...
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 11 00:25:10 2008 +0200 (2008-05-11)
parents 3d38cb216bf1
children 92aedc898747
line diff
     1.1 --- a/tinyutils/soundconf	Fri Mar 14 14:40:24 2008 +0000
     1.2 +++ b/tinyutils/soundconf	Sun May 11 00:25:10 2008 +0200
     1.3 @@ -75,10 +75,11 @@
     1.4    -c|--config file
     1.5                   specify the module config file
     1.6    -R|--resources list available DMA and IRQ resources with debug for legacy
     1.7 +  -M|--module	 load ALSA module device
     1.8    -h|--help      what you're reading"
     1.9  }
    1.10  
    1.11 -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
    1.12 +OPTS=`getopt -o lmL:hp:Pu:g:d:rs:c:RM: --long legacy,modinfo,log:,help,probe:,listprobe,uid:,gid:,devmode:,strict,sound:,config:,resources,module: -n alsaconf -- "$@"` || exit 1
    1.13  eval set -- "$OPTS"
    1.14  
    1.15  do_legacy_only=0
    1.16 @@ -91,6 +92,7 @@
    1.17  TESTSOUND="/usr/share/sounds/alsa/test.wav"
    1.18  try_all_combination=0
    1.19  resources="false"
    1.20 +snd_module=""
    1.21  
    1.22  # legacy support
    1.23  LEGACY_CARDS="opl3sa2 cs4236 cs4232 cs4231 es18xx es1688 sb16 sb8"
    1.24 @@ -123,6 +125,8 @@
    1.25  	cfgfile="$2"; shift 2;;
    1.26      -R|--resources)
    1.27          resources="true"; shift;;
    1.28 +    -M|--module)
    1.29 +	snd_module="$2"; shift 2;;
    1.30      --) shift ; break ;;
    1.31      *) usage ; exit 1 ;;
    1.32      esac
    1.33 @@ -460,6 +464,30 @@
    1.34  }
    1.35  
    1.36  #
    1.37 +# probe this card
    1.38 +#
    1.39 +probe_this_card () {
    1.40 +    echo -n '' > $FOUND
    1.41 +    # list pci cards
    1.42 +    grep snd-$1 /lib/modules/`uname -r`/modules.pcimap | \
    1.43 +    while read driver vendor device dummy; do
    1.44 +	if expr $driver : 'snd-.*' >/dev/null ; then
    1.45 +	    if [ "$last_driver" != "$driver" ]; then
    1.46 +		echo $driver.o
    1.47 +		last_driver=$driver
    1.48 +	    fi
    1.49 +	    id1=`printf '%04x' $vendor`
    1.50 +	    id2=`printf '%04x' $device`
    1.51 +	    echo "PCI: 0x$id1=0x$id2"
    1.52 +	    if $lspci -n 2>/dev/null | grep -q "$id1:$id2"; then
    1.53 +	    	echo "$id1:$id2 $last_driver" >> $FOUND
    1.54 +	    fi
    1.55 +	fi
    1.56 +    done > /var/tmp/alsaconf.mycard
    1.57 +    [ -s $FOUND ]
    1.58 +}
    1.59 +
    1.60 +#
    1.61  # probe cards
    1.62  #
    1.63  probe_cards () {
    1.64 @@ -1088,6 +1116,12 @@
    1.65      exit 0
    1.66  fi
    1.67      
    1.68 +if [ -n "$snd_module" ]; then
    1.69 +    if probe_this_card $snd_module; then
    1.70 +        ac_config_card $snd_module
    1.71 +	exit 0
    1.72 +    fi
    1.73 +fi
    1.74  probe_cards
    1.75  
    1.76  devs_found=""