Friday, November 17, 2006

Restore Sound after suspend

The sound on my laptop has always been muted after a suspend/resume cycle. I had hope Edgy would resolve that, but it didn't. The various posts (1, 2) I could find on the issue suggested a combination of toggling KDE's KMix setting "Restore volumes on login" (which would logically only apply on startup, anyway) and the alsa-utils save/restore. Nothing ever worked, so I had to manually reactivate the sound by both unmuting the channels in KMix and setting the levels to something non-zero.

After a few weeks of this, I realized I need to automate the reset. After digging around a bit, I discovered that the alsa-utils init script has a reset stanza that does just this. The resume script only called a restart, which reloads the driver, but it doesn't reset the levels. So I just updated /etc/acpi/resume.d/67-sound.sh to look like:


#!/bin/sh

# Get sound back
if [ -x /etc/init.d/alsa-utils ]; then
/etc/init.d/alsa-utils restart
/etc/init.d/alsa-utils reset
fi

and now my sounds comes back perfectly on restore!

0 comments: