LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 05-12-2003, 02:19 PM   #1
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 355

Rep: Reputation: 30
How does ALSA work?


I have had the ALSA drivers;libs;utils working for some time
now on my Slackware 9.0 system but I continually get bootup
messages like the following:

Modprobe: modprobe: Can't locate module snd-card-1
Modprobe: modprobe: Can't locate module snd-card-2
Modprobe: modprobe: Can't locate module snd-card-3
Modprobe: modprobe: Can't locate module snd-card-4
Modprobe: modprobe: Can't locate module snd-card-5
Modprobe: modprobe: Can't locate module snd-card-6
Modprobe: modprobe: Can't locate module snd-card-7

These messages appear only on the boot screen and not
in dmesg, messages, debug, syslog, etc.

These appear right at the time rc.modules is loaded and
parsed (following the trail of things which occur within rc.S)
but the only modules (aside from my NIC) which load from
here are:

/sbin/modprobe snd-via82xx
/sbin/modprobe snd-pcm-oss
/sbin/modprobe snd-mixer-oss
/sbin/modprobe snd-seq-oss

lsmod:

via-rhine 13264 1
mii 2496 0 [via-rhine]
snd-seq-oss 29088 0 (unused)
snd-seq-midi-event 3336 0 [snd-seq-oss]
snd-seq 37648 2 [snd-seq-oss snd-seq-midi-event]
snd-pcm-oss 39012 0 (unused)
snd-mixer-oss 13720 0 [snd-pcm-oss]
snd-via82xx 12332 0
snd-ac97-codec 37344 0 [snd-via82xx]
snd-pcm 61216 0 [snd-pcm-oss snd-via82xx]
snd-timer 14824 0 [snd-seq snd-pcm]
snd-mpu401-uart 3248 0 [snd-via82xx]
snd-rawmidi 14016 0 [snd-mpu401-uart]
snd-seq-device 4368 0 [snd-seq-oss snd-seq snd-rawmidi]
snd 31140 0 [snd-seq-oss snd-seq-midi-event snd-seq snd-pcm-oss snd-mixer-oss snd-via82xx snd-ac97-codec snd-pcm snd-timer snd-mpu401-uart snd-rawmidi snd-seq-device]
snd-page-alloc 5116 0 [snd-via82xx snd-pcm]

cat /proc/asound/cards:

0 [8235 ]: VIA8233 - VIA 8235
VIA 8235 at 0xdc00, irq 5

I only have an integrated soundcard (ac97) on a VIA 8233
chipset. I cannot find where these modprobe commands are
coming from, although cat /proc/asound/timers reveals:

G0: system timer : 10000.000us (10000000 ticks)
P0-0-0: PCM playback 0-0-0 : SLAVE
P0-0-1: PCM capture 0-0-1 : SLAVE
P0-0-2: PCM playback 0-0-2 : SLAVE
P0-0-4: PCM playback 0-0-4 : SLAVE
P0-0-6: PCM playback 0-0-6 : SLAVE
P0-1-0: PCM playback 0-1-0 : SLAVE
P0-1-1: PCM capture 0-1-1 : SLAVE

I really am at a loss as to how this is all supposed to work
and the Sound-HOWTO and Alsa-Mini-HOWTO don't offer
much.

I would really like to remove the modprobe commands where
ever they are coming from and gain a fuller understanding
of just how this all works.

Any suggestions?

TIA
 
Old 05-12-2003, 02:35 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,406

Rep: Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965Reputation: 1965
in your alsa config file there will be all those entries, if you only have one sound card, remove the offending lines. mine is in /etc/modules.s/alsa but gentoo puts things in different places...
 
Old 05-12-2003, 04:24 PM   #3
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 355

Original Poster
Rep: Reputation: 30
Apparently /etc/rc.d/init.d/alsasound is the startup script and the
'start ()' function appears to be the offender:

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

However if I take this bit of code and try to run it as a separate
script, it appears to run but produces no output. Therefore I
cannot tell if it is causing this bootup output. Maybe it is only
supposed to run at bootup and will produce nothing once
the system is up and running. Any help here appreciated.

An interesting note: /proc/asound contains a symlink 8235 -> card0/

contents of card0/

-r--r--r-- 1 root root 0 May 12 14:54 ac97#0
-r--r--r-- 1 root root 0 May 12 14:54 ac97#0regs
-r--r--r-- 1 root root 0 May 12 14:54 id
-rw-r--r-- 1 root root 0 May 12 14:54 oss_mixer
dr-xr-xr-x 3 root root 0 May 12 14:54 pcm0c/
dr-xr-xr-x 6 root root 0 May 12 14:54 pcm0p/
dr-xr-xr-x 3 root root 0 May 12 14:54 pcm1c/
dr-xr-xr-x 3 root root 0 May 12 14:54 pcm1p/

pcm0c:
-r--r--r-- 1 root root 0 May 12 14:53 info
-rw-r--r-- 1 root root 0 May 12 14:53 oss
dr-xr-xr-x 2 root root 0 May 12 14:53 sub0/

pcm0p:
-r--r--r-- 1 root root 0 May 12 14:53 info
-rw-r--r-- 1 root root 0 May 12 14:53 oss
dr-xr-xr-x 2 root root 0 May 12 14:53 sub0/
dr-xr-xr-x 2 root root 0 May 12 14:53 sub1/
dr-xr-xr-x 2 root root 0 May 12 14:53 sub2/
dr-xr-xr-x 2 root root 0 May 12 14:53 sub3/

pcm1c:
-r--r--r-- 1 root root 0 May 12 14:53 info
-rw-r--r-- 1 root root 0 May 12 14:53 oss
dr-xr-xr-x 2 root root 0 May 12 14:53 sub0/

pcm1p:
-r--r--r-- 1 root root 0 May 12 14:53 info
-rw-r--r-- 1 root root 0 May 12 14:53 oss
dr-xr-xr-x 2 root root 0 May 12 14:53 sub0/

Is it possible that the subX components are what modprobe is
trying to look for?

As I say, I would really like to know how this is all supposed to
work rather than fishing around for 'magic settings'.
 
Old 05-12-2003, 05:47 PM   #4
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
Quote:
I would really like to remove the modprobe commands where
ever they are coming from and gain a fuller understanding
of just how this all works.
Which commands?
Slackware is different from a lot of distros in that the start up scripts are viscioualy different. rc.modules is a script which runs the required /sbin/modprobe command to load the module similar to if you were given a command prompt and had to load each module manually.

When you run that bit of script yourself, it won't do anything because its checking for anything that is already loaded as a module first (which you showed us with the lsmod command) and anything sound related that isn't there will be started, and those that are there are ignored.

Now, I personally stuffed the whole trying to get slackware to play nice with sysVinit startup scripts and so instead i set up /etc/modules.conf so that when a program wants to use sound, kmod (the automagic module loader) will attempt to load the relevant modules itself.

There should be something on www.alsa-project.org under the documentation link to help with this. Look for their wiki documentation and your card under that.

Here is what my /etc/modules.conf looks like for my sound blaster live value:

Code:
# ALSA portion
        alias char-major-116 snd
        alias snd-card-0 snd-emu10k1
        # 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
 
# OSS/Free portion - card #1
        alias sound-slot-0 snd-card-0
        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
Alex
 
Old 05-12-2003, 09:35 PM   #5
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 355

Original Poster
Rep: Reputation: 30
Thank you! Now I know what modules.conf is for.

With Slackware I've only known rc.modules for loading
kernel modules and of course they are loaded at bootup
and not as needed as I assume kmod does.

When I ran the bit of code from alsasound I did expect to
see the modprobe commands trying to load the snd-card-1-7
since they couldn't have possibly been loaded.

I guess I'll play aund with it a little more and see what I can
see.

Are you sure there isn't a good tutorial around explaining
how the ALSA setup works? I know it's not at ALSA.

Thanks again.
 
Old 05-13-2003, 04:46 AM   #6
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
Quote:
Are you sure there isn't a good tutorial around explaining
how the ALSA setup works? I know it's not at ALSA.
have you tried this http://www.redhat.com/mirrors/LDP/HO...lsa-sound.html

No there isn't really a good one unfortunately linked to one their own site which annoys me. I used a multitude of docs from this site http://www.djcj.org/LAU/guide/index.php which is referenced on the alsa-projects documentation website. That and looking at the "souncard matrix" and the alsa wiki for my card eventually I got my set up done. This lack of ease put me off alsa for ages.

Oh well. If in doubt, www.google.co.uk/linux and www.tldp.org should get you somewhere.

HTH

Alex
 
Old 05-13-2003, 10:54 AM   #7
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 355

Original Poster
Rep: Reputation: 30
The redhat link was only to the ALSA-mini-HOWTO which I had
read but did not feel I got much out of. Thanks for your input,
though.

After reading a bit more about KMOD module autoloading I
took the plunge and entered the ALSA config commands in
modules.conf.

While I don't get the bootup messages anymore, I do get the
old warning about sound drivers not being loaded when I
startup Gnome or KDE. However, this is apparently the trigger
KMOD needs to load the drivers and if I open an xterm and
do an lsmod, there they are and sound does work from then on.

I think I have just substituted one warning message for another
but I suppose I should take heart that with KMOD, memory is
not burdened with additional code until I need it. With that in
mind, I should also probably remove the modules after I have
finished using them. One recommendation for this that I hapened
across suggests the following:

To periodically unload unused modules, put something like the following in root's crontab entry:

0-59/5 * * * * /sbin/rmmod -a

However I think this removes all modules which might be going
a tad too far.

Ah well, onward and upward.
 
Old 05-13-2003, 12:38 PM   #8
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 355

Original Poster
Rep: Reputation: 30
PS.

/sbin/rmmod -a will not do anything and neither will

/sbin/rmmod -r snd: All I get is rmmod: snd is in use

I have to rmmod all of the modules labeled 'unused' individually
before I can remove snd (obviously the top level module).

Is there any way to use a single rmmod command to remove
all of the snd- modules without having to resort to a removal
script?

TIA
 
Old 05-13-2003, 03:24 PM   #9
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
hmmmm

you shouldn't need to remove modules yourself. Kmod does it for you I think once the module hasn't been removed after a certain period of time.

Quote:
The icing of the cake is that when an automatically installed module
has been unused for a period of time (usually 1 minute), the module
will be automatically removed from the kernel as well.
This is taken from /usr/src/linux/Documentation/modules.txt

Im not sure why they're not being removed properly but you'll have to have a nosy around the documentation and/or www.google.co.uk/linux for more on this. I tend to just compile most things into the kernel itself and sound is almost constantly being played. Its possible that certain programs are constantly keeping the modules alive (possibly a mixer app that is sitting in the "taskbar" of kde/gnome?).

As for the error that you're receiving now about a sound server, this sounds like it might have something to do with kde and gnome's respective sound server programs.

kde=arts
gnome=esd

I don't use these either but you may want to have a look in relation to these programs about how to solve the error. It sounds like they are complaining that they are not being allowed to control the sound, though this is a wild stab in the dark at the problem.

Sorry if that's not much help

Alex
 
Old 05-13-2003, 04:28 PM   #10
raypen
Member
 
Registered: Jun 2002
Location: Midwest
Distribution: Slackware
Posts: 355

Original Poster
Rep: Reputation: 30
Interestingly enough the "icing on the cake.." quote does
come from modules.txt in the kernel dcoumentation, but it
is talking about 'kerneld' not 'kmod'. Kerneld has, of course,
been largely replaced by kmod and as a blurb from kmod$.txt
indicates:

"Kmod only loads modules."

and from other sources: http://g.unsa.edu.ar/doc/suse/suselxen/html/

"The Kmod is not designed to automatically unload modules; .."

I guess Documentation is the last thing to get upgraded and
why it is so full of references to outmoded software, kernels
etc.

As for the error starting up KDE, I just clicked on the button
"Don't show me this again" and decided not to worry about it.

It's sort of six of one - half a dozen to me, and I really don't
worry about how much memory is taken up; I've got 128MB
and never seem to have any trouble. I'm not sure my swap
partition is ever utilized.

The last part of the second quote reads:

".. the potential saving in memory is only marginal for the RAM capacity of computers today; see also /usr/src/linux/Documentation/kmod.txt"

I've never used 'rmmod' before so I was just asking if there
was something I didn't know about and that maybe I was
doing something wrong. No big whup!

Last edited by raypen; 05-13-2003 at 04:31 PM.
 
Old 05-13-2003, 04:39 PM   #11
webtoe
Member
 
Registered: Apr 2001
Location: Cambridge, England
Distribution: Slackware 10, Fedora Core 3, Mac OS X
Posts: 617

Rep: Reputation: 30
Quote:
Kmod
does the exact same thing as kerneld, but doesn't require an external
program (see Documentation/kmod.txt)
Ah, it was this phrase at the top which threw me you see. I assumed (foolishly i assume) that this was true. I should of RTFM.

opps,

Alex
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting ALSA to work a monkey Fedora 2 02-27-2005 12:22 AM
Getting ALSA to work with 2.6.x THX75 Fedora 4 04-23-2004 03:29 AM
ALSA did't work ahmed1915 Linux - Newbie 4 01-03-2004 01:34 AM
got ALSA to work in root, need help getting it to work in my user profile ic3 Slackware 2 11-28-2003 10:32 PM
getting alsa driver to work kudos Slackware 4 04-19-2003 11:34 AM


All times are GMT -5. The time now is 11:14 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration