#!/bin/bash
/sbin/modprobe isdn
case "$PROTOCOL" in
    1tr6)   PROTOCOL_NR=1 ;;
    euro)   PROTOCOL_NR=2 ;;
    leased) PROTOCOL_NR=3 ;;
    ni1)    PROTOCOL_NR=4 ;;
    *)      PROTOCOL_NR=2 ;;
esac
/sbin/modprobe --ignore-install hisax protocol=${PROTOCOL_NR}
/sbin/modprobe --ignore-install $DRV >& /dev/null
RET=$?
sleep 1
get_first_free_idx
if [ $free_idx -gt 0 ]; then
    free_idx=$(($free_idx - 1))
fi
CONTR=${CONTR:-contr$free_idx}
if [ $RET -eq 0 -a $free_idx != -1 ]; then
    get_i4l_id $free_idx
    HCTRL="$card_id 1 0x4ff"
    /sbin/hisaxctrl $HCTRL
    start_isdnlog $free_idx ${CONTR}
    echo "$free_idx" > /var/run/usb_isdn_${USBBUS}_${USBDEV}.idx
    if [ -n "$EAZMAP" ]; then
	get_i4l_id $free_idx
	/sbin/isdnctrl mapping $card_id $EAZMAP >& /dev/null
    fi
fi
