]>
Commit | Line | Data |
---|---|---|
cd1a2927 MT |
1 | #!/bin/bash |
2 | # | |
3 | # $Id: rc.conexantpciadsl,v 1.1.2.11 2005/07/07 20:11:58 franck78 Exp $ | |
4 | # | |
5 | ||
6 | # Debugging. Comment it out to stop logging | |
7 | DEBUG="yes" | |
8 | msg() { | |
9 | if [ "z$DEBUG" != "z" ] ; then | |
10 | /usr/bin/logger -t red "CnxPCI ADSL: $*" | |
11 | fi | |
12 | /bin/echo "$*" | |
13 | } | |
14 | ||
15 | function wait_for_showtime() { | |
16 | msg "waiting for sync" | |
17 | count=0 | |
18 | while [ ! $count = 45 ]; do | |
19 | /bin/sleep 2 | |
20 | if ( /usr/sbin/cnxadslstatus | /bin/grep -q -F 'Showtime.' ); then | |
21 | msg "sync done" | |
22 | return 0 | |
23 | fi | |
24 | ((++count)) | |
25 | done | |
26 | return 1 | |
27 | } | |
28 | ||
29 | # See how we were called. | |
30 | case "$1" in | |
31 | start) | |
32 | msg "starting" | |
33 | # if the driver is not already loaded then | |
34 | if ( /sbin/lsmod | /bin/grep -q CnxADSL ); then | |
35 | msg "already loaded" | |
36 | else | |
37 | if ( ! /bin/cat /proc/pci | /bin/grep -q '14f1' ); then | |
38 | msg "no conexant modem" | |
39 | exit 1 | |
40 | fi | |
41 | /sbin/modprobe CnxADSL | |
42 | RETVAL=$? | |
43 | if [ $RETVAL -ne 0 ] ; then | |
44 | msg "error when loading, card present?" | |
45 | fi | |
46 | if ( /bin/cat /proc/pci | /bin/grep -q '14f1:1611' ); then | |
47 | # Tigris model | |
48 | /bin/ln -f -s /etc/Conexant/CnxTgF.hex CONFIG_ROOT/cnx_pci/firmware.hex | |
49 | else | |
50 | if ( /bin/cat /proc/pci | /bin/grep -q '14f1:1622' ); then | |
51 | # Yukon model | |
52 | /bin/ln -f -s /etc/Conexant/CnxYkF.hex CONFIG_ROOT/cnx_pci/firmware.hex | |
53 | else | |
54 | msg "don't know this model" | |
55 | exit 1 | |
56 | fi | |
57 | fi | |
58 | ||
59 | # Initialize the firmware and start training | |
60 | /bin/ln -f -s /etc/Conexant/cnxadsl.conf CONFIG_ROOT/cnx_pci/cnxadsl.conf | |
61 | /etc/Conexant/cnxadslload CONFIG_ROOT/cnx_pci | |
62 | fi | |
63 | wait_for_showtime | |
64 | exit $? | |
65 | ;; | |
66 | stop) | |
67 | msg "stop" | |
68 | ;; | |
69 | cleanup) | |
70 | msg "cleanup" | |
71 | /bin/killall cnxadslload 2>/dev/null | |
72 | /sbin/modprobe -r CnxADSL | |
73 | ;; | |
74 | *) | |
75 | echo "Usage: $0 {start|stop|cleanup}" | |
76 | exit 1 | |
77 | ;; | |
78 | esac | |
79 | ||
80 | exit 0 |