Bug 232217 - usb-webcam becomes soundcard 0
Summary: usb-webcam becomes soundcard 0
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: alsa-lib
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Martin Stransky
QA Contact:
URL:
Whiteboard:
: 212901 217179 221562 233126 234561 238928 381691 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-03-14 13:40 UTC by Hans de Goede
Modified: 2008-02-27 16:49 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-02-22 10:18:41 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Requested log file (35.86 KB, text/plain)
2007-03-22 08:37 UTC, Hans de Goede
no flags Details

Description Hans de Goede 2007-03-14 13:40:58 UTC
Description of problem:
When I boot my 1 week old rawhide with my usb webcam inserted into an usb
connector, then the usb-webcam becomes soundcard 0, I concider making an input
only soundcard soundcard 0, when there also is an i/o soundcard available a bug.

How reproducible:
Plug in a usb-webcam with usb-sound compatible mic integrated before turning on
the computer.
 
Actual results:
usb-webcam mic becomes soundcard 0, leading to non working sound in all apps

Expected results:
An output capable device is choosen as default soundcard, so sound works.

Feel free to reasign this to another component if you feel thats more relevant.

Comment 1 Martin Stransky 2007-03-21 13:14:10 UTC
Please run system-config-soundcard create a log (/root/scsconfig.log) and attach
it here. Thanks.

btw. it's a dupe of Bug 233126

Comment 2 Hans de Goede 2007-03-22 08:37:43 UTC
Created attachment 150646 [details]
Requested log file

(In reply to comment #1)
> Please run system-config-soundcard create a log (/root/scsconfig.log) and
attach
> it here. Thanks.
> 

Done

> btw. it's a dupe of Bug 233126

Wouldn't that be the other way around as this was created first. I did check
for dupes, but that one didn't exist at that time :)

Comment 3 Martin Stransky 2007-03-22 09:03:19 UTC
(In reply to comment #2)
> Done

Thanks. 
 
> > btw. it's a dupe of Bug 233126
> 
> Wouldn't that be the other way around as this was created first. I did check
> for dupes, but that one didn't exist at that time :)

No problem, I've added this just for my needs.


Comment 4 Martin Stransky 2007-03-22 11:07:12 UTC
*** Bug 221562 has been marked as a duplicate of this bug. ***

Comment 5 Martin Stransky 2007-03-22 11:10:04 UTC
*** Bug 233126 has been marked as a duplicate of this bug. ***

Comment 6 Martin Stransky 2007-03-22 11:26:55 UTC
*** Bug 212901 has been marked as a duplicate of this bug. ***

Comment 7 Martin Stransky 2007-05-16 13:03:02 UTC
*** Bug 217179 has been marked as a duplicate of this bug. ***

Comment 8 Martin Stransky 2007-05-16 13:14:19 UTC
*** Bug 234561 has been marked as a duplicate of this bug. ***

Comment 9 Martin Stransky 2007-05-22 14:14:07 UTC
*** Bug 238928 has been marked as a duplicate of this bug. ***

Comment 10 Martin Stransky 2007-05-28 13:30:31 UTC
fixed in system-config-soundcard-2.0.6-6.fc6.

Update to this package, switch to "System" tab and select "Rewrite configuration
files". Your USB device will be a card with index 7 (unless is already configured).

Comment 11 Hans de Goede 2008-01-14 09:56:32 UTC
*** Bug 381691 has been marked as a duplicate of this bug. ***

Comment 12 Hans de Goede 2008-01-14 10:08:13 UTC
When doing some bug triaging I encountered bug 381691, which I've closed as a
dup of this. I just tried reproducing this and it still happens, reopening.

The fix to system-config-soundcard doesn't cut it. I've just started
system-config-soundcard and then clicked reset configuration files. This has
written an /etc/modprobe.conf, which I'm sure will work (don't feel like
rebooting again).

However this means that fixing this requires manual intervention, which is no
good, things should just work IMHO.

Here is what I did to produce the problem:
1) Fresh install F-8 on a machine with onboard ac97 sound
2) /etc/modprobe.conf contains alias for snd-card-0 to intel-hda and options
   for it say index=0
3) After boot and gdm login plugin usb webcam (with usb-audio mic)
4) Reboot, leaving webcam plugged in
5) Boot process loads usb-snd-audio before intel-hda, when intel-hda loads it
   fails to load as it cannot claim index 0.

Note starting system-config-sound results in a confused system-config-sound
which says soundcard0 is intel-hda, which is not true, its usb-audio, also it
doesn't show the webcam at all (maybe because its only got sound inputs, not
outputs).

Pressing reset sound config files results in the following in /etc/modprobe.conf:
options snd cards_limit=8
alias snd-card-7 snd-usb-audio
options snd-usb-audio index=7

Which as said should work well after reboot.

I guess this needs some kinda fix at the udev level. Note that always adding:
options snd cards_limit=8
alias snd-card-7 snd-usb-audio
options snd-usb-audio index=7

Is not a solution either, my machine at home has one board usb audio, so there
only usb audio exists, making the primary sound card card number 7 does not seem
very intuitive to me, then again I could live with that so always adding:
options snd cards_limit=8
alias snd-card-7 snd-usb-audio
options snd-usb-audio index=7

To /etc/modprobe.conf might be an easy and acceptable solution, but what happens
then when there are 2 usb audio devices?



Comment 13 Martin Stransky 2008-01-14 10:27:31 UTC
Yes, the modprobe entries are a good idea. Please file a new bug against
module-init-tools and cc me there. Thanks.

Comment 14 Hans de Goede 2008-01-18 12:40:22 UTC
Hmm,

Before filing a bug against module-init-tools I've first done some more
research, adding:
options snd cards_limit=8
alias snd-card-7 snd-usb-audio
options snd-usb-audio index=7

To /etc/modprobe.conf will not work when using more then one usb audio device
(for example webcam with mic + usb headset)

This can be fixed by using the following instead, notice that I've dropped the
unnecessary "alias snd-card-7 snd-usb-audio"
options snd cards_limit=12
options snd-usb-audio index=7,8,9,10,11

However this still causes problems when actually using an usb audio device as
primary for example my home PC has an asrock motherboard with uses a C-Media
c6501, which is also used on for example the asus m2n motherboard series. This
is an usb audio device.

When I boot my computer with the modprobe entries from above, then the usb
soundcard becomes snd-card-7, which is not a problem in itself.

However when I plug in for example an usb webcam with an usb audio mic, and then
power on the computer the webcam becomes snd-card-0 (or 7 when using the
modprobe entries), and the soundcard becomes snd-card-8, pulseaudio (and other
alsa apps when removing the alsa pulseaudio plugin) then try to use the webcam
as default soundoutput which is not good.

I've been reading the source code of the kernel usb-audio driver and it has
module options to specify manufacturer and product id to use as the X-th
soundcard registered by the driver.

I haven't tried yet, but I'm confident that with these options I can make things
so that even with 2 usb audio devices plugged in my onboard usb card will always
become the card with the lowest index. However manually editing
/etc/modprobe.conf is not very end user friendly.

So it seems that system-config-soundcard, needs to be able to also select an usb
card / speakers as default soundcard and then write the correct module options
with manufacturer and product id to /etc/modprobe.conf

Also I wonder who / what generates / adds the snd-card entries to
/etc/modprobe.conf during install. I guess this is when the following lines
should be added to /etc/modprobe.conf
options snd cards_limit=12
options snd-usb-audio index=7,8,9,10,11

With a special case when no none usb soundcards are found making the first
currently found usb audiodevice with output capability index 0, and ensuring it
stays that by passing the correct options to snd-usb-audio to bind it by
manufacturer and product id

I hope the above make sense. And I hope you are willing (and find the time) to
properly fix this, if you plan on fixing this using the manufacturer and product
id for usb devices as suggested above, please let me know and I will gladly do
some more experimenting on my asrock / C-Media 6501 system including thoroughly
testing the snd-usb-audio options for index -> usb id binding.


Comment 15 Sean Bruno 2008-02-20 03:52:54 UTC
So, I'm guessing this issue is _WAY_ more complicated than it appears.

I have USB Turntable that magically becomes my only sound device on reboot.  It
manifests the same issue as described by the submitter and this issue is
_definitely_ still occurring.

Comment 16 Hans de Goede 2008-02-20 10:12:13 UTC
Yes, we are more and more living in a hotplug world, were devices come and go
all the time. Given that pulseaudio is integrated with hal and that we are
moving to pulseaudio, I think that the solution is to stop trying to hard assign
indexes to  soundcards, or to add module aliases for them to /etc/modprobe.conf.
Just let udev load the modules (as it already does causing all the problems).

pulseaudio gives names to soundcards based on various info, which (AFAIK) does
not include the topology of the connection to the device, so one could make for
example an usb headset the prefered default sound-device in pulseaudio, and then
it would use that when available even independend of in which usb port it is
plugged.

To me this is the way forward, and using /etc/modprobe for soundcard config is
obsolete (just like /etc/fstab is for removable media).

Martin, what do you think about this? I think its a good idea to start a
discussion about this on the devel mailinglist, agreed?



Comment 17 Martin Stransky 2008-02-20 10:35:43 UTC
Sure, why not. It may need some fixes in alsa config files, too.

Comment 18 Hans de Goede 2008-02-21 18:46:46 UTC
Martin,

I don't know if you are following the discussion about this but according to
Bill Nottingham and Lennart Poetering, s-c-s is no longer run during install and
also is no longer part of a default install, so on a clean F-9 install, the
solution I proposed in comment #16, is effectively in place.

Quoting Lennart: "s-c-s is still around for debugging purpose", so I guess that
this bug can be closed then, as for F-8 a user will need to start s-c-s and
click rewrite soundconfig, and for F-9 this won't be an issue.

The only remaining problem I see is if someone decides to still install s-c-s
and use it, and he / she has more then 1 usb device.


Comment 19 Martin Stransky 2008-02-22 10:18:41 UTC
Thanks for the info. So the bug can be closed as rawhide.

Comment 20 Sean Bruno 2008-02-22 20:29:11 UTC
It can?  Ok.

I guess I'll test it out when I see a F9 test/alpha/beta distro and post back here.

Comment 21 Hans de Goede 2008-02-24 10:30:14 UTC
(In reply to comment #20)
> It can?  Ok.
> 
> I guess I'll test it out when I see a F9 test/alpha/beta distro and post back
here.

If you are using pulse audio (the default) you can also test with F-8, just
remove all sound related lines (lines containing "snd") from /etc/modprobe.conf
and reboot.


Comment 22 Sean Bruno 2008-02-27 16:17:21 UTC
Ah, excellent.  I removed all references to my sound devices in
/etc/modprobe.conf and my audio devices are correct and in order.

I tested with Amarok and Audacity and noted that they just work.  My onboard
Nvidia sound device is my primary and my USB turn table is another sound input
device.

I removed the following from my /etc/modprobe.conf:
alias snd-card-0 snd-intel8x0
alias snd-card-1 snd-usb-audio
options snd-card-0 index=0
options snd-intel8x0 index=0
options snd-usb-audio index=1

How can we help others that are having similar issues?  Can a patch be issued to
delete this stuff from their /etc/modprobe.conf ?


Comment 23 Dimi Paun 2008-02-27 16:46:26 UTC
Same here, I've removed the following info, and sound seems to be working fine (F8):
#remove snd-hda-intel { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; };
/sbin/modprobe -r --ignore-remove snd-hda-intel
#options snd cards_limit=8
#alias snd-card-0 snd-hda-intel
#options snd-hda-intel index=0
#alias snd-card-1 snd-usb-audio
#options snd-usb-audio index=1


Comment 24 Martin Stransky 2008-02-27 16:49:56 UTC
It can be written by kudzu (or something) during installation or manually by
system-config-soundcard.


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