SOURCES: alsa-udev.conf (NEW), alsa-udev.init (NEW), alsa-udev.rul...

patrys patrys at pld-linux.org
Wed Dec 21 21:25:51 CET 2005


Author: patrys                       Date: Wed Dec 21 20:25:51 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- initial PLD release (by lobo at chello pl)

---- Files affected:
SOURCES:
   alsa-udev.conf (NONE -> 1.1)  (NEW), alsa-udev.init (NONE -> 1.1)  (NEW), alsa-udev.rules (NONE -> 1.1)  (NEW), alsa-udev.sh (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/alsa-udev.conf
diff -u /dev/null SOURCES/alsa-udev.conf:1.1
--- /dev/null	Wed Dec 21 21:25:51 2005
+++ SOURCES/alsa-udev.conf	Wed Dec 21 21:25:46 2005
@@ -0,0 +1,8 @@
+# set this to yes if you want to load oss emulation
+# OSS_EMULATION=yes
+
+# list additional modules for first sound card
+# MODULES_0=""
+
+# postinstal script for first sound card
+# POST_INSTALL_0=""

================================================================
Index: SOURCES/alsa-udev.init
diff -u /dev/null SOURCES/alsa-udev.init:1.1
--- /dev/null	Wed Dec 21 21:25:51 2005
+++ SOURCES/alsa-udev.init	Wed Dec 21 21:25:46 2005
@@ -0,0 +1,89 @@
+#!/bin/sh
+#
+# alsasave	This shell script takes care of stopping ALSA sound driver.
+#
+# This script requires /usr/sbin/alsactl program from alsa-utils package.
+#
+# Copyright (c) by Jaroslav Kysela <perex at jcu.cz> 
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#
+# For PLD Linux Distribution:
+# chkconfig:	2345 80 14
+# description:	ALSA driver
+#
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+alsactl=/usr/sbin/alsactl
+
+detect_stop()
+{
+  #
+  # remove all sound modules
+  #
+  /sbin/lsmod | awk '/^snd/ { print $0 }' | while read line; do \
+     /sbin/rmmod `echo $line | cut -d ' ' -f 1`; \
+  done
+}
+
+
+driver_stop()
+{
+  #
+  # store driver settings
+  #
+  if [ -x $alsactl ]; then
+    $alsactl store
+  else
+    show '!!!alsactl not found!!!'; fail
+  fi
+}
+
+# See how we were called.
+case "$1" in
+  start)
+	#Not Needed, its for udev
+	;;
+  stop)
+	# Stop daemons.
+	if [ -d /proc/asound ]; then
+		show "Shutting down sound driver:"
+		busy
+		if [ -f /proc/asound/detect ]; then
+			detect_stop
+		else
+			driver_stop
+		fi
+		(rmmod isapnp; rmmod soundcore) 2> /dev/null
+ 		ok
+	else
+		msg_not_running "ALSA driver"
+	fi
+	;;
+  save)
+	driver_stop
+	;;
+  status)
+	#TODO
+	;;
+  *)
+	msg_usage "$0 {start|stop|save|status}"
+	exit 3
+esac
+
+exit 0

================================================================
Index: SOURCES/alsa-udev.rules
diff -u /dev/null SOURCES/alsa-udev.rules:1.1
--- /dev/null	Wed Dec 21 21:25:51 2005
+++ SOURCES/alsa-udev.rules	Wed Dec 21 21:25:46 2005
@@ -0,0 +1 @@
+SUBSYSTEM=="sound", KERNEL=="controlC*", RUN+="/etc/udev/scripts/alsa.sh %n"

================================================================
Index: SOURCES/alsa-udev.sh
diff -u /dev/null SOURCES/alsa-udev.sh:1.1
--- /dev/null	Wed Dec 21 21:25:51 2005
+++ SOURCES/alsa-udev.sh	Wed Dec 21 21:25:46 2005
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+[ $# != 1 ] && exit 1
+
+CARD=$1
+
+. /etc/rc.d/init.d/functions
+[ -f /etc/sysconfig/alsa_udev ] && . /etc/sysconfig/alsa_udev
+
+case "$ACTION" in
+    add)
+	eval LOAD_MODULES="\$MODULES_$CARD"
+	for i in "$LOAD_MODULES"; do
+	    /sbin/modprobe -q --ignore-install $i
+	done
+
+	if is_yes "$OSS_EMULATION"; then
+	    /sbin/modprobe -q --ignore-install snd_pcm_oss
+	    [ -e /dev/snd/seq ] && /sbin/modprobe -q --ignore-install snd_seq_oss
+	fi
+
+	/usr/sbin/alsactl restore "$CARD"
+
+	eval SCRIPT="\$POST_INSTALL_$CARD"
+	[ -n "$SCRIPT" ] && eval "$SCRIPT"
+    ;;
+    remove)
+	/usr/sbin/alsactl store "$CARD"
+    ;;
+esac
================================================================


More information about the pld-cvs-commit mailing list