#----------------------------------------------------------------------------
# /etc/rc.d/rc005.usb - configuration of your usb-devices
# 
#
# Creation:     01.01.2003  Kai-Christian Arndt
# Modification: 06.06.2005  Frank Rudolph	
# Last Update:  $Id: rc005.usb 10446 2005-11-27 08:56:55Z rresch $
#----------------------------------------------------------------------------

if [ "$OPT_USB" = yes ]
then
    begin_script USB "loading USB core drivers ..."

    do_insmod_once usbcore                  # load USB-support driver
    for i in usb-uhci uhci usb-ohci ehci-hcd
    do
      do_insmod_if_exists kernel/drivers/usb/host $i # load USB-lowlevel driver
    done

    colecho "loading USB highlevel drivers ..." gn
#   Wlan-Adapter mit Atmel-chip at76c503a
    do_insmod_if_exists kernel/drivers/usb usbdfu
    do_insmod_if_exists kernel/drivers/usb at76c503
    do_insmod_if_exists kernel/drivers/usb at76c503-rfmd netdev_name=eth%d

    case $USB_EXTRA_DRIVER_N 
    in	
        0)
        ;; #just do nothing
        *)
        colecho "loading USB extra drivers ..." gn
        for i in `seq 1 $USB_EXTRA_DRIVER_N`
        do 
            eval "DRIVER=\$USB_EXTRA_DRIVER_${i}"
            eval "PARAM=\$USB_EXTRA_DRIVER_${i}_PARAM"
            case  $DRIVER
            in
            usbkbd)                 # load additional modules, needed for usbkbd
                do_insmod_once input
                do_insmod_once keybdev
                do_insmod_once hid
            ;;
            usb-storage)            # load additional modules, needed for usb-storage
                do_insmod_once scsi_mod
                do_insmod_once sd_mod
            ;;
            esac
            do_insmod $DRIVER $PARAM
        done
    esac
    colecho "now waiting for the drivers to come up" gn
    sleep 7
#   Mounting of the usb-device-file-system
    colecho "mounting usb device file system" cy
    mount -t usbdevfs usbdevfs /proc/bus/usb
    echo -n "."
    sleep 1
    echo -n "."
    sleep 1
    echo -n "."
    sleep 1

    end_script
fi
