Re: [LAU] Alsa setup question

From: Ralf Mardorf <ralf.mardorf@email-addr-hidden-dsl.net>
Date: Sat May 02 2015 - 16:44:56 EEST

On Sat, 2 May 2015 14:53:16 +0200, hollundertee@email-addr-hidden wrote:
>Thanks Ralf, I already have that:
>$ cat /etc/modprobe.d/alsa-base.conf
>options snd slots=snd_usb_audio,snd_hda_intel
>options snd_usb_audio index=0
>options snd_hda_intel index=1
>
>This way, the interface index is static, the question is:
>How do I get:
>if USB_device_is_present then
> default := UA25
>else
> default := PCH

An insane solution:

Perhaps write a script that at startup tests if the USB device is
available.

aplay -l | grep device_foo
then checking the exit status by
$?
it is 1 if the device is not available and 0 if the device is
available.

Provide two alsa-base.conf

1. options snd slots=snd_usb_audio

and

2. options snd slots=snd_hda_intel

make /etc/modprobe.d/alsa-base.conf a link to one or the other config.

Test if the link to the file is for the device that is available, if so
do nothing, if not link to the other config and let the script execute
shutdown -r now.

It could take the time of 1 shutdown and 2 startups and isn't good for
the HDDs, but on the quick I didn't found a way to restart alsa and
taking care of a changed /etc/modprobe.d/alsa-base.conf. To be honest, I
didn't read the alsa man pages, there might be a sane way to change the
default device.
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-user
Received on Sat May 2 20:15:01 2015

This archive was generated by hypermail 2.1.8 : Sat May 02 2015 - 20:15:02 EEST