我有一台运行 Ubuntu 20.04 的 Xioami Notebook Pro 笔记本电脑(18.04 上也有同样的问题)。
笔记本电脑进入睡眠/休眠模式后,扬声器没有发出任何声音。系统设置(设置>声音)检测到正在播放音乐,耳机在睡眠后工作正常。该问题仅与笔记本电脑中集成的扬声器有关。作为快速修复,我需要重新启动才能让扬声器再次工作。
我尝试了以下选项,但没有成功:
- 打开 alsamixer 并没有看到任何“静音扬声器”
- 在终端中输入:
sudo alsa force-reload
- 按照 Ubuntu 帮助页面的指示,设置在睡眠后重新加载 alsa 的脚本
pavucontrol
也安装在我的笔记本电脑上- 尝试关闭并重启 pulseaudio
如果您有任何想法可以解决此问题,请告诉我。
我认为这与驱动程序有关,但我不知道如何解决。
请参阅以下有关硬件的信息。
aplay -l
:
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC256 Analog [ALC256 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
cat /proc/asound/cards
:
0 [PCH ]: HDA-Intel - HDA Intel PCH
HDA Intel PCH at 0xb4214000 irq 147
lspci -nnk | grep -A2 Audio
:
00:1f.3 Audio device [0403]: Intel Corporation Device [8086:02c8]
Subsystem: Xiaomi Device [1d72:1905]
Kernel driver in use: snd_hda_intel
pacmd list-cards
:
1 card(s) available.
index: 0
name: <alsa_card.pci-0000_00_1f.3>
driver: <module-alsa-card.c>
owner module: 7
properties:
alsa.card = "0"
alsa.card_name = "HDA Intel PCH"
alsa.long_card_name = "HDA Intel PCH at 0xb4214000 irq 147"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:1f.3"
sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "02c8"
device.form_factor = "internal"
device.string = "0"
device.description = "Built-in Audio"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
谢谢。
答案1
我有一个成功的故事(感谢夜行者)!
同样的硬件,休眠后的情况也一样,首先获取root权限:
$ sudo su -
然后发现你的设备:
# lspci -vvv
...
00:1f.3 Audio device: Intel Corporation Device 02c8 (prog-if 80)
Subsystem: Xiaomi Device 1963
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 32, Cache Line Size: 64 bytes
Interrupt: pin A routed to IRQ 148
Region 0: Memory at c4214000 (64-bit, non-prefetchable) [size=16K]
Region 4: Memory at c4000000 (64-bit, non-prefetchable) [size=1M]
Capabilities: <access denied>
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel, snd_sof_pci
...
因此,我的设备 ID 是 00:1f.3。让我们检查一下:
# ls /sys/bus/pci/devices/ | grep 00:1f.3
0000:00:1f.3
诀窍如下:
# echo 1 > /sys/bus/pci/devices/0000:00:1f.3/remove
# echo 1 > /sys/bus/pci/rescan
第一个命令断开驱动程序与设备的连接,并将设备从树中分离。驱动程序 (snd_hda_intel) 并未卸载,只是断开连接。第二个命令重新扫描 pci 设备。
结果,声音又出现了。
答案2
我有同样的问题。我找到了解决方案,但它在 kde 中不起作用,我不知道为什么。
解决方案:
echo 1 > /sys/bus/pci/devices/<device_address>/remove
sleep 1
echo 1 > /sys/bus/pci/rescan
搜索设备地址: lspci | grep Audio
更新:
唤醒后应用命令的解决方案:
您可以创建新文件:/lib/systemd/system-sleep/99_restart_sound
并插入以下源代码:
#!/bin/sh
case "$1" in
post)
DEVICE_ID=`lspci -D |grep Audio|awk '{print $1}'`
echo 1 > /sys/bus/pci/devices/${DEVICE_ID}/remove
sleep 1
echo 1 > /sys/bus/pci/rescan
esac
该文件必须是可执行的:
sudo chmod +x /lib/systemd/system-sleep/99_restart_sound
答案3
输入此命令:
脉冲音频-k
每次计算机从睡眠状态唤醒时。
可能与这个错误有关: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1888598
答案4
找出所有音频设备 ID 后lspci -vvv
(请根据下面提到的命令替换设备 ID):
sudo echo 1 |sudo tee /sys/bus/pci/devices/0000:00:03.0/remove
sudo echo 1 |sudo tee /sys/bus/pci/devices/0000:03:00.0/remove
sudo echo 1 |sudo tee /sys/bus/pci/devices/0000:00:1b.0/remove
sleep 10
sudo echo 1 |sudo tee /sys/bus/pci/rescan
sleep 10
pulseaudio --kill; pulseaudio --start