]>
Commit | Line | Data |
---|---|---|
cd1a2927 MT |
1 | #!/bin/bash |
2 | # | |
3 | # $Id: rc.eagleusbadsl,v 1.5.2.11 2005/07/07 20:11:58 franck78 Exp $ | |
4 | # | |
5 | ||
6 | eval $(/usr/local/bin/readhash CONFIG_ROOT/ppp/settings) | |
7 | ||
8 | # Debugging. Comment it out to stop logging | |
9 | DEBUG="yes" | |
10 | msg() { | |
11 | if [ "z$DEBUG" != "z" ] ; then | |
12 | /usr/bin/logger -t red "EAGLE-USB: $*" | |
13 | fi | |
14 | /bin/echo "$*" | |
15 | } | |
16 | IFACE="eth3" | |
17 | DSPstr="Please send DSP (eaglectrl -d)" | |
18 | ||
19 | # See how we were called. | |
20 | case "$1" in | |
21 | start) | |
22 | if [ ! -f "/proc/bus/usb/devices" ]; then | |
23 | msg "No USB enabled" | |
24 | exit 1 | |
25 | fi | |
26 | ||
27 | if [ "$LINE" != "WO" -a "$LINE" != "FR" -a "$LINE" != "IT" -a "$LINE" != "ES" ]; then | |
28 | LINE='WO' # default CMV value | |
29 | fi | |
30 | ||
31 | /bin/ln -f -s /etc/eagle-usb/CMVep$LINE.txt /etc/eagle-usb/CMVep.txt | |
32 | /bin/ln -f -s /etc/eagle-usb/CMVeiWO.txt /etc/eagle-usb/CMVei.txt | |
33 | ||
34 | if ( /sbin/ifconfig | /bin/grep -q "$IFACE" ); then | |
35 | /sbin/ifconfig "$IFACE" down | |
36 | fi | |
37 | if ( ! /sbin/lsmod | /bin/grep -q [e]agle-usb ); then | |
38 | /sbin/modprobe eagle-usb if_name="$IFACE" | |
39 | # let some time to load firmware | |
40 | /bin/sleep 8 | |
41 | fi | |
42 | if [[ ( -e CONFIG_ROOT/ppp/updatesettings) || | |
43 | ( `/usr/sbin/eaglestat | /bin/grep "$DSPstr"` = "$DSPstr" ) ]]; then | |
44 | /usr/sbin/eaglectrl -d -oCONFIG_ROOT/eagle-usb/eagle-usb.conf | |
45 | if [ $? -ne 0 ]; then | |
46 | msg "init fail" | |
47 | exit 1 | |
48 | fi | |
49 | fi | |
50 | /usr/sbin/eaglectrl -s90 | |
51 | if [ $? -ne 0 ]; then | |
52 | msg "synchronisation fail" | |
53 | exit 1 | |
54 | fi | |
55 | /sbin/ifconfig `/usr/sbin/eaglectrl -i` 10.0.0.139 netmask 255.255.255.254 up | |
56 | if [ $? -ne 0 ]; then | |
57 | msg "ifconfig fail" | |
58 | exit 1 | |
59 | fi | |
60 | ;; | |
61 | stop) | |
62 | msg "stop" | |
63 | ;; | |
64 | cleanup) | |
65 | msg "driver cleanup" | |
66 | /sbin/ifconfig "$IFACE" down | |
67 | /sbin/modprobe -r eagle-usb | |
68 | ;; | |
69 | *) | |
70 | /bin/echo "Usage: $0 {start|stop|cleanup}" | |
71 | exit 1 | |
72 | ;; | |
73 | esac | |
74 | ||
75 | exit 0 |