#!/bin/bash
# $Id: eu_dsp,v 1.5 2004/03/22 21:15:04 Tux Exp $
# Name: eu_dsp
# Goal: This script handles the ADI ADSL Modem USB driver after firmware
#       uploading. It loads the DSP code as needed by the modem.
#		It create a script /var/run/usb/%proc%bus%usb%002%005 in order
#		for the ADSL connexion to be stopped and module to be unloaded.
#       It should only be run by hotplug.
# Author: Tux
# Params (given by hotplug):
#	$DEVICE  ex: /proc/bus/usb/002/005
#	$REMOVER ex: /var/run/usb/%proc%bus%usb%001%006

. /etc/eagle-usb/scripts/setvars

# this script can only be called by hotplug (giving the $DEVICE param)
if [ -z "$REMOVER" ] ; then
	echo -e "$NO_PARAM_MSG"
	exit
fi

LAST_CHARS=`echo $DEVPATH | sed -e "s/.*\-.[^:]*//1"`
if [ -z "$LAST_CHARS" ] || [ "x$LAST_CHARS" = "x:1.0" ] ; then
	# script called when the modem will be unplugged
	mkdir -p /var/run/usb
	echo "#! /bin/bash" > $REMOVER
	echo "${SBIN_DIR}/fctStopAdsl" >> $REMOVER
	echo "rmmod eagle-usb" >> $REMOVER
	chmod u+x $REMOVER

	# load DSP & options
	eaglectrl -d 0>&1 1>&1 2>&1 | logger
fi

#***************************************************************************
# $Log: eu_dsp,v $
# Revision 1.5  2004/03/22 21:15:04  Tux
# $UNPLUGSCRIPT => $REMOVER
#
#***************************************************************************/
