From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sun, 23 Nov 2003 13:35:46 +0200 From: Michael Shigorin To: sisyphus@altlinux.ru Message-ID: <20031123113543.GP9136@osdn.org.ua> Mail-Followup-To: sisyphus@altlinux.ru, darkstar@altlinux.ru References: <20031112124644.GD30811@osdn.org.ua> <20031122075558.GF9136@osdn.org.ua> <20031122120345.GA1257@server.by> <20031122180005.GL9136@osdn.org.ua> <20031123074106.GA2317@wrars-comp.wrarsdomain> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="z87VqPJ/HsYrR2WM" Content-Disposition: inline In-Reply-To: <20031123074106.GA2317@wrars-comp.wrarsdomain> User-Agent: Mutt/1.4.1i Cc: darkstar@altlinux.ru Subject: [sisyphus] ...0.31 (was: I: sound-scripts-0.2) X-BeenThere: sisyphus@altlinux.ru X-Mailman-Version: 2.1.3 Precedence: list Reply-To: sisyphus@altlinux.ru List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2003 11:36:03 -0000 Archived-At: List-Archive: --z87VqPJ/HsYrR2WM Content-Type: multipart/mixed; boundary="YyxzkC/DtE3JUx8+" Content-Disposition: inline Content-Transfer-Encoding: 8bit --YyxzkC/DtE3JUx8+ Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit On Sun, Nov 23, 2003 at 12:41:06PM +0500, Andrey Rahmatullin wrote: > # modprobe -c |egrep '^alias [^ ]+ snd-' > alias sound-slot-0 snd-als4000 > alias snd-card-0 snd-als4000 > Предлагаю в конце строчки поиска модулей воткнуть |uniq Тогда |sort |uniq уже. :-) Хотя вроде сейчас дубли туда не пишут, закладываться на это действительно не стоит. 0.31 attached. Если всем понравится -- до конца недели делаю пакет и шлю в Sisyphus. 2 darkstar: проверь и если ничего не сломано -- в compact. Есть серьезные багфиксы. -- ---- WBR, Michael Shigorin ------ Linux.Kiev http://www.linux.kiev.ua/ --YyxzkC/DtE3JUx8+ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=sound #!/bin/sh # $Id: sound,v 1.14 2003/10/08 15:03:12 ldv Exp $ # # sound: This shell script launch the sound on your system. # # chkconfig: 2345 30 70 # description: This shell script launch the sound on your system. # halt: yes # Do not load RH compatibility interface. WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions PKLVL= SOUND_ALSA= ChangePrintk() { [ -n "$PKLVL" ] || PKLVL=`sed 's/^\(.\).*/\1/' < /proc/sys/kernel/printk` sysctl -w kernel.printk=0 } exit_handler() { local rc=$? trap - EXIT [ -z "$PKLVL" ] || sysctl -w "kernel.printk=$PKLVL" exit $rc } trap exit_handler SIGHUP SIGPIPE SIGINT SIGQUIT SIGTERM EXIT LOCKFILE=/var/lock/subsys/sound AUMIX= [ ! -x /usr/bin/aumix ] || AUMIX=/usr/bin/aumix [ ! -x /bin/aumix-minimal ] || AUMIX=/bin/aumix-minimal ALSACTL= [ -x /usr/sbin/alsactl ] && ALSACTL=/usr/sbin/alsactl TMP_ALSA_STATE=`mktemp -t alsa-state.XXXXXX` LookupDevices() { egrep -qs '(sparcaudio|sound)' /proc/devices } LoadModule() { local phrase=$1 pattern=$2 m opt= [ -n "$3" ] && opt='-r' for m in `modprobe -c |egrep "^alias $pattern " |cut -d\ -f3 |sort |uniq`; do if [ -n "$m" ] && [ "$m" != off ]; then action "$phrase ($m):" modprobe "$opt" "$m" local rc=$? [ $rc -eq 0 ] || return $rc fi done } load_alsa() # redo with LoadModule? { modprobe -c |egrep '^alias [^ ]+ snd-' |cut -d\ -f3 |sort |uniq\ while read line; do L=1 action "Starting ALSA sound driver $line:" modprobe $line done if [ -d /proc/asound ]; then RETVAL=0 start_mixer alsa fi } start_alsa() { [ -d /proc/asound ] || load_alsa [ -d /proc/asound ] && touch "$LOCKFILE" } unload_alsa() { RETVAL=0 stop_mixer alsa; /sbin/lsmod |grep "^snd" | while read line; do /sbin/rmmod `echo $line |cut -d\ -f 1` done /sbin/rmmod soundcore 2>/dev/null } fix_alsa_levels() { # provide sane default audio levels even with alsa alsactl -f $TMP_ALSA_STATE store # set volume to 67% subst 's/\(value\.*\w*\S*\)\s* 0/\1 20/' $TMP_ALSA_STATE # unmute all channels subst 's/\(value\.*\w*\S*\)\s* false/\1 true/' $TMP_ALSA_STATE action "Initializing ALSA mixer settings" alsactl -f $TMP_ALSA_STATE restore rm -f $TMP_ALSA_STATE } start_mixer() { LookupDevices || return # ALSA if [ "$1" = "alsa" -a -n "$ALSACTL" ]; then if [ -r /etc/asound.state ]; then action "Loading ALSA mixer settings:" "$ALSACTL" restore else fix_alsa_levels return 0 fi elif [ -n "$AUMIX" ]; then if [ -s /etc/.aumixrc ]; then action "Loading OSS mixer settings:" "$AUMIX" -f /etc/.aumixrc -L else action "Initializing OSS mixer settings:" "$AUMIX" -v90 -w90 -c90 fi fi } stop_mixer() { LookupDevices || return if [ "$1" = "alsa" -a -n "$ALSACTL" ]; then action "Saving ALSA mixer settings:" "$ALSACTL" store elif [ -n "$AUMIX" ]; then action "Saving OSS mixer settings:" "$AUMIX" -f /etc/.aumixrc -S fi } start() { ChangePrintk # if there is alsa driver configured load it and exit. # FIXME: we know it's wrong since there could be OSS too. # TODO: for now codepaths are extremely crappy :(( start_alsa && exit RETVAL=0 LoadModule "Loading sound module" 'sound[^ ]*' || RETVAL=1 LoadModule "Loading midi module" midi start_mixer oss touch "$LOCKFILE" } stop() { ChangePrintk if [ -d /proc/asound ]; then unload_alsa rm -f "$LOCKFILE" return fi if [ -d /proc/asound ]; then stop_mixer alsa else stop_mixer oss fi LoadModule "Unloading midi module" midi REMOVE LoadModule "Unloading sound module" 'sound[^ ]*' REMOVE rm -f "$LOCKFILE" } restart() { stop start } case $1 in start) start ;; stop|condstop) stop ;; restart|reload) restart ;; status) if lsmod |egrep -qs '^(sound|snd)'; then echo "Sound modules loaded" fi ;; condrestart|condreload) ;; *) msg_usage "${0##*/} {start|stop|restart|status}" exit 1 esac --YyxzkC/DtE3JUx8+-- --z87VqPJ/HsYrR2WM Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/wJuPbsPDprYMm3IRArZgAJ4oWW7+zBfRa8aw9+3XLSp0EIIcsQCg3g82 QL0fiL0BEm++AhX2wDDYxCY= =Is+x -----END PGP SIGNATURE----- --z87VqPJ/HsYrR2WM--