Am oder ungefähr am Donnerstag, 28. Januar 2010, schrieb Jonathan D. Arnold / 
Daemon Dancing:
> On 01/28/10 03:43, Edgar Kalkowski wrote:
> >
> > I don’t really understand why you need to use pulseaudio for this purpose 
> > (as some people in this thread mentioned). I had a similar issue with an 
> > on-board sound card and an external headset that was plugged in via usb and 
> > recognized as a separate sound card. I wrote a simple udev rule (1 line) 
> > that switched the symlink /etc/asoundrc to two prepared asoundrc files in 
> > one of which the headset was the default device and in the other the 
> > on-board sound card. So if the headset was plugged in it was used 
> > exclusively and the other way round. :)
> 
> Care to share your mods? I've been using Linux for awhile and that's still
> something that has me confused. If I boot with my USB headphones plugged in,
> some sound engines (like Xine) use them, and others (gstreamer) don't. And I
> don't know how to swap them around.

What I did was change the alsa default device depending on whether or not the 
USB headset was plugged in. This was done by a udev rule in /etc/udev/rules.d 
that named 39-alsa-usb.rules that contained the following two lines:

KERNEL=="pcmC[D0-9cp]*", DRIVERS=="usb", ACTION=="add", 
RUN+="/usr/bin/alsa-usb-add"
KERNEL=="pcmC[D0-9cp]*", DRIVERS=="usb", ACTION=="remove", 
RUN+="/usr/bin/alsa-usb-remove"

The scripts /usr/bin/alsa-usb-{add,remove} contained a single line that linked 
/etc/asound.conf to one of two prepared asound.conf files:

#!/bin/bash
ln -sf /etc/asound.conf.hw0 /etc/asound.conf

or

#!/bin/bash
ln -sf /etc/asound.conf.hw1 /etc/asound.conf

I can’t find the asound.conf.hw{0,1} files at the moment (I have a non USB 
headset now) but they contained a very simple configuration with hw0 as the 
default alsa sound device or hw1 as the default alsa sound device in the other 
case.

Hope this helps you! :)

Ed

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to