Automatic Switch of external pcmcia sound card for innovative laptops in Ubuntu

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.