]> git.pld-linux.org Git - packages/alsa-utils.git/blobdiff - alsasound
- updated to version 0.9rc6
[packages/alsa-utils.git] / alsasound
index 7a4cec05123bfdbc9d0844644067c951c71b6002..07322b0f6633f7a53f04377ba80ff22abdc8fe62 100644 (file)
--- a/alsasound
+++ b/alsasound
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # alsasound     This shell script takes care of starting and stopping
 #               ALSA sound driver.
@@ -22,7 +22,7 @@
 #  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 #
-# For RedHat 5.0+:
+# For Polish Linux Distribution:
 # chkconfig: 2345 87 14
 # description: ALSA driver
 #
@@ -38,18 +38,24 @@ else
 MODULES_CONF=/etc/conf.modules
 fi
 
-function start() {
+driver_start()
+{
   #
   # insert all sound modules
   #
-  cat $MODULES_CONF | grep -v "off" | \
-    grep -E "^alias.+snd-card-[[:digit:]]" | \
-    awk '{print $3}' | \
+  if OLDLOGLEV=$(awk '{print $1}' < /proc/sys/kernel/printk 2> /dev/null); then
+       /sbin/loglevel 1
+  fi
+  awk '$1 == "alias" && $3 != "off" && ($2 ~ /^snd-card-[0-9]$/ || $2 ~ /^sound-service-[0-9]-[0-9]+$/) {print $2}' < $MODULES_CONF | \
     while read line; do \
-      show "Starting sound driver: $line " ; \
-      /sbin/modprobe $line; \
-      ok; \
+      show "Starting sound driver: $line"
+      busy
+      /sbin/modprobe $line
+      ok
     done
+  if [ -n "$OLDLOGLEV" ]; then
+       /sbin/loglevel "$OLDLOGLEV"
+  fi
   #
   # restore driver settings
   #
@@ -60,23 +66,25 @@ function start() {
   fi
 }
 
-function detect_stop() {
+detect_stop()
+{
   #
   # remove all sound modules
   #
-  /sbin/lsmod | grep -E "^snd" | while read line; do \
+  /sbin/lsmod | awk '/^snd/ { print $0 }' | while read line; do \
      /sbin/rmmod `echo $line | cut -d ' ' -f 1`; \
   done
 }
 
-function stop() {
+driver_stop()
+{
   #
   # store driver settings
   #
   if [ -x $alsactl ]; then
     $alsactl store
   else
-    show "!!!alsactl not found!!! "; fail
+    show '!!!alsactl not found!!!'; fail
   fi
   #
   # remove all sound modules
@@ -84,7 +92,8 @@ function stop() {
   detect_stop
 }
 
-function detect_start() {
+detect_start()
+{
   #
   # run only detect module
   #
@@ -96,33 +105,35 @@ case "$1" in
   start)
         # Start driver.
        if [ ! -d /proc/asound ]; then
-         start
+         driver_start
          if [ -d /proc/asound ] && [ -d /var/lock/subsys ]; then
            touch /var/lock/subsys/alsasound
          fi
        else
          if [ -f /proc/asound/detect ]; then
-           show "Shutting down sound detect module: "
+           show "Shutting down sound detect module:"
            detect_stop
            ok
-           start
+           driver_start
            if [ -d /proc/asound ] && [ -d /var/lock/subsys ]; then
              touch /var/lock/subsys/alsasound
            fi
           else
-           show "ALSA driver is already running "; fail
+           show "ALSA driver is already running"; fail
          fi
        fi
         ;;
   stop)
         # Stop daemons.
        if [ -d /proc/asound ]; then
-          show "Shutting down sound driver: "
+          show "Shutting down sound driver:"
+         busy
          if [ -f /proc/asound/detect ]; then
            detect_stop
          else
-           stop
+           driver_stop
          fi
+         (rmmod isapnp; rmmod soundcore) 2> /dev/null
          if [ -d /var/lock/subsys ]; then
            rm -f /var/lock/subsys/alsasound
          fi
@@ -139,15 +150,15 @@ case "$1" in
        # Start driver only in detect mode.
        if [ -d /proc/asound ]; then
          if [ -f /proc/asound/detect ]; then
-           show "ALSA is already running detection mode "; fail
+           show "ALSA is already running detection mode"; fail
            exit 0
           else
-           show "Shutting down sound driver: "
-           stop
+           show "Shutting down sound driver:"
+           driver_stop
            ok
          fi
        fi
-       show "Starting sound detect module: "
+       show "Starting sound detect module:"
        detect_start
        ok
        if [ -d /var/lock/subsys ]; then
This page took 0.038703 seconds and 4 git commands to generate.