LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 06-03-2009, 10:27 PM   #1
marco1475
LQ Newbie
 
Registered: May 2009
Posts: 8

Rep: Reputation: 1
"Hotplug" USB Sound Card?


Hi,

How can I set up Linux on my notebook to recognize when I plug in my USB sound card, switch to it as the default, and then switch back to the on-board sound card once the USB card is unplugged?

I have a notebook with a built-in PCI sound card (snd_hda_intel) and an external USB 5.1 sound card (snd_usb_audio). So far I have been successful in setting up both cards with ALSA and I can play sounds through both of them. However, that is done by having both cards loaded at boot time, which requires the USB card to be connected and set as the default in /etc/asound.conf.

Is there a way to have the system react to the external sound card being plugged in / unplugged? The ALSA Wiki has a HowTo with hotplug, but I am using udev, which is supposed to replace hotplug ...

Thanks,

Marek
 
Old 06-04-2009, 04:27 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
udev compliments hotplug.
 
Old 06-04-2009, 12:05 PM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
udev is the way to go.

See: http://www.reactivated.net/writing_udev_rules.html

I had some Bose USB speakers I was going to do this with, but I got too busy with other projects. I just left them plugged in all the time.

You might find some useful information if you search LQ for posts by me containing the text Bose and/or speakers

Please let us know how you get on. If you get stuck, repost here and I'll look through some old files ( if I can find them )
 
Old 06-23-2009, 04:33 PM   #4
marco1475
LQ Newbie
 
Registered: May 2009
Posts: 8

Original Poster
Rep: Reputation: 1
Thank you very much for the links. What I needed to do was create a local udev rule, reacting to audio1 in the sound subsystem that would call my script, which only needed to link /etc/asound.conf to one of the two different configs (internal audio vs. usb audio). More info can be found in my LinuxWiki.

P.S.: I also tried removing and modprobing the kernel modules on plug/unplug and realized that stopping or starting a service also calls udev rules, which then resulted in a nice endless loop (stop service -> udev rule triggered -> started service -> udev triggered -> stop service -> ...).
 
Old 06-23-2009, 04:46 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Thanks for the follow-up post.

Can I take this post to mean that you got it working, eventually ?
 
  


Reply



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
Total noob having sound card issues. "Unknown device" Furious J Linux - Newbie 3 04-02-2007 10:44 AM
Sound Card not working on "IBM A51 8123-Q2W" pradipta12345 Linux - Hardware 3 05-08-2006 05:29 AM
Several USB ports: explicit mounting or "hotplug"? SuSE_Lamer SUSE / openSUSE 7 05-12-2005 10:21 AM
Writing to "/dev/usb/hiddev*" and to "/proc/bus/usb/00B/00S" throw an arror EI stpg Programming 0 07-14-2004 05:44 AM
Hotplug usb agent "Cannot get config descriptor 0"? imk Linux - Networking 0 10-26-2003 12:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:27 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration