{"id":7572,"date":"2023-09-27T22:10:38","date_gmt":"2023-09-27T20:10:38","guid":{"rendered":"http:\/\/www.kameli.net\/marq\/?p=7572"},"modified":"2023-09-27T22:10:38","modified_gmt":"2023-09-27T20:10:38","slug":"sound-blaster-z-linux-and-sleep-again","status":"publish","type":"post","link":"http:\/\/www.kameli.net\/marq\/?p=7572","title":{"rendered":"Sound Blaster Z, Linux and sleep (again)"},"content":{"rendered":"\n<p><a href=\"http:\/\/www.kameli.net\/marq\/?p=7561\">In an earlier post<\/a> things first looked up and then down, after which I nearly gave up. It turned out that the SBZ simply didn&#8217;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&#8217;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&#8230; how about removing the card <em>before<\/em> sleep and then rescanning the bus <em>after<\/em> wakeup? Let&#8217;s create the following script and place it in \/lib\/systemd\/system-sleep:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/sh\n\ncase \"$1\" in\n    pre)\n\techo 1 > \/sys\/bus\/pci\/devices\/0000\\:05\\:00.0\/remove\n\tsleep 1\n        ;;\n    post)\n\techo 1 > \/sys\/bus\/pci\/rescan\n        ;;\nesac<\/code><\/pre>\n\n\n\n<p>Make it executable too: <em>chmod +x soundblaster<\/em> 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 <em>lspci<\/em>. This whole ordeal looks like a dramatic thing to do, but it seems to be the only possibility to get sleep to work \u2013 contact me if you know better. After more than ten sleep\/wakeup cycles I still didn&#8217;t lose sound, so the kludge just might work. If not, I&#8217;ll edit the post below (and lose my cool).<\/p>\n\n\n\n<p>Well, of course that wasn&#8217;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 <em>Alsamixer<\/em>. The defaults sound pretty awful and the headphones aren&#8217;t detected automatically, so what&#8217;s next? Luckily this one seems to be easy: configure the card as you see fit using <em>Alsamixer<\/em>  (if you have a small window, note there&#8217;s a lot more settings to the right) and then run <em>sudo alsactl store<\/em>. This is for every user, which is not optimal, but as I&#8217;m not sure whether ALSA will load personal settings after wakeup at all, it&#8217;ll have to do for now.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;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&#8217;t much better. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,13,24],"tags":[],"class_list":["post-7572","post","type-post","status-publish","format-standard","hentry","category-laitteet","category-linux","category-softat"],"_links":{"self":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/7572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7572"}],"version-history":[{"count":1,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/7572\/revisions"}],"predecessor-version":[{"id":7573,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=\/wp\/v2\/posts\/7572\/revisions\/7573"}],"wp:attachment":[{"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7572"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kameli.net\/marq\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}