如何在恢复时运行脚本来重新启动音频驱动程序?

如何在恢复时运行脚本来重新启动音频驱动程序?

我目前正在运行“Linux grant-N501VW 4.10.0-40-generic #44-Ubuntu SMP Thu Nov 9 14:49:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux”,恢复后我总是通过耳机听到白噪音机器。我发现了执行此操作的命令:

pulseaudio -k && sudo alsa force-reload

但我希望它在恢复时自动运行。然而,这有点棘手,因为通常我在恢复后第一次运行它时会打印出以下内容并且无法解决问题:

Unloading ALSA sound driver modules: snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device 
snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic snd-hda-intel snd-hda-codec 
snd-hda-core snd-hwdep snd-pcm snd-timer 
(failed: modules still loaded: snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic 
snd-hda-codec snd-hda-core snd-hwdep snd-pcm snd-timer).
Loading ALSA sound driver modules: snd-seq-midi snd-seq-midi-event snd-seq snd-rawmidi snd-seq-device 
snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic snd-hda-intel snd-hda-codec 
snd-hda-core snd-hwdep snd-pcm snd-timer.

但是,运行失败的命令后,如果我再次运行它,则会打印出:

Unloading ALSA sound driver modules: snd-hda-intel snd-seq-midi snd-seq-midi-event 
snd-seq snd-rawmidi snd-seq-device snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic 
snd-hda-codec snd-hda-core snd-hwdep snd-pcm snd-timer.
Loading ALSA sound driver modules: snd-hda-intel snd-seq-midi snd-seq-midi-event 
snd-seq snd-rawmidi snd-seq-device snd-hda-codec-hdmi snd-hda-codec-realtek 
snd-hda-codec-generic snd-hda-codec snd-hda-core snd-hwdep snd-pcm snd-timer.

并且音频白噪声是固定的。我已经考虑在 /etc/pm/sleep.d/ 中创建一个脚本,但这似乎不起作用。

相关内容