#------------------------------------------------------------------------------
# /etc/rc.d/rc192.eagle - install driver for eagle usb-dsl-modem
#
# Creation:     2004/08/09 cka (old atar215 renamed)
# Last Update:  $Id: rc192.eagle 10800 2006-01-06 20:28:40Z babel $
#------------------------------------------------------------------------------

if [ -f /lib/modules/$kversion/kernel/misc/eagle-usb.o ]
then
    begin_script EAGLE "Configuring driver for eagle-usb ..." 

    # rename CMS file
    mv /etc/eagle-usb/cmvei.txt /etc/eagle-usb/CMVei.txt

    # waiting for the driver
    : ${EAGLE_WAITSECONDS:=21}
    colecho "take a nap. eagle-usb needs much time initializing, waiting for $EAGLE_WAITSECONDS seconds." cy
    colecho "hint: if eagle-usb needs more time add EAGLE_WAITSECONDS='x' to config/usb.txt and give it" cy
    colecho "      some more time to initialize." cy
    for idx in `seq 1 $EAGLE_WAITSECONDS`
    do
        echo -n "."
        sleep 1
    done

    # Load DSP-Code of EAGLE-USB
    colecho "sending dsp code to eagle-usb ..." cy
    eaglectrl -d/etc/eagle-usb/dsp_code_isdn.bin -o/etc/eagle-usb/eagle-usb.conf

    # Show status of EAGLE-USB
    case "$EAGLE_DO_DEBUG" in
        yes) showstat ;;
    esac

    # Wait for sync of EAGLE-USB
    colecho "waiting for eagle-usb to sync ..." cy
    eaglectrl -s

    # Print device of EAGLE-USB
    colecho "Using device ..." cy  
    eaglectrl -i

    # Show status of EAGLE-USB
    case "$EAGLE_DO_DEBUG" in
        yes) showstat ;;
    esac

    end_script
fi
