Bug 229227 - default sound card sometimes fails to initialise
default sound card sometimes fails to initialise
Status: CLOSED CANTFIX
Product: Fedora
Classification: Fedora
Component: sndconfig (Show other bugs)
6
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Martin Stransky
David Lawrence
:
: 219200 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-19 12:15 EST by Richard Kennedy
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-04-10 08:43:01 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard Kennedy 2007-02-19 12:15:44 EST
Description of problem:

on boot the default sound card (via_82xx) sometimes will fail to initialise
correctly and not be available.  this happens only when I have my usb webcam (
with microphone) plugged in at boot time. 

Version-Release number of selected component (if applicable):


How reproducible:
boot with webcam plugged in.
variable. there's a race betwwen the webcam & the via-82xx to get slot 0.  



Steps to Reproduce:
1.boot with web cam plugged in
2. sometimes fails
3.
  
Actual results:
sound device not available. log messages :-
 09:21:46 castor kernel: cannot find the slot for index 0 (range 0-0)
 09:21:46 castor kernel: VIA 82xx Audio: probe of 0000:00:11.5 failed with error -12



Expected results:
sound card always works :)

Additional info:
I've looked at the source for snd_card_new in sound/core/init.c and it seems
that because the options in modprobe.conf set the index on the via-82xx to 0
there's a race with the webcam. If the web cam gets initialised first it will
occupy slot 0 and the via initialisation will fail. This is on a AMD 64X2.
Comment 1 Th0ma7 2007-02-21 21:30:26 EST
I know that I've been having this problem since quite a while... probably since
FC5 using my old ASUS A8V motherboard (s939 + AGP on a K8T800).  This bug came
back when I installed FC6 on my new mobo (DFI LanParty-UT nf4 Ultra-D s939 + PCI
Express nf4).

So this has probably nothing to do with the chipset...

While digging into the dmesg I find theses:
pwc: Unknown parameter `index'
pwc: Unknown parameter `index'
pwc: Unknown parameter `index'
cannot find the slot for index 0 (range 0-0)
Intel ICH: probe of 0000:00:04.0 failed with error -12

I think I used to have a way to fix the problem....  doing a bit of search...
http://www.lavrsen.dk/twiki/bin/view/PWC/FrequentlyAskedQuestionsPWC#modprobe_fails_with_FATAL_Error

Quoting:
If you see pwc: Unknown parameter `index' then the problem is that you have a
parameter in /etc/modprobe.conf saying something line options pwc index=1. 
Delete this line. It comes from an older version of the driver. Then try
modprobe pwc again. 


I had theses lines associated with sound in my modprobe.conf file:
alias snd-card-0 snd-intel8x0
options snd-card-0 index=0
options snd-intel8x0 index=0
remove snd-intel8x0 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; };
/sbin/modprobe -r --ignore-remove snd-intel8x0
alias snd-card-1 pwc
options snd-card-1 index=1
options pwc index=1
remove pwc { /usr/sbin/alsactl store 1 >/dev/null 2>&1 || : ; }; /sbin/modprobe
-r --ignore-remove pwc

I just removed the line "options pwc index=1" and rebooted and got this instead:
Linux video capture interface: v2.00
pwc: Philips webcam module version 10.0.12 loaded.
pwc: Supports Philips PCA645/646, PCVC675/680/690, PCVC720[40]/730/740/750 &
PCVC830/840.
pwc: Also supports the Askey VC010, various Logitech Quickcams, Samsung MPC-C10
and MPC-C30,
pwc: the Creative WebCam 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300 and
VCS-UM100.
pwc: Logitech QuickCam 4000 Pro USB webcam detected.
pwc: Registered as /dev/video0.
usbcore: registered new interface driver Philips webcam

Curiously enough, my sound does work...

Hope this helps.. and possibly solves the problem?

- vin
Comment 2 Richard Kennedy 2007-02-22 08:37:40 EST
The problem is that trying to set the default sound card using the module option
index=0 is broken. having one or more usb sound devices and the motherboard
sound card, causes a race to get sound slot 0.
the fix is to configure the default alsa device in /etc/asound.conf using the
device name not the slot number. see http://alsa.opensrc.org/FAQ026

In my case I've created /etc/asound.conf with "card V8237" set for both pcm & ctl.
deleted the sound option index= line from modprobe.conf & changed the remove
line for the snd-via82xx to refer to the card by name : i.e 
"/usr/sbin/alsactl store V8237"

This works for me no matter which slot the motherboard sound card gets asigned
too. I've tried it with both a usb webcam and/or a usb headset connected.

Richard
Comment 3 Th0ma7 2007-02-27 20:50:38 EST
You where right... it does not completely resolve my problem.  Thnx a lot for
the info.  After a bit of testing here is what I came with:

Find you sound device:
[root@gustav ~]# cat /proc/asound/cards
 0 [CK804          ]: NFORCE - NVidia CK804
                      NVidia CK804 with ALC850 at 0xfe02d000, irq 22

Create the asound.conf file by associating the [SndCrdName ] to the pcm and ctl
configuration:
[root@gustav ~]# vi /etc/asound.conf
pcm.!default {
    type hw
    card CK804
}
ctl.!default {
    type hw
    card CK804
}


Edit your modprobe.conf file like in this example:
/etc/modprobe.conf (BEFORE):
[root@gustav ~]# more /etc/modprobe.conf.20070221
alias eth0 skge
alias eth1 forcedeth
alias scsi_hostadapter sata_nv
alias snd-card-0 snd-intel8x0
options snd-card-0 index=0
options snd-intel8x0 index=0
remove snd-intel8x0 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; };
/sbin/modprobe -r --ignore-remove snd-intel8x0
alias snd-card-1 pwc
options snd-card-1 index=1
options pwc index=1
remove pwc { /usr/sbin/alsactl store 1 >/dev/null 2>&1 || : ; }; /sbin/modprobe
-r --ignore-remove pwc
# I2C module options
alias char-major-89 i2c-dev
# nVidia
options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1


/etc/modprobe.conf (AFTER):
alias eth0 skge
alias eth1 forcedeth
alias scsi_hostadapter sata_nv
alias snd-card-0 snd-intel8x0
alias snd-card-1 pwc
# I2C module options
alias char-major-89 i2c-dev
# nVidia
options nvidia NVreg_EnableAGPSBA=1 NVreg_EnableAGPFW=1

Note that the line:
remove pwc { /usr/sbin/alsactl store 1 >/dev/null 2>&1 || : ; }; /sbin/modprobe
-r --ignore-remove pwc
prevented the automatic removal of the "alias snd-card-1 pwc" line in case your
usb device was disconnected... it might be worth keeping?

Now the big question:  Why is the fedora installer still using the index=X
deprecated option instead of a /etc/asound.conf file?  I've been running through
 this bug since at least FC4... wow! :(

At least this does work well now.  Would be nice to get this fixed by FC7.

Thnx a lot Richard!
Comment 4 Th0ma7 2007-02-27 21:12:48 EST
*** Bug 219200 has been marked as a duplicate of this bug. ***
Comment 5 Richard Kennedy 2007-02-28 05:22:20 EST
the only problem I have with this method is one old app that uses the oss sound
interface (quake). It expects the default sound card to be on /dev/dsp which is
slot 0. but now the default card doesn't always get loaded at slot 0 and quake
doesn't work.

Comment 6 Martin Stransky 2007-03-06 12:29:43 EST
Could you check the system-config-soundcard utility, if it sets your devices
properly? It should write /etc/* properly... You can cofigure a card order here,
too.

Note You need to log in before you can comment on or make changes to this bug.