[LAU] Alsa setup question

hollundertee at gmx.net hollundertee at gmx.net
Sun May 3 21:02:14 UTC 2015


On Sat, 2 May 2015 17:11:05 +0200
<hollundertee at gmx.net> wrote:

> On Sat, 2 May 2015 16:41:06 +0200
> Ralf Mardorf <ralf.mardorf at alice-dsl.net> wrote:
> 
> > On Sat, 2 May 2015 14:53:16 +0200, hollundertee at gmx.net wrote:
> > >Luckily there is ~/.asoundrc, but I'd still like to know what the
> > >hell is going on.
> > 
> > "# A simple script to create a particular default audio device
> > regardless # of what cards are loaded or in what order. It could be
> > used anytime or # placed in a ~/.bashrc script for a persistent
> > setup every login." -
> > http://alsa.opensrc.org/Asoundrc#Default_PCM_device
> > 
> > So this way you get the available device as default device?
> 
> Thanks Ralf,
> 
> that may work in combination with the static ID (not tested yet).
> Without static ID it will fail, since it just picks the first one it
> finds as default.
> 
> I think I managed to fix the udev-rule based variant. Will need to
> test some more though.
> 
> Regards,
> Philipp

Well, it does not work. This is what my asound.conf looks like after
boot with usb device plugged in:
$ cat /etc/asound.conf 
defaults.ctl.card 0
defaults.pcm.card 1
defaults.pcm.card 0
defaults.pcm.card 0
defaults.pcm.card 1
defaults.pcm.card 1
defaults.pcm.card 1

This is what I would like to have:
defaults.ctl.card 0
defaults.pcm.card 0

These are the udev rules, any idea what's wrong with them?
$ cat /etc/udev/rules.d/00-local.rules 
KERNEL=="pcmC[D0-9cp]*", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#pcmC}; K=$${K%%D*}; echo defaults.ctl.card $$K > /etc/asound.conf; echo defaults.pcm.card $$K >>/etc/asound.conf'"
KERNEL=="pcmC[D0-9cp]*", ACTION=="remove", PROGRAM="/bin/sh -c 'echo defaults.ctl.card 1 > /etc/asound.conf; echo defaults.pcm.card 1 >>/etc/asound.conf'"

Regards,
Philipp


More information about the Linux-audio-user mailing list