问题
我在HP Omen 15的Ubuntu 17.10上运行内核v4.13.0 -36-generic。
已禁用安全启动。
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: PCH [HDA Intel PCH], device 0: ALC295 Analog [ALC295 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
$ lspci 00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05) 00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 05) 00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04) 00:04.0 Signal processing controller: Intel Corporation Skylake Processor Thermal Subsystem (rev 05) 00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31) 00:14.2 Signal processing controller: Intel Corporation Sunrise Point-H Thermal subsystem (rev 31) 00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31) 00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA Controller [AHCI mode] (rev 31) 00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1) 00:1c.4 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #5 (rev f1) 00:1c.5 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #6 (rev f1) 00:1c.6 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #7 (rev f1) 00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31) 00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31) 00:1f.3 Audio device: Intel Corporation Device a171 (rev 31) 00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31) 01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1) 03:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader (rev 01) 04:00.0 Network controller: Intel Corporation Wireless 7265 (rev 61) 05:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
答案1
创建文件 /etc/systemd/system/fix-hdmi-audio.service
[Unit]
Description=nVidia HDMI Audio Fixer
Before=systemd-logind.service display-manager.service
After=module-init-tools.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/fix-hdmi-audio.sh
[Install]
WantedBy=multi-user.target
创建文件/usr/local/bin/fix-hdmi-audio.sh
#!/bin/sh
setpci -s 01:00.0 0x488.l=0x2000000:0x2000000
rmmod nvidia-uvm nvidia-drm nvidia-modeset nvidia
sh -c 'echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove'
sh -c 'echo 1 > /sys/bus/pci/devices/0000:00:01.0/rescan'
modprobe nvidia nvidia-modeset nvidia-drm nvidia-uvm
并将它设置为runnable: chmod +x /usr/local/bin/fix-hdmi-audio.sh
启用服务: systemctl enable fix-hdmi-audio.service
安装apt install pavucontrol
,然后启动"PulseAudio Volume Control",,在"配置"选项卡中,只能看到"内部音频"
重新启动,插入HDMI,并播放一些音乐,启动"PulseAudio Volume Control",在"配置"选项卡中,你应该看到"内部音频"和"HDA NVidia" ,在"播放"标签中,音乐播放器的右侧有一个按钮。选择"HDA NVidia"
重启后,你可以看到
01:00.1 Audio device: NVIDIA Corporation Device 10f1 (rev a1)
在lscpi
的输出中。
答案2
最可能 setpci -s 01:00.0 0x488.l=0x2000000:0x2000000
硬件设置不能工作。