#!/bin/bash # # rc.conexantpciadsl # eval $(/usr/local/bin/readhash CONFIG_ROOT/ppp/settings) # Debugging. Comment it out to stop logging DEBUG="yes" msg() { if [ "z$DEBUG" != "z" ] ; then /usr/bin/logger "CnxPCIADSL: $*" fi echo "$*" } function wait_for_showtime() { msg "waiting for sync" count=0 while [ ! $count = 45 ]; do /bin/sleep 2 if ( /usr/sbin/cnxadslstatus | /bin/grep -q -F 'Showtime.' ); then msg "sync done" return 0 fi ((++count)) done return 1 } # See how we were called. case "$1" in start) msg "starting" # if the driver is not already loaded then # if [ ! -f /var/lock/subsys/cnxadsllock ]; then if ( ! /sbin/lsmod | /bin/grep -q CnxADSL ); then /sbin/modprobe atm if ( ! /bin/cat /proc/pci | /bin/grep -q '14f1' ); then msg "no conexant modem" exit 1 fi if ( /bin/cat /proc/pci | /bin/grep -q '14f1:1611' ); then # Tigris model /sbin/insmod CnxADSL \ CnxtDslArmDeviceId=0x1610 \ CnxtDslAdslDeviceId=0x1611 \ CnxtDslPhysicalDriverType=1 /bin/ln -f -s /etc/Conexant/CnxTgF.hex CONFIG_ROOT/cnx_pci/firmware.hex else if ( /bin/cat /proc/pci | /bin/grep -q '14f1:1622' ); then # Yukon model /sbin/insmod CnxADSL \ CnxtDslVendorId=0x14F1 \ CnxtDslArmDeviceId=0x1620 \ CnxtDslAdslDeviceId=0x1622 \ CnxtDslPhysicalDriverType=2 /bin/ln -f -s /etc/Conexant/CnxYkF.hex CONFIG_ROOT/cnx_pci/firmware.hex else msg "don't know this model" exit 1 fi fi fi # Initialize the firmware and start training /bin/ln -f -s /etc/Conexant/cnxadsl.conf CONFIG_ROOT/cnx_pci/cnxadsl.conf /etc/Conexant/cnxadslload CONFIG_ROOT/cnx_pci RETVAL=$? if [ $RETVAL -eq 0 ] ; then # Create the tty device number=`awk '/ttyCX/ { print $1 }' /proc/devices` number=${number:?"Could not find device"} echo $number /bin/rm -f /dev/ttyCX /bin/mknod --mode=660 /dev/ttyCX c $number 0 # create a file for the init scripts to know # to shut the driver down else msg "already loaded" fi wait_for_showtime exit $? ;; stop) msg "stop" killall cnxadslload 2>/dev/null #unload the module /sbin/rmmod CnxADSL 2>/dev/null /sbin/modprobe -r atm # get rid of the tty device /bin/rm -f /dev/ttyCX ;; cleanup) msg "cleanup" ;; *) echo "Usage: $0 {start|stop|cleanup}" exit 1 ;; esac exit 0