Sound Blaster Z, Linux and sleep (again)

September 27th, 2023

In an earlier post things first looked up and then down, after which I nearly gave up. It turned out that the SBZ simply didn’t want to wake up and at times even completely disappeared from the ALSA card list. I tried kicking it off the PCI bus and rescanning, but that wasn’t much better. At that point I pulled the card from the machine and put it in a plastic bag where other retired PCI(e) cards rot, very likely forever. But… how about removing the card before sleep and then rescanning the bus after wakeup? Let’s create the following script and place it in /lib/systemd/system-sleep:

#!/bin/sh

case "$1" in
    pre)
	echo 1 > /sys/bus/pci/devices/0000\:05\:00.0/remove
	sleep 1
        ;;
    post)
	echo 1 > /sys/bus/pci/rescan
        ;;
esac

Make it executable too: chmod +x soundblaster or whatever name you used. The numbers above on line 5 will probably be wrong for your system, so find out the actual address of your SBZ with lspci. This whole ordeal looks like a dramatic thing to do, but it seems to be the only possibility to get sleep to work – contact me if you know better. After more than ten sleep/wakeup cycles I still didn’t lose sound, so the kludge just might work. If not, I’ll edit the post below (and lose my cool).

Well, of course that wasn’t quite all of it yet. It turns out that when the card reappears after the PCI bus scan, ALSA will happily have forgot all the previous settings done with Alsamixer. The defaults sound pretty awful and the headphones aren’t detected automatically, so what’s next? Luckily this one seems to be easy: configure the card as you see fit using Alsamixer (if you have a small window, note there’s a lot more settings to the right) and then run sudo alsactl store. This is for every user, which is not optimal, but as I’m not sure whether ALSA will load personal settings after wakeup at all, it’ll have to do for now.

Filed under: laitteet,linux,softat

Kommentin kirjoitus

You must be logged in to post a comment.

RSS feed for comments on this post.


Kommenttien virta

Aiheet