LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 02-25-2011, 07:52 PM   #1
TuxArch
LQ Newbie
 
Registered: Feb 2011
Posts: 18

Rep: Reputation: 0
Auto-detect USB speakers on boot


Hi,
I have logitech v.20 usb speakers that work great. Each time I boot however, I need to run "cat /proc/asound/cards" to identify my speakers, which produces the following output:

Code:
 0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xd5200000 irq 42
 1 [HDMI           ]: HDA-Intel - HDA ATI HDMI
                      HDA ATI HDMI at 0xd0030000 irq 43
 2 [Speaker        ]: USB-Audio - Logitech USB Speaker
                      Logitech Logitech USB Speaker at usb-0000:00:1d.0-2, full speed
Now that I see that the USB-Audio speakers are [2] (this changes each time I boot, sometimes it's 0 or 1), I manually edit /usr/share/alsa/alsa.conf and make these two lines point to the appropriate number
Code:
defaults.ctl.card 2
defaults.pcm.card 2
Is there any way to automate this process so that on boot the computer recognizes if the USB is plugged in or uses the internal speakers if not? And even better, is it is also possible to allow it to start out with internal speakers and automatically shift to usb if I plug them in after already having booted? Thank you very much!
 
Old 02-25-2011, 08:17 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hey man, I am working on something for you. Give me a little bit of time so I can get it right.

Cheers,

Josh
 
Old 02-25-2011, 09:41 PM   #3
TuxArch
LQ Newbie
 
Registered: Feb 2011
Posts: 18

Original Poster
Rep: Reputation: 0
I think the following may be all that I need to add to /etc/asound.conf (that I created) ?

Code:
pcm.!default {
    type hw
    card Speaker
}
ctl.!default {
    type hw           
    card Speaker
}
 
Old 02-25-2011, 09:53 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Did you try it?
 
Old 02-25-2011, 09:54 PM   #5
TuxArch
LQ Newbie
 
Registered: Feb 2011
Posts: 18

Original Poster
Rep: Reputation: 0
I have implemented it, but how would I try besides restarting a bunch of time to see if it always matches the usb speakers? After one restart, the usb speakers defaulted but this could be due to chance?
 
Old 02-25-2011, 10:13 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
If you think it is due to a chance, then try to prove that it's not by restarting one more time and noting what number is being set.
 
Old 02-26-2011, 06:26 AM   #7
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
http://www.linuxquestions.org/questi...n-bash-865095/

Check this out.... I got drinking a few beers last night and decided to attempt at my (old) sed skills and come up with something. I ended up having to get some help, learned from it, and voila! enjoy.....

Cheers!

Josh
 
  


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
USB won't Auto Detect for Plug-n-Play Devices The-Riot Linux - Newbie 3 11-28-2009 04:23 PM
USB Auto Detect & Display noodlesoup Programming 1 05-20-2009 03:43 AM
auto detect USB device at boot knobby67 Linux - Hardware 2 06-13-2008 03:47 AM
usb device auto detect akudewan Ubuntu 1 03-09-2006 08:37 AM
How to auto-detect USB drive in RedHat 9? pelakh Red Hat 1 05-06-2004 01:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 01:15 PM.

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