Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 146467 - udev load snd_usb_audio before alsasound
Summary: udev load snd_usb_audio before alsasound
Status: VERIFIED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-05 15:45 UTC by Dominique Michel
Modified: 2006-10-13 02:07 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique Michel 2006-09-05 15:45:05 UTC
I am installing 2006.1 in a free partition with a chroot and I reboot from time to time. Same 2.6.16-rt29 kernel in both install (done with the same .config file, same alsa-driver-1.0.11, same udev-087-r1, hotplug-20040923-r2 and coldplug-20040920-r1. Same alsa configuration.

The problem is at, when my "old" 2006.0 gcc-3.4.5 work fine, the new one load the snd_usb_audio before alsasound, and I get my webcam as first sound card when I really want my audigy.

It seam like other peoples have the same kind of problem. http://forums.gentoo.org/viewtopic-p-3557557.html Restarting alsasound load the sound cards in the right order for me as for those peoples. So I added snd_usb_audio in /etc/hotplug/blacklist and alsasound is working fine now at boot time.

I was having a discussion on the alsa email list, and according to a developper, the right way to load alsa is with udev, not alsasound. The problem is at every distribution I know are using alsasound or modules.conf, and at no one seam to have succeded to write some generic alsa rules that will work in any configuration (Or they don't talk about it). Even the alsa website write about alsasound, but not about udev... No matter.

My make.conf (in 2006.1)
CFLAGS="-O2 -march=pentium4 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1 -Wl,--sort-common"

MAKEOPTS="-j2"
USE="nptl pic X Xaw3d a52 aac acpi aim alsa audiofile avi bidi bindist bzip2 bxip2 cdparanoia \
cdr cjk crypt cups dbus dga dio div4linux dssi dts dv dvb dvd dvdr dvdread emacs \
emacs-w3 encode esd exif expat ffmpeg fftw firefox flac flash fluidsynth \
foomaticdb fortran ftp gb gd gif gnome gphoto2 gpm graphviz gstreamer gtk gtk2 \
gtkhtml hal howl icq ieee1394 imagemagick imlib ipv6 jabber jack jackmidi \
jack-tmpfs java jbig jpeg jpeg2k -ladcca ladspa lapack lash lcms libedit \
libsamplerate mad mime mmx mng motif -mozilla mp3 mpeg mpi msn mule mysql nas \
ncurses nls nptl nptlonly offensive ogg openal opengl oscar pam pdflib plotutils png posix \
ppds quicktime readline recode scanner seamonkey shorten slang slp sndfile sox \
spell speex sse sse2 svg tcl tk tcltk tetex theora threads tiff truetype unicode \
v4l vcd vorbis vst win32codecs wmf wxwindows xface xine xinerama xml xml2 xmms \
xosd xpm xv xvid yahoo zlib"
SYNCH="rsync://rsync.europe.gentoo.org/gentoo-portage"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo http://gentoo.mirror.solnet.ch"
AUTOCLEAN="yes"
PORTAGE_NICENESS=3
LINGUAS="fr fr_FR en sv"
PORTDIR_OVERLAY="/usr/portage/local/layman/test"
source /usr/portage/local/layman/make.conf
# Xorg setting
INPUT_DEVICES="keyboard mouse"
VIDEO_CARDS="nv nvidia v4l vesa"
# Alsa settings
ALSA_CARDS="emu10k1 intel8x0 ens1370 bt87x mpu401 virmidi dummy usb-audio"
ALSA_TOOLS="as10k1 ac3dec"
EMERGE_DEFAULT_OPTS="--alphabetical"
PORT_LOGDIR=/var/log/portage
PORTAGE_ELOG_CLASSES="warn info error"
PORTAGE_ELOG_SYSTEM="save"
PORTAGE_TMPFS="/dev/shm"
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-09-05 23:48:18 UTC
(In reply to comment #0)
> The problem is at, when my "old" 2006.0 gcc-3.4.5 work fine, the new one load
> the snd_usb_audio before alsasound, and I get my webcam as first sound card
> when I really want my audigy.

So why don't you configutre your ALSA properly?

http://alsa.opensrc.org/index.php?page=MultipleCards
Comment 2 Dominique Michel 2006-09-06 02:41:42 UTC
(In reply to comment #1)
> (In reply to comment #0)
...
> http://alsa.opensrc.org/index.php?page=MultipleCards
> 
In my first comment, I wrote: Same alsa configuration.

And I wrote also at with one instal it work, when not with the other. 

I don't posted my alsa conf file, because I don't think at it is the problem. When I run alsasound restart, if you don't look to know what it does: It begin by unlodond the sound modules, and after it relaod them.

The problem is at udev start some snd modules before alsasond at boot time, and nothing else. 

BTW: tell the alsa user email list at alsa.opensrc.org is official alsa documentation. they will only answer you to take a look on http://alsa-project.org
 Another issue with this link to alsa.opensrc.org is at it is an option: snd_device_gid=29 and it is not gentoo's gid of the audio group. Such option are defined in /etc/udev/rules.d in gentoo.

Here is my alsa configuration, one again, the SAME in the 2 installs, one work, not the other:

$ cat /etc/modules.d/alsa
# Alsa 0.9.X kernel modules' configuration file.
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsa-modules.con
f-rc,v 1.4 2004/11/16 01:31:22 eradicator Exp $

# ALSA portion
alias char-major-116 snd
# OSS/Free portion
alias char-major-14 soundcore

##
## IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `update-modules' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##
##  ALSA portion
alias snd-card-0 snd-emu10k1
alias snd-card-1 snd-ens1370
alias snd-card-2 snd-usb-audio
alias snd-card-3 snd-virmidi
##  OSS/Free portion
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-slot-2 snd-card-2
alias sound-slot-3 snd-card-3
##

# OSS/Free portion - 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 #2
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
##
alias sound-service-2-0 snd-mixer-oss
alias sound-service-2-3 snd-pcm-oss
alias sound-service-2-12 snd-pcm-oss
##
alias sound.service-3-0 snd-mixer-oss
alias sound-service-3-3 snd-pcm
Comment 3 Dominique Michel 2006-09-06 02:41:42 UTC
(In reply to comment #1)
> (In reply to comment #0)
...
> http://alsa.opensrc.org/index.php?page=MultipleCards
> 
In my first comment, I wrote: Same alsa configuration.

And I wrote also at with one instal it work, when not with the other. 

I don't posted my alsa conf file, because I don't think at it is the problem. When I run alsasound restart, if you don't look to know what it does: It begin by unlodond the sound modules, and after it relaod them.

The problem is at udev start some snd modules before alsasond at boot time, and nothing else. 

BTW: tell the alsa user email list at alsa.opensrc.org is official alsa documentation. they will only answer you to take a look on http://alsa-project.org
 Another issue with this link to alsa.opensrc.org is at it is an option: snd_device_gid=29 and it is not gentoo's gid of the audio group. Such option are defined in /etc/udev/rules.d in gentoo.

Here is my alsa configuration, one again, the SAME in the 2 installs, one work, not the other:

$ cat /etc/modules.d/alsa
# Alsa 0.9.X kernel modules' configuration file.
# $Header: /var/cvsroot/gentoo-x86/media-sound/alsa-utils/files/alsa-modules.con
f-rc,v 1.4 2004/11/16 01:31:22 eradicator Exp $

# ALSA portion
alias char-major-116 snd
# OSS/Free portion
alias char-major-14 soundcore

##
## IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `update-modules' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##
##  ALSA portion
alias snd-card-0 snd-emu10k1
alias snd-card-1 snd-ens1370
alias snd-card-2 snd-usb-audio
alias snd-card-3 snd-virmidi
##  OSS/Free portion
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-slot-2 snd-card-2
alias sound-slot-3 snd-card-3
##

# OSS/Free portion - 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 #2
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
##
alias sound-service-2-0 snd-mixer-oss
alias sound-service-2-3 snd-pcm-oss
alias sound-service-2-12 snd-pcm-oss
##
alias sound.service-3-0 snd-mixer-oss
alias sound-service-3-3 snd-pcmoss
alias sound-service-3-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss

# Set this to the correct number of cards.
options snd cards_limit=4

Once again: this file work like a charm in my old install, but the audigy become  the second sound card and snd_usb_audio the first in my new install. So the problem is at udev load the usb_snd_audio before alsasound. More, if I restart alsasound in my new install, the audigy become the first sound card and the snd_usb_audio the third, and it is exactly was I want and for what, amoung other things, my /etc/modules.d/alsa is made for.
Comment 4 Jakub Moc (RETIRED) gentoo-dev 2006-09-06 02:45:35 UTC
If you need a fixed cards orden, then your config is wrong. See the URL referred to in Comment #1. Use the index= parameter as documented.
Comment 5 Dominique Michel 2006-09-06 07:57:45 UTC
It try what you suggested. My new alsa config file Is:

# ALSA portion
alias char-major-116 snd
# OSS/Free portion
alias char-major-14 soundcore

##  ALSA portion
alias snd-card-0 snd-emu10k1
options snd-emu10k1 index=0
alias snd-card-1 snd-usb-audio
options snd-snd-usb-audio index=1
alias snd-card-2 snd-virmidi
options snd-virmidi index=2
alias snd-card-3 snd-ens1370
options snd-ens1370 index=3

##  OSS/Free portion
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-slot-2 snd-card-2
alias sound-slot-3 snd-card-3
##

# OSS/Free portion - 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 #2
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
##
alias sound-service-2-0 snd-mixer-oss
alias sound-service-2-3 snd-pcm-oss
alias sound-service-2-12 snd-pcm-oss
##
alias sound.service-3-0 snd-mixer-oss
alias sound-service-3-3 snd-pcm
Comment 6 Dominique Michel 2006-09-06 07:57:45 UTC
It try what you suggested. My new alsa config file Is:

# ALSA portion
alias char-major-116 snd
# OSS/Free portion
alias char-major-14 soundcore

##  ALSA portion
alias snd-card-0 snd-emu10k1
options snd-emu10k1 index=0
alias snd-card-1 snd-usb-audio
options snd-snd-usb-audio index=1
alias snd-card-2 snd-virmidi
options snd-virmidi index=2
alias snd-card-3 snd-ens1370
options snd-ens1370 index=3

##  OSS/Free portion
alias sound-slot-0 snd-card-0
alias sound-slot-1 snd-card-1
alias sound-slot-2 snd-card-2
alias sound-slot-3 snd-card-3
##

# OSS/Free portion - 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 #2
alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss
##
alias sound-service-2-0 snd-mixer-oss
alias sound-service-2-3 snd-pcm-oss
alias sound-service-2-12 snd-pcm-oss
##
alias sound.service-3-0 snd-mixer-oss
alias sound-service-3-3 snd-pcmoss
alias sound-service-3-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss
 
But I get exactly the same behaviour.

After booting:
/proc/asound/cards:

 0 [U0x46d0x8b2    ]: USB-Audio - USB Device 0x46d:0x8b2
                      USB Device 0x46d:0x8b2 at usb-0000:00:03.1-1, full speed
 1 [Audigy2        ]: Audigy2 - Audigy 2 [SB0240]
                      Audigy 2 [SB0240] (rev.4, serial:0x10071102) at 0x9400, irq 9
 2 [VirMIDI        ]: VirMIDI - VirMIDI
                      Virtual MIDI Card 1

After restarting alsasound:

 0 [Audigy2        ]: Audigy2 - Audigy 2 [SB0240]
                      Audigy 2 [SB0240] (rev.4, serial:0x10071102) at 0x9400, irq 9
 1 [VirMIDI        ]: VirMIDI - VirMIDI
                      Virtual MIDI Card 1
 2 [U0x46d0x8b2    ]: USB-Audio - USB Device 0x46d:0x8b2
                      USB Device 0x46d:0x8b2 at usb-0000:00:03.1-1, full speed

The ens1370 don't show up because I removed it from the box to put a TV card. Alsasound just ignore it.

I found something about the 2.6.16 kernel:
http://gentoo-wiki.com/HOWTO_ALSA_Complete_%28includes_dmix%29#Kernel_2.6.16

Quote: here is currently a problem with the alsa-driver package and kernel 2.6.16, either vanilla, Gentoo, or -ck. Please note that upgrading to ALSA 1.0.11_rc3 or newer should solve the problem for some. Yet for others, this option might create modules that cannot load into your new kernel. Be aware that as of right now, you should only run 2.6.16 with Alsa built into the kernel. 2.6.15 is recommended for anybody on the alsa-driver package until this problem is solved.

If you choose to compile Sound card Support directly into the kernel and have alsa-sound on video capture cards there may be problems starting with 2.6.16. (It worked for me in 2.6.15.) My system detects the TV card before the sound card as an alsa device. This makes the TV card the default sound card which results in no sound and causes many alsa utilites to fail. Compiling as modules [as in the 2.6.15 example above] solved this problem for me. 
EndQuote

So it is definitly a problem.

At alsasound work well when I put snd_usb_audio in the blacklist file or after restarting alsasound show me at it is udev that load this module before alsasound. And nothing else. 

I don't thing either at it come from the kernel, because I have exactly the same kernel in both install, one work as expectd, not the other. If one work, in the non working one it is an iteraction between the kernel and something else, or something else.

It is another fact: I have exactly the same kernel, the same alsa-*, udev, hotplug and coldplug versions, and the same configuration in both install, the 2006.0 gcc-3.4.5 work just fine, the 2006.1 with gcc-4.1.1 just don't work as expected.

I don't thing at it is a problem with the compiler version, I have saffer CFLAGS with the new install

(In my old working install:
CFLAGS="-O3 -march=pentium4 -pipe -fomit-frame-pointer -fforce-addr -fno-ident -ftracer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1 -Wl,--sort-common")
Comment 7 Dominique Michel 2006-10-13 00:40:26 UTC
Sorry, it was my fault. A typo in /etc/init.d/alsa with snd-snd-usb-audio. Changed it to snd-usb-audio and it work without to blacklist anything.
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2006-10-13 02:07:23 UTC
OK, closing. :)