#!/bin/sh

LOGDIR=./log

sudo rmmod rawrabbit
sudo insmod gnurabbit/kernel/rawrabbit.ko

mkdir -p $LOGDIR
sudo rm -fr $LOGDIR/pts*

serial=$1
if [ x$1 = x"" ]; then
	echo -n "Please, input SERIAL number: "
        read serial
fi

extra_serial=$2
if [ x$2 = x"" ]; then
	echo -n "Please, input extra SERIAL number: "
        read extra_serial
fi

if [ x$extra_serial = x"" ]; then
	extra_serial=0000
fi

# MAC address for the board
echo -n "Please, input MAC addres (use XX:XX:XX:XX:XX:XX format): "
read mac_addr

tmp=""
echo -n "--------------------------------------------------------------\n"
echo -n "Remove the jumper from the board!\n"
echo -n "Press enter to continue...\n"
read tmp
echo -n "--------------------------------------------------------------\n"

# Assemble pts.py call with parameters for SPEC
cmd="sudo ./pts.py -b SPEC -s "$serial" -e "$extra_serial
if [ ! x$mac_addr = x"" ]; then
	cmd=$cmd" -m "$mac_addr
fi 
cmd=$cmd" -t./test/spec/python -l "$LOGDIR" 00 01 02 03 04 05 06 07 08 09 10 12" #01 02 04 05 06" #

# Execute pts.py
$cmd


echo -n "Press enter to exit... "
read tmp
