FreeBSD Port: audio/aureal-kmod
Volodymyr Kostyrko
arcade at synergetica.dn.ua
Tue May 13 09:01:46 UTC 2008
Hi there.
I've composed new rc.d script for this port, works like a charm.
--
Sphinx of black quartz judge my vow.
-------------- next part --------------
#!/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"
More information about the freebsd-ports
mailing list