#!/bin/sh
# Ensure that ALSA state is saved and restored correctly.
# TODO: Modern ALSA does not need this hack.  Is it worth trying to detect
#       that and disable this hook if we do not need it?

. "${PM_FUNCTIONS}"

command_exists alsactl || exit $NA

case "$1" in
	hibernate|suspend)
		alsactl store 0 >/dev/null 2>&1
		;;
	thaw|resume) 
		alsactl restore 0 >/dev/null 2>&1
		;;
	*) exit $NA
		;;
esac
