Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 May 2008 12:48:23 GMT
From:      Volodymyr Kostyrko <c.kworr@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/124063: audio/aureal-kmod lacks proper rcNG startup script
Message-ID:  <200805281248.m4SCmNbe048898@www.freebsd.org>
Resent-Message-ID: <200805281300.m4SD0CHs062398@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         124063
>Category:       ports
>Synopsis:       audio/aureal-kmod lacks proper rcNG startup script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 28 13:00:11 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Volodymyr Kostyrko
>Release:        FreeBSD 7.STABLE
>Organization:
INTS
>Environment:
FreeBSD cairn.ints.net 7.0-STABLE FreeBSD 7.0-STABLE #3: Tue May 27 10:17:19 EEST 2008     arcade@cairn.ints.net:/usr/obj/usr/src/sys/CAIRN  i386
>Description:
Supplied aureal.sh lacks knobs needed for rcNG to recognize and to start it automatically.
>How-To-Repeat:
Just install the port. You end up running '/usr/local/etc/rc.d/aureal.sh start' each time you boot up.
>Fix:
I have prepared a script on my own.

Patch attached with submission follows:

#!/bin/sh
#
# PROVIDE: aureal
# BEFORE: hald
# KEYWORD: nojail
#
# Add the following line to /etc/rc.conf[.local] to enable aureal
#
# aureal_enable="YES"
#

. /etc/rc.subr

name="aureal"
rcvar=${name}_enable

load_rc_config $name

: ${aureal_enable="NO"}

start_cmd=aureal_start
stop_cmd=aureal_stop

CARD=''

aureal_detect() {
	PCICONF="/usr/sbin/pciconf"

	if [ -z "${CARD}" -a -x ${PCICONF} ]; then
		if [ "`${PCICONF} -l 2>&- | grep 0x000312eb`" ]; then
			CARD=8810
		elif [ "`${PCICONF} -l 2>&- | grep 0x000112eb`" ]; then
			CARD=8820
		elif [ "`${PCICONF} -l 2>&- | grep 0x000212eb`" ]; then
			CARD=8830
		fi
	fi

	if [ -z "${CARD}" ]; then
		echo "Unable to determine your Aureal card type -" \
			"override it manually in $0" >&2
		exit 255
	fi

	PREFIX=/usr/local
	LIBDIR=${PREFIX}/lib/au88x0
	DRIVERFILE=snd_au${CARD}
}

aureal_start() {
	aureal_detect

	if [ ! -f ${LIBDIR}/${DRIVERFILE}.ko ]; then
		echo "${LIBDIR}/${DRIVERFILE} for ${CARD} not found!"
		exit 64
	fi

	if ! kldstat -qm ${DRIVERFILE}; then
		if kldload ${LIBDIR}/${DRIVERFILE}.ko; then
			echo 'aureal module loaded.'
		else
			warn 'aureal module failed to load.'
			return 1
		fi
	fi

	if [ "$VIAKX133FIX" ]; then
		pcisel=`${PCICONF} -l 2>&- | grep ^pcm0 | awk -F: '{ gsub("^[^@]*@", ""); print $1":"$2":"$3 }'`
		if [ -z "$pcisel" ]; then
			echo " (WARNING: Soundcard PCI selector undetermined. Unable to install VIA KX133 workaround. Starting a playback will likely to lock-up your system!)"
			exit 64
		fi
		oldvalue=`${PCICONF} -r -b $pcisel 0x40 2>&- | sed 's/ *$//'`
		echo -n " (with VIA KX133 workaround: ${pcisel},0x40: ${oldvalue} -> "
		${PCICONF} -w -b $pcisel 0x40 0xff
		echo -n "`${PCICONF} -r -b $pcisel 0x40 2>&- | sed 's/ *$//'`)"
	fi

	return 0
}

aureal_stop() {
	aureal_detect

	if kldstat -qm ${DRIVERFILE} && kldunload ${DRIVERFILE} ; then
		echo 'aureal module unloaded.'
	fi
}

run_rc_command "$1"


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805281248.m4SCmNbe048898>