#!/bin/bash
#
# This script is called to prepare and start a pppd session
# The preperation is slightly different depending on if you are using
# a TxU/TxP or a DSL-S1 card.  This is identified below.
# This script takes a single parameter, i.e. the farsync interface name
# e.g. hdlc0

echo "Starting pppd session using /dev/tty_$1"
eval "`/sbin/farutil $1 shellinfo`"
echo Card type is $CARD
if [ $CARD = "HDSL" ]
then
#
# If you are using a DSL-S1 card use the following
# Configure the line parameteres
#
    /sbin/farutil $1 set media shdsl datarate 2304000 termtype remote annex b backoff 6 vpi 8 vci 35
    /sbin/fardsl $1 -t 1
    /sbin/fardsl $1 
    sleep 10
else
#
# If you have a TxU/TxP card use the following 
# Configure the line parameters for sync
#
    /sbin/farutil $1 set media x21 clock 64000
#
# Or use the following for async
#    /sbin/farutil $1 set media v24 linemode async
fi


#
# Now start the daemon
#
/usr/sbin/pppd /dev/tty_$1
#
# or use the following for async
#
#/usr/sbin/pppd /dev/tty_$1 115200 crtscts
exit 0
