~vcs-imports/ipfire/ipfire-2.x

« back to all changes in this revision

Viewing changes to src/rc.d/rc.3cp4218usbadsl

  • Committer: ipfire
  • Date: 2006-02-15 21:15:54 UTC
  • Revision ID: git-v1:cd1a2927226c734d96478e12bb768256fb64a06a


git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
# $Id: rc.3cp4218usbadsl,v 1.4.2.3 2005/07/07 20:11:57 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 "3Com AccessRunner USB: $*"
 
13
        fi
 
14
        echo "$*"
 
15
}
 
16
 
 
17
# See how we were called.
 
18
case "$1" in
 
19
  start)
 
20
        if [ -f "/proc/bus/usb/devices" ]; then
 
21
                if ( ! /bin/cat /proc/bus/usb/devices | /bin/grep -q 'Vendor=0506 ProdID=F002' ); then
 
22
                        echo "3Cload"
 
23
                        /usr/sbin/3cload /usr/sbin/ez-usb.bin
 
24
                        if [ $? -ne 0 ]; then
 
25
                                msg "3Cload1 failed"
 
26
                                exit 1
 
27
                        fi
 
28
                        /bin/sleep 5
 
29
                        # OPEN_MODE=: 5 = ANSI T1.413, 7 = ITU-T G.992.2 (G.LITE), 6 = ITU-T G.992.1 (G.DMT), 8 = multimode, 3 = other
 
30
                        case "$MODULATION" in
 
31
                                GDMT)   OPEN_MODE=6 ;;
 
32
                                ANSI)   OPEN_MODE=5 ;;
 
33
                                GLITE)  OPEN_MODE=7 ;;
 
34
                                AUTO)   OPEN_MODE=8 ;;
 
35
                        esac
 
36
                        /usr/sbin/3cload 2 /usr/sbin/3cinit.bin /usr/sbin/3cmain.bin $OPEN_MODE
 
37
                        if [ $? -ne 0 ]; then
 
38
                                msg "3Cload2 failed"
 
39
                                exit 1
 
40
                        fi
 
41
                fi
 
42
 
 
43
                /sbin/modprobe 3cp4218 speed=1 open=$OPEN_MODE
 
44
                /bin/sleep 5
 
45
                if [ $? -ne 0 ]; then
 
46
                        msg "3cp4218 loading failed"
 
47
                        exit 2
 
48
                fi
 
49
                /bin/sleep 3
 
50
                /usr/sbin/3cioctl 1
 
51
                if [ $? -ne 0 ]; then
 
52
                        msg "3cioctl failed"
 
53
                        exit 3
 
54
                fi
 
55
                /bin/sleep 3
 
56
        fi
 
57
        exit 0
 
58
        ;;
 
59
stop)
 
60
        msg "stop"
 
61
        /usr/sbin/3cioctl 2
 
62
        ;;
 
63
cleanup)
 
64
        msg "driver cleanup and restarting USB Bus"
 
65
        /usr/sbin/3cioctl 5
 
66
        /sbin/modprobe -r 3cp4218
 
67
        /bin/sleep 4
 
68
        /usr/local/bin/resetusb
 
69
        ;;
 
70
  *)
 
71
        echo "Usage: $0 {start|stop|cleanup}"
 
72
        exit 1
 
73
        ;;
 
74
esac
 
75
 
 
76
exit 0