選擇預設音效卡

選擇預設音效卡

我在 Chromebook (Acer C720) 上執行 Lubuntu,但遇到聲音問題。

/etc/modprobe.d/alsa-base.conf似乎是 Ubuntu 的預設配置,據我了解,預設將使用索引為 0 的模組。

# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7

# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; }
#
# Workaround at bug #499695 (reverted in Ubuntu see LP #319505)
install snd-pcm /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; }
install snd-mixer /sbin/modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-mixer-oss ; : ; }
install snd-seq /sbin/modprobe --ignore-install snd-seq $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; /sbin/modprobe --quiet --use-blacklist snd-seq-oss ; : ; }
#
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; : ; }
# Cause optional modules to be loaded above sound card driver modules
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-emu10k1-synth ; }
install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq ; }

# Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway)
install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist saa7134-alsa ; : ; }
# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options saa7134-alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
options snd-usb-audio index=-2
options snd-usb-caiaq index=-2
options snd-usb-ua101 index=-2
options snd-usb-us122l index=-2
options snd-usb-usx2y index=-2
# Ubuntu #62691, enable MPU for snd-cmipci
options snd-cmipci mpu_port=0x330 fm_port=0x388
# Keep snd-pcsp from being loaded as first soundcard
options snd-pcsp index=-2
# Keep snd-usb-audio from beeing loaded as first soundcard
options snd-usb-audio index=-2

如果我查看當前的卡片,/proc/asound/cards我可以看到兩張可用的卡片。

0 [HDMI           ]: HDA-Intel - HDA Intel HDMI
                     HDA Intel HDMI at 0xe0510000 irq 44
1 [PCH            ]: HDA-Intel - HDA Intel PCH
                     HDA Intel PCH at 0xe0514000 irq 45

HDMI 音效卡具有預設索引,這就是為什麼音訊插孔和揚聲器無法運作的原因。

看看他們使用的模組,/proc/asound/modules

0 snd_hda_intel
1 snd_hda_intel

表明它們都使用相同的模組。如果兩張卡都有相同的模組,我該如何使用alsa-base.conf來指定預設使用 PCH 卡?

答案1

alsa.opensrc.org有一個簡短的部分描述了與此問題類似的場景。

如果您有多個使用相同模組的音效卡,您可能需要定義卡片順序。這可以透過為正在載入的模組指定索引和 ID 選項來完成。例如,

選項 snd-usb-音訊索引=1,2 vid=0x0ccd,0x0d8c pid=0x0028,0x000c

這將定義2個USB音效卡,第一個位於index=1,vid=0x0ccd和pid=0x0028;第二個位於索引=2、vid=0x0d8c 和 pid=0x000c 處。這裡的vid和pid是使用lsusb發現的。

兩個音效卡都不是 USB 設備,因此您無法使用 來獲取模組字段lsusb,但是同一篇文章建議使用modinfo來獲取該模組的參數列表:

modinfo -p snd_hda_intel

index:Index value for Intel HD audio interface. (array of int)
id:ID string for Intel HD audio interface. (array of charp)
enable:Enable Intel HD audio interface. (array of bool)
model:Use the given board model. (array of charp)
position_fix:DMA pointer read method.(-1 = system default, 0 = auto, 1 = LPIB, 2 = POSBUF, 3 = VIACOMBO, 4 = COMBO). (array of int)
bdl_pos_adj:BDL position adjustment offset. (array of int)
probe_mask:Bitmask to probe codecs (default = -1). (array of int)
probe_only:Only probing and no codec initialization. (array of int)
jackpoll_ms:Ms between polling for jack events (default = 0, using unsol events only) (array of int)
single_cmd:Use single command to communicate with codecs (for debugging only). (bool)
enable_msi:Enable Message Signaled Interrupt (MSI) (bint)
patch:Patch file for Intel HD audio interface. (array of charp)
beep_mode:Select HDA Beep registration mode (0=off, 1=on) (default=1). (array of bool)
power_save:Automatic power-saving timeout (in second, 0 = disable). (xint)
power_save_controller:Reset controller in power save mode. (bool)
align_buffer_size:Force buffer and period sizes to be multiple of 128   bytes. (bint)
snoop:Enable/disable snooping (bint)

手冊頁modinfo顯示使用-F帶有欄位名稱的標誌來列印欄位值。我嘗試過modinfo -F id snd_hda_intel,但沒有產生任何輸出。

/proc/asound/有兩張卡的資料夾(在card0和下card1)。這些資料夾又包含id檔案。很快cat /proc/asound/card0/id就得到了結果HDMI,card1 也是如此PCH

作為一種盲目的嘗試,我添加了以下幾行/etc/modprobe.d/alsa-base.conf

# fix ordering of HDMI and PCH soundcards on Chromebook
options snd_hda_intel index=0,1 id=PCH,HDMI

這個答案本來是問題的結束,但是在系統重新啟動後,這個變更已經alsa-base.conf解決了問題。

相關內容