#!/bin/sh #------------------------------------------------------------------------------ # /etc/rc.d/rc220.i4l - load isdn drivers # # Creation: 29.03.2000 fm # Last Update: $Id$ #------------------------------------------------------------------------------ CAPI20_CONF=/etc/capi20.conf FIRMWARE_DIR=/lib/firmware/isdn # I4L protocol number for Euro DSS1 (we do not support any other protocol) I4L_PROTOCOL_EDSS1=2 # $1 = variable name # $2 = variable value append_value() { eval local curval=\$$1 newval=\$2 if [ -n "$curval" ] then curval="$curval,$newval" else curval="$newval" fi eval $1=\$curval } init_capi () { if [ ! -f /var/run/capi_loaded ] then do_modprobe_if_exists kernel/drivers/isdn/capi capidrv do_modprobe_if_exists kernel/drivers/isdn/capi capi echo "TRACELEVEL 0" > $CAPI20_CONF > /var/run/capi_loaded fi } process_avm_driver() { i4l=1 options= loadfile= init_capi > /var/run/avm_capi case $ISDN_TYPE in 101) module="b1pci" # AVM B1-PCI loadfile="b1.t4" options="reset";; 102) module="b1isa" # AVM B1-ISA loadfile="b1.t4" options="addcard b1isa $ISDN_IO $ISDN_IRQ";; 103) module="avm_cs" # AVM B1-PCMCIA loadfile="b1.t4";; 104) module="fcdsl" # AVM DSL loadfile="fdslbase.bin";; 105) module="fcpci";; # AVM PCI 106) module="fcpnp";; # AVM PNP 107) module="fcclassic" # AVM CLASSIC options="addcard fcclassic $ISDN_IO $ISDN_IRQ";; 108) module="fcdsl2" # AVM DSLv2 loadfile="fds2base.bin";; 109) module="fcusb2" # AVM USBv2 if lsusb -d 057c:1000 then loadfile="fus2base.frm" else loadfile="fus3base.frm" fi;; 110) module="fcdslusb" # AVM DSL USB loadfile="fdsubase.frm";; 111) module="fcusb";; # AVM USB 112) module="fxusb";; # AVM X USB 113) module="fcdslusb2" # AVM DSL USBv2 loadfile="fds2base.frm";; 114) module="fcpcmcia_cs";; # AVM FC PCMCIA *) log_error "Unknown AVM ISDN driver type $ISDN_TYPE" return 1 ;; esac do_modprobe $module if [ "$options" ] then sleep 2 avmcapictrl $options sleep 2 fi if [ "$loadfile" ] then sleep 2 avmcapictrl load ${FIRMWARE_DIR}/$loadfile sleep 2 fi } process_icn_driver() { i4l=1 do_modprobe icn portbase=$ISDN_IO membase=$ISDN_MEM icn_id=icn icnctrl -d icn load ${FIRMWARE_DIR}/loadpg.bin \ ${FIRMWARE_DIR}/pc_eu_ca.bin } process_hstsaphir_driver() { i4l=1 if [ -f /etc/rc.d/hstsaphir-helper ] then . /etc/rc.d/hstsaphir-helper fi init_capi } # $1 = index of driver # $2 = remote driver # $3 = IP address for remote CAPI # $4 = TCP port for remote CAPI process_remote_capi() { local index=$1 driver=$2 addr=$3 port=$4 if [ -n "$addr" ] then init_capi echo "REMOTE $driver $addr $port" >> $CAPI20_CONF else log_error "Remote CAPI type $ISDN_TYPE not initialized as ISDN_${index}_IP is not set" fi } process_misdn_driver() { local options="debug=1" case $ISDN_TYPE in 301) module="hfcmulti";; # PCI HFC E1, 4S, 8S 302) module="hfcpci";; # PCI HFC-PCI 303) module="hfcsusb";; # USB HFCS-USB 304) module="avmfritz";; # PCI AVM Fritz!Card 305) module="mISDNinfineon";; # PCI Infineon-Chip-Based 306) module="netjet";; # PCI NetJet TJ300/320 307) module="speedfax";; # PCI Sedlbauer Speedfax+ 308) module="w6692";; # PCI Winbond 6692 *) log_error "Unknown mISDN driver type $ISDN_TYPE" return 1 ;; esac do_modprobe $module $options # configure CAPI init_capi echo "mISDN $misdn" >> $CAPI20_CONF misdn=$((misdn+1)) } init_hisax() { hisax=0 hisax_total=0 hisax_subdrivers= hisax_pcmcia= hisax_firmware= hisax_type= hisax_prot= hisax_io= hisax_io0= hisax_io1= hisax_mem= hisax_irq= } process_hisax_driver() { i4l=1 if [ $ISDN_TYPE -gt 80 ] # HiSax subdrivers then case "$ISDN_TYPE" in 81) hisax_subdrivers="$hisax_subdrivers hisax_st5481";; # BeWan Gazel 128 USB 82) hisax_subdrivers="$hisax_subdrivers hfc_usb";; # HFC USB based adapters 83) hisax_subdrivers="$hisax_subdrivers hfc4s8s_l1";; # HFC-4s/8s based cards 84) hisax_subdrivers="$hisax_subdrivers hisax_fcpcipnp";; # AVM Fritz!Card PCI/PCIv2/PnP esac return fi case "$ISDN_TYPE" in 4) hisax_pcmcia="$hisax_pcmcia teles_cs";; # Creatix/Teles PnP 10) hisax_pcmcia="$hisax_pcmcia elsa_cs";; # ELSA PCMCIA 22) hisax_pcmcia="$hisax_pcmcia sedlbauer_cs";; # Sedlbauer Speed Star (PCMCIA) 26) hisax_pcmcia="$hisax_pcmcia avma1_cs";; # AVM A1 PCMCIA (Fritz!) *) hisax=$((hisax+1)) append_value hisax_type "$ISDN_TYPE" append_value hisax_prot $I4L_PROTOCOL_EDSS1 append_value hisax_io "${ISDN_IO:-0}" append_value hisax_io0 "${ISDN_IO0:-0}" append_value hisax_io1 "${ISDN_IO1:-0}" append_value hisax_mem "${ISDN_MEM:-0}" append_value hisax_irq "${ISDN_IRQ:-0}" ;; esac case "$ISDN_TYPE" in 28) append_value hisax_firmware "ISAR.BIN";; # Sedlbauer Speed Fax+ 29) append_value hisax_firmware "ISAR.BIN";; # Siemens I-Surf 1.0 *) append_value hisax_firmware "";; esac hisax_total=$((hisax_total+1)) } load_hisax_drivers() { # load HiSax all-in-one driver if [ $hisax -gt 0 ] then do_modprobe hisax type=$hisax_type protocol=$hisax_prot io=$hisax_io \ io0=$hisax_io0 io1=$hisax_io1 mem=$hisax_mem irq=$hisax_irq fi # load HiSax PCMCIA driver if necessary if [ -n "$hisax_pcmcia" -a "$OPT_PCMCIA" = "yes" ] then for module in $hisax_pcmcia do do_modprobe $module done fi # load HiSax subdrivers if [ -n "$hisax_subdrivers" ] then for module in $hisax_subdrivers do do_modprobe $module done fi } postprocess_hisax_drivers() { # configure HiSax drivers (_not_ subdrivers!) if [ $hisax_total -gt 0 ] then for i in $(seq 0 $((hisax_total-1))) do [ $i -eq 0 ] && drvid="HiSax" || drvid="HiSax$i" firmware=${hisax_firmware%%,*} hisax_firmware=${hisax_firmware#*,} # set HiSax debug level hisaxctrl $drvid 1 $ISDN_DEBUG_LEVEL # debug-level # load firmware if necessary if [ -n "$firmware" ] then hisaxctrl $drvid 9 ${FIRMWARE_DIR}/$firmware fi #hisaxctrl $drvid 1 0x3ff # full debugging done fi } init_i4l() { i4l= } configure_i4l() { # configure ISDN4Linux if [ -n "$i4l" ] then # I4L only calls register_chrdev() for ISDN_MAJOR (45) and not # device_register(), so mdev does know nothing about them :-( makedevs /dev/isdn c 45 0 0 15 makedevs /dev/isdnctrl c 45 64 0 15 makedevs /dev/ippp c 45 128 0 15 mknod /dev/isdninfo c 45 255 ln -s isdnctrl0 /dev/isdnctrl if [ "$OPT_ISDN_COMP" = yes ] then do_modprobe isdn_bsdcomp do_modprobe isdn_lzscomp comp="$ISDN_LZS_COMP" \ debug="$ISDN_LZS_DEBUG" \ tweak="$ISDN_LZS_TWEAK" fi # Global isdn parameters: log isdnctrl verbose $ISDN_VERBOSE_LEVEL fi } init_misdn() { misdn=0 } configure_misdn() { # configure mISDN if [ $misdn -gt 0 ] then # for mISDN mdev rule and mISDNcapid below group_add dialout # re-read mdev.conf as it refers to dialout group killall -HUP mdev # load mISDN DSP module (used for G3 fax) do_modprobe mISDN_dsp # start CAPI daemon mISDNcapid -D /var/log/mISDNcapid.log fi } case $OPT_ISDN in yes) begin_script I4L "configuring isdn ..." > /etc/ppp/ioptions do_modprobe ppp_generic init_i4l init_misdn init_hisax for i in $(seq 1 ${ISDN_N:-0}) do eval ISDN_TYPE=\$ISDN_${i}_TYPE eval ISDN_IO=\$ISDN_${i}_IO eval ISDN_IO0=\$ISDN_${i}_IO0 eval ISDN_IO1=\$ISDN_${i}_IO1 eval ISDN_MEM=\$ISDN_${i}_MEM eval ISDN_IRQ=\$ISDN_${i}_IRQ eval ISDN_IP=\$ISDN_${i}_IP eval ISDN_PORT=\$ISDN_${i}_PORT case "$ISDN_TYPE" in 0) ;; # for backwards compatibility 201) process_icn_driver;; 1[01][0-9]) process_avm_driver;; 15[0-9]) process_hstsaphir_driver;; 160) process_remote_capi ${i} fritzbox "${ISDN_IP}" ${ISDN_PORT:-5031};; 161) process_remote_capi ${i} rcapi "${ISDN_IP}" ${ISDN_PORT:-2662};; 3[0-9][0-9]) process_misdn_driver;; *) process_hisax_driver;; esac done load_hisax_drivers configure_i4l configure_misdn postprocess_hisax_drivers # needs /dev/isdnctrl end_script ;; *) ISDN_N=0 ISDN_CIRCUIT_N='0' ;; esac