#!/bin/sh
########################################################################
# Begin $rc_base/init.d/mISDN
#
# Description : Start mISDN v2
#
# Authors     : Arne Fitzenreiter - arne_f@ipfire.org
#
# Version     : 01.00
#
# Notes       :
#
########################################################################

. /etc/sysconfig/rc
. ${rc_functions}

case "${1}" in
	start)

		boot_mesg "Starting mISDNv2 ... "

		# load mISDN modules
		for module in mISDN_core hfcpci hfcsusb hfcmulti avmfritz speedfax mISDNinfineon xhfc; do
		    modprobe $module > /dev/null 2>&1;
		done

		modprobe mISDN_dsp
		if [ ${?} = 0 ]; then
		    echo_ok;
		else
		    echo_failure;
		fi
		exit 0;
		;;

	stop)

		boot_mesg "Stopping mISDNv2 ... "

		# unload mISDN hardware modules
		for module in mISDN_dsp hfcpci hfcsusb hfcmulti avmfritz speedfax mISDNinfineon xhfc mISDNipac mISDNisar; do
		    rmmod $module > /dev/null 2>&1;
		done

		rmmod mISDN_core
		if [ ${?} = 0 ]; then
		    echo_ok;
		else
		    echo_failure;
		fi
		exit 0;
		;;

	config)
		boot_mesg "mISDNv2 - config not needed!"
		exit 0;
		;;

	scan)
		boot_mesg "mISDNv2 - scan not supported!"
		exit 0;
		;;

	*)
		echo "Usage: ${0} {start}{stop}"
		exit 1
		;;
esac

# End $rc_base/init.d/mISDN
