Bug 232217 - usb-webcam becomes soundcard 0
usb-webcam becomes soundcard 0
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: alsa-lib (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Martin Stransky
: Reopened
: 212901 217179 221562 233126 234561 238928 381691 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-14 09:40 EDT by Hans de Goede
Modified: 2008-02-27 11:49 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-02-22 05:18:41 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Hans de Goede 2007-03-14 09:40:58 EDT
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 09:14:10 EDT
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 04:37:43 EDT
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 05:03:19 EDT
(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 07:07:12 EDT
*** Bug 221562 has been marked as a duplicate of this bug. ***
Comment 5 Martin Stransky 2007-03-22 07:10:04 EDT
*** Bug 233126 has been marked as a duplicate of this bug. ***
Comment 6 Martin Stransky 2007-03-22 07:26:55 EDT
*** Bug 212901 has been marked as a duplicate of this bug. ***
Comment 7 Martin Stransky 2007-05-16 09:03:02 EDT
*** Bug 217179 has been marked as a duplicate of this bug. ***
Comment 8 Martin Stransky 2007-05-16 09:14:19 EDT
*** Bug 234561 has been marked as a duplicate of this bug. ***
Comment 9 Martin Stransky 2007-05-22 10:14:07 EDT
*** Bug 238928 has been marked as a duplicate of this bug. ***
Comment 10 Martin Stransky 2007-05-28 09:30:31 EDT
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 04:56:32 EST
*** Bug 381691 has been marked as a duplicate of this bug. ***
Comment 12 Hans de Goede 2008-01-14 05:08:13 EST
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 05:27:31 EST
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 07:40:22 EST
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-19 22:52:54 EST
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 05:12:13 EST
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 05:35:43 EST
Sure, why not. It may need some fixes in alsa config files, too.
Comment 18 Hans de Goede 2008-02-21 13:46:46 EST
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 05:18:41 EST
Thanks for the info. So the bug can be closed as rawhide.
Comment 20 Sean Bruno 2008-02-22 15:29:11 EST
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 05:30:14 EST
(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 11:17:21 EST
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 11:46:26 EST
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 11:49:56 EST
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.