If your devices are present, this modules-conf should work.
The whole autoloading thing is done by these two lines:
alias char-major-116 snd
alias char-major-14 soundcore

What this does is tells the kernel loader to load snd.o when someone
accesses char device with major 116 (and that's all devices in your
/dev/snd/ directory, stuff like pcmC0D0p)
Also, when char device with major 14 is accessed (that's all OSS devices,
like dsp0) soundcore.o should be loaded. If you did not forget to run
"depmod -a" after installing alsa, and your devices are created and you
have permissions to access them, the dependencies should resolve in the
end to loading snd-card-0 which is really snd-via82xx.o

If you boot up and modules don't load, try to play some sound while you
watch the output of
tail -f /var/log/messages
You may see somethign like this:
modprobe: modprobe: Can't locate module char-major-116
This means that either there is no alias for char-major-116 (but you have
it) or the file it's aliased to does not exist (or exists in the wrong
place). Do "uname -a" to make sure you run the kernel you think you run,
then do "find /lib/modules -name '*snd-via82xx*'", you should find it in
/lib/modules/2.4.20-13.7/kernel/sound/snd-via82xx.o
or whatever your kernel version is.

If it's there, and "depmod -a" completes without any error messages, the
module will load. Rather, it'll attempt to load it. You may see in your
/var/log/messages that instead of not being able to locate the module, it
says that there were errors and module was not loaded. Post the error
messages, then may be we can help you.

As for your second question, it's a bit premature to tackle it, what you
are trying to do relies strongly on modules autoloading and dependencies,
get it working first.

There is another way. You can start ALSA like a service, from init.d.
I attached the alsasound script I use, put it into /etc/init.d and symlink
it to /etc/rc5.d as /etc/rc5.d/S87alsasound (or rc3.d if you come up into
runlevel 3). Don't forged to add another link, /etc/rc0.d/K14alsasound
(and rc6.d and rc1.d).

Now try /etc/init.d/alsasound start, and you should have it all working.


On 8 Jun 2003, Michael Williams wrote:
> Hi guys, thanks to help from Fedor Pikus and Boris Goldowsky, I was able
> to build ALSA successfully and it works.  I currently am stymied by 2
> other small issues though.  I have searched the documentation on the
> www.alsa-project.org site, but havent come up with a solution.  My ALSA
> modules arent loading automatically. I have attached my modules.conf to
> the bottom.  I cut and pasted the examples from the section on the
> snd-via82xx driver as instructed, but its not loading automatically.
> One thing I dont understand is the last 2 lines in my example. I couldnt
> find any mention of them on the documentation, are they for OSS and not
> ALSA? Or are they just wrong for ALSA? Also, does their placement
> matter?  What do they do? Also, after I reboot and modprobe snd-via82xx
> I get sound, but first I have to go into the "volume control" applet in
> Gnome and adjust some of the volumes up, they all default to 0. Anyway
> to have the sound system remember your settings across reboots, or at
> least default to a certain value that is audible?
>
> I know thats a lot of questions, thanks a ton for your help so far.
>
> #<modules.conf follows:>
>
> alias eth0 3c59x
> alias usb-controller usb-uhci
> alias char-major-195 nvidia
>
> # ALSA portion
> alias char-major-116 snd
> alias snd-card-0 snd-via82xx
> # module options should go here
>
> # OSS/Free portion
> alias char-major-14 soundcore
> alias sound-slot-0 snd-card-0
>
> # card #1
> alias sound-service-0-0 snd-mixer-oss
> alias sound-service-0-1 snd-seq-oss
> alias sound-service-0-3 snd-pcm-oss
> alias sound-service-0-8 snd-seq-oss
> alias sound-service-0-12 snd-pcm-oss
>
> #BTTV Line
> alias char-major-81 bttv card=64 type=2
>
> post-install sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -L
> >/dev/null 2>&1 || :
> pre-remove sound-slot-0 /bin/aumix-minimal -f /etc/.aumixrc -S
> >/dev/null 2>&1 || :
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
> _______________________________________________
> Alsa-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/alsa-user
>

-- 
                                  Fedor G. Pikus
Mentor Graphics Corporation         | Phone: (503) 685-4857
8405 SW Boeckman Road               | FAX:   (503) 685-1239
Wilsonville, Oregon 97070           | http://www.pikus.net/~pikus/

#!/bin/bash
#
# alsasound     This shell script takes care of starting and stopping
#               the ALSA sound driver.
#
# This script requires /usr/sbin/alsactl and /usr/bin/aconnect programs
# from the alsa-utils package.
#
# Copyright (c) by Jaroslav Kysela <[EMAIL PROTECTED]> 
#
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#
#
# For RedHat 5.0+:
# chkconfig: 2345 87 14
# description: ALSA driver
#
# modified to visually fit into SuSE 6.0+ by Philipp Thomas <[EMAIL PROTECTED]>
# further improvements by Bernd Kaindl, Olaf Hering and Takashi Iwai.
# 
### BEGIN INIT INFO
# Provides:       alsasound
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start:  2 3 5
# Default-Stop:
# Description:    Loading ALSA drivers and store/restore the current setting
### END INIT INFO

if [ -r /etc/rc.config ]; then
  . /etc/rc.config
  rc_warning="\033[33m\033[1m"
else
  rc_done="done"
  rc_warning=""
  rc_reset=""
fi

if [ x$START_ALSA != xno ]; then
  START_ALSA=yes
fi
if [ x$START_ALSA_SEQ != xno ]; then
  START_ALSA_SEQ=yes
fi

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_ALSA=yes
test "$START_ALSA" = yes || exit 0

alsactl=/usr/sbin/alsactl
asoundcfg=/etc/asound.state
aconnect=/usr/bin/aconnect
alsascrdir=/etc/alsa.d

function start() {
  #
  # insert all sound modules
  #

  drivers=`/sbin/modprobe -c | \
    grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | \
    awk '{print $3}'`
  for i in $drivers; do
    if [ "$i" != off ]; then
      echo -n "Starting sound driver: $i "
      /sbin/modprobe $i
      echo -e "$rc_done"
    fi
  done
  #
  # insert sequencer modules
  #
  if [ x"$START_ALSA_SEQ" = xyes -a -r /proc/asound/seq/drivers ]; then
    t=`cut -d , -f 1 /proc/asound/seq/drivers`
    if [ "x$t" != "x" ]; then
      /sbin/modprobe $t
    fi
  fi
  #
  # restore driver settings
  #
  if [ -d /proc/asound ]; then
    if [ ! -r $asoundcfg ]; then
      echo "No mixer config in $asoundcfg, you have to unmute your card!"
    else
      if [ -x $alsactl ]; then
        $alsactl -f $asoundcfg restore
      else
        echo -e "${rc_warning}ERROR: alsactl not found${rc_reset}"
      fi
    fi
  fi
  #
  # run card-dependent scripts
  for i in $drivers; do
    t=${i##snd-}
    if [ -x $alsascrdir/$t ]; then
      $alsascrdir/$t
    fi
  done
}

function terminate() {
  #
  # Kill processes holding open sound devices
  #
  # DEVS=`find /dev/ -follow -type c -maxdepth 1 -print 2>/dev/null | xargs ls -dils | 
grep "1*1[46]," | cut -d: -f2 | cut -d" " -f2; echo /proc/asound/dev/*`
  ossdevs="/dev/admmidi? /dev/adsp? /dev/amidi? /dev/audio* /dev/dmfm* \
     /dev/dmmidi? /dev/dsp* /dev/dspW* /dev/midi0? /dev/mixer? /dev/music \
     /dev/patmgr? /dev/sequencer* /dev/sndstat"
  alsadevs="/proc/asound/dev/*"
  fuser -k $ossdevs $alsadevs 2> /dev/null 1>/dev/null
  #
  # remove all sequencer connections if any
  #
  if [ -f /proc/asound/seq/clients -a -x $aconnect ]; then
    $aconnect --removeall
  fi
}

function stop() {
  #
  # store driver settings
  #
  if [ -x $alsactl ]; then
    $alsactl -f $asoundcfg store
  else
    echo -n -e "${rc_warning}!!!alsactl not found!!!${rc_reset} "
  fi
  #
  # remove all sound modules
  #
  /sbin/lsmod | grep -E "^snd" | grep -v "snd-hammerfall-mem" | while read line; do \
     /sbin/rmmod `echo $line | cut -d ' ' -f 1`; \
  done
  # remove the 2.2 soundcore module (if possible)
  /sbin/rmmod soundcore 2> /dev/null
  /sbin/rmmod gameport 2> /dev/null
}

# See how we were called.
case "$1" in
  start)
        # Start driver if it isn't already up.
        if [ ! -d /proc/asound ]; then
          start
        else
          echo "ALSA driver is already running."
        fi
        ;;
  stop)
        # Stop daemons.
        if [ -d /proc/asound ]; then
          echo -n "Shutting down sound driver: "
          terminate
          stop
          echo -e "$rc_done"
        fi
        ;;
  restart|reload)
        $0 stop
        $0 start
        ;;
  status)
        if [ -d /proc/asound ]; then
          echo -n "ALSA sound driver loaded."
        else
          echo -n "ALSA sound driver not loaded."
        fi
        echo
        ;;
  *)
        echo "Usage: alsasound {start|stop|restart|status}"
        exit 1
esac

exit 0

Reply via email to