3 # alsasound This shell script takes care of starting and stopping \
6 # Copyright (c) by Jaroslav Kysela <perex@jcu.cz>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 # For PLD Linux Distribution:
24 # chkconfig: 2345 87 14
25 # description: ALSA driver
28 # Source function library.
29 . /etc/rc.d/init.d/functions
34 # insert all sound modules
36 modprobe -c | awk '$1 == "alias" && $3 != "off" && ($2 ~ /^snd-card-[0-9]$/) {print $3}' | \
38 msg_starting "sound driver: $line"
43 modprobe -c | awk '$1 == "alias" && $3 != "off" && ($2 ~ /^sound-service-[0-9]-[0-9]+$/) {print $3}' | \
45 msg_starting "sound driver: $line"
55 # remove all sound modules
57 /sbin/lsmod | awk '/^(snd|ac97_bus)/ { print $1 }' | while read module; do \
65 # remove all sound modules
73 # run only detect module
75 /sbin/modprobe snd-detect
80 if [ ! -d /proc/asound ]; then
82 if [ -d /proc/asound ]; then
83 touch /var/lock/subsys/alsasound
88 if [ -f /proc/asound/detect ]; then
89 show "Shutting down sound detect module"
93 if [ -d /proc/asound ]; then
94 touch /var/lock/subsys/alsasound
99 msg_already_running "ALSA driver"
106 if [ -d /proc/asound ]; then
107 show "Shutting down sound driver"
109 if [ -f /proc/asound/detect ]; then
114 (rmmod isapnp; rmmod soundcore) 2> /dev/null
115 if [ -d /var/lock/subsys ]; then
116 rm -f /var/lock/subsys/alsasound
120 msg_not_running "ALSA driver"
125 if [ -f /var/lock/subsys/alsasound ]; then
129 msg_not_running "ALSA driver"
135 # See how we were called.
157 msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"