#!/bin/initsh # Load the mixer settings and OSS compatibility for ALSA. # (the Advanced Linux Sound Architecture) # A function to load the ALSA mixer settings: load_alsa_mixer() { if [ -r /etc/asound.state ]; then echo "Loading ALSA mixer settings: /usr/sbin/alsactl restore" /usr/sbin/alsactl restore else echo "ALSA warning: No mixer settings found in /etc/asound.state." echo " Sound may be muted. Use 'alsamixer' to unmute your sound card," echo " and then 'alsactl store' to save the default ALSA mixer settings" echo " to be loaded at boot." fi } # A function to load the ALSA OSS compat modules: load_alsa_oss_modules() { if [ ! `/bin/cat /proc/modules | /bin/tr _ - | /bin/grep -wq snd_pcm_oss` ] ; then echo "Loading OSS compatibility modules for ALSA." /sbin/modprobe snd-pcm-oss /sbin/modprobe snd-mixer-oss /sbin/modprobe snd-seq-oss fi } # If hotplug or something else has loaded the ALSA modules, then # simply load the mixer settings and make sure the OSS compat # modules are loaded: if [ -d /proc/asound ]; then load_alsa_mixer load_alsa_oss_modules else # If there are ALSA modules defined in /etc/modules.conf, but # ALSA is not yet loaded, then load the modules now: KVERS=`uname -r` echo "Attempting to Load ALSA kernel modules." for DRIVER in `grep -E "snd-" /lib/modules/$KVERS/module.alias |cut -f3 -d` ; do echo "Loading ALSA kernel module: $DRIVER" /sbin/modprobe $DRIVER 2> /dev/null done # If ALSA is now up, then load the mixer settings and OSS modules: if [ -d /proc/asound ]; then load_alsa_mixer load_alsa_oss_modules fi fi