A few days ago, I purchased an innovative Audigy2ZSNotebook sound card. The sound card driver is not bad, as long as the pcmcia sound card is enabled in the kernel to support emu10k1 modules. However, the setting problem also arises. The goal is very simple. When the sound card is inserted and pulled out, alsa settings will automatically change accordingly. We can use udev to achieve this goal. We need two scripts and a slightly different asound. conf. First, let's see what two sound cards are called: Code: l
A few days ago, I purchased an innovative Audigy2 ZS Notebook sound card. The sound card driver is not bad, as long as the pcmcia sound card is enabled in the kernel to support emu10k1 modules. However, the setting problem also arises. The goal is very simple. When the sound card is inserted and pulled out, alsa settings will automatically change accordingly.
We can use udev to achieve this goal.
We need two scripts and a slightly different asound. conf.
First, let's take a look at the names of the two sound cards:
Code:
Ls-l/proc/asound/
My host is:
Code:
Lrwxrwxrwx 1 root 5 Audigy2-> card2
Dr-xr-x 9 root 0 card0
Dr-xr-x 5 root 0 card1
Dr-xr-x 8 root 0 card2
-R -- 1 root 0 cards
-R -- 1 root 0 devices
-R -- 1 root 0 hwdep
Lrwxrwxrwx 1 root 5 I82801DBICH4-> card0
Lrwxrwxrwx 1 root 5 Modem-> card1
Dr-xr-x 2 root 0 oss
-R -- 1 root 0 pcm
Dr-xr-x 2 root 0 2009-03-16 17:27 seq
-R -- 1 root 0 timers
-R -- 1 root 0 version
The on-board sound card is I82801DBICH4, and the external pcmcia sound card is Audigy2. To write down the names, we need them later.
Next, we need to write two asound. conf files to specify the alsa settings when the external sound card is plugged in and out. First
Code:
Mkdir/etc/alsa
Cp/etc/asound. conf/etc/alsa/asound. ac97
Mv/etc/asound. conf/etc/alsa/asound. audigy2
, Asound. ac97 is used when no external sound card is inserted, and asound. audigy2 is used when the external sound card is plugged in.
Then add the following to asound. ac97:
Code:
# Onboard
Pcm. ac97 {
Type plug
Slave. pcm "dmix"
}
Ctl. ac97 {
Type hw
Card I82801DBICH4
}
Pcm .! Default pcm. ac97
Ctl .! Default ctl. ac97
Add it to asound. audigy2
Code:
# Pcmcia
Pcm. audigy2hw {
Type hw
Card Audigy2
}
Pcm. audigy2 {
Type plug
Slave. pcm "audigy2hw"
}
Ctl. audigy2 {
Type hw
Card Audigy2
}
# Onboard
Pcm. ac97 {
Type plug
Slave. pcm "dmix"
}
Ctl. ac97 {
Type hw
Card I82801DBICH4
}
Pcm .! Default pcm. audigy2
Ctl .! Default ctl. audigy2
Note that the sound card name in xxx. ac97 is the name of my onboard sound card, and xxx. audigy2 is the name of my external sound card. You need to replace it with your own sound card.
In this case, we only need ln-sf/etc/alsa/asound. xxx/etc/asound. conf to be OK.