File: eu_dsp

package info (click to toggle)
eagle-usb 2.1.1-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,108 kB
  • ctags: 2,612
  • sloc: ansic: 27,560; sh: 5,440; perl: 3,269; xml: 1,079; tcl: 915; makefile: 878
file content (114 lines) | stat: -rwxr-xr-x 3,557 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
# $Id: eu_dsp,v 1.14 2005/01/16 22:04:34 Tux Exp $

# Copyright (C) 2003-2005 Olivier Borowski
# 
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

# 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.
# Params (given by hotplug) :
#	$DEVICE  ex: /proc/bus/usb/002/005
#	$DEVPATH ex: /devices/pci0000:00/0000:00:02.0/usb1/1-2/1-2:1.2
#	$REMOVER ex: /var/run/usb/%proc%bus%usb%001%006
#	note: only kernels 2.5+ provide $DEVPATH
#	note: some distribs like SuSE9.1 does not provide $REMOVER param

# the following line will be replaced by the absolute path of setvars
exit 123

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

# this script is called multiple times by hotplug, so we try to
# send DSP only one time
SEND_DSP="false"
if [ -z "$DEVPATH" ] ; then
	# kernel 2.4
	SEND_DSP="true"
else
	# kernel 2.5+
	LAST_CHARS=`echo $DEVPATH | sed -e "s/.*\-.[^:]*//1"`
	if [ "x$LAST_CHARS" = "x:1.0" ] ; then
		SEND_DSP="true"
	fi
fi

if [ $SEND_DSP = "true" ] ; then
	if ! eaglestat | grep -q "$SEND_DSP_STR" ; then
		SEND_DSP="false"
	fi
fi

if [ $SEND_DSP = "true" ] ; then
	# small delay to prevent a bug
	sleep 1s
	
	# script called when the modem will be unplugged
	if [ -z "$REMOVER" ] ; then
		REMOVER="/var/run/usb/`echo $DEVICE | sed 's/\//%/g'`"
	fi
	mkdir -p `dirname $REMOVER`
	echo "#!/bin/sh" > $REMOVER
	echo "${SBIN_DIR}/fctStopAdsl" >> $REMOVER
	echo "rmmod $MODULE_STR" >> $REMOVER
	chmod u+x $REMOVER
	
	# load DSP & options
	eaglectrl -d 2>&1 | logger
fi

#***************************************************************************
# $Log: eu_dsp,v $
# Revision 1.14  2005/01/16 22:04:34  Tux
# - add license header
#
# Revision 1.13  2005/01/04 21:14:05  Tux
# - switch strings to utf-8
#
# Revision 1.12  2004/10/31 17:11:06  mcoolive
# *** empty log message ***
#
# Revision 1.11  2004/09/28 10:45:30  mcoolive
# - cosmetic changes
#
# Revision 1.10  2004/08/29 21:36:54  Tux
# - add a small delay to prevent a bug with "eaglectrl -d"
#
# Revision 1.9  2004/08/04 19:53:20  Tux
# - fix conflict between two vars named $SEND_DSP
# - use $MODULE_STR instead of "eagle-usb"
#
# Revision 1.8  2004/07/12 21:04:56  Tux
# - don't send DSP for pre-firmware device
#
# Revision 1.7  2004/07/02 23:18:34  Tux
# - slackware 10 support
#
# Revision 1.6  2004/06/23 20:39:30  Tux
# - add support for distribs which do not provide $REMOVER param (eg: SuSE9.1)
#
# Revision 1.5  2004/03/22 21:15:04  Tux
# - $UNPLUGSCRIPT => $REMOVER
#
#***************************************************************************/