#!/bin/bash

if [ "$2" == "" ]; then
    echo "usage $0 device mode"
    exit 0
fi

function wait_dongle(){
    while [ 1 ]; do
	if [ -c $1 ]; then return ; fi
	sleep 1
    done
}

set +e

wait_dongle $1
wvdial setup
wvdial $2
wvdial setup
sleep 5
wvdial dial
