You are not logged in.

#1 2011-02-26 00:26:13

Aesir
Member
Registered: 2011-02-03
Posts: 22

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:

 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

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!

Last edited by Aesir (2011-02-26 00:45:32)

Offline

#2 2011-02-26 01:46:04

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,543

Re: Auto-detect USB speakers on boot

Try editing /etc/asound.conf so it contains this

pcm.!default {
    type hw
    card Speaker
}
ctl.!default {
    type hw           
    card Speaker
}

Offline

#3 2011-02-27 14:24:42

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: Auto-detect USB speakers on boot

maybe this is not the solution but pulseaudio manage better USB audio, so why you don't try pulseaudio ?


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

Board footer

Powered by FluxBB