#!/bin/sh

source `dirname $0`/__bt_common_env

cmd_chk bt_read
bt_read=$RET_STR

terminate=
if [ $# -ge 3 ]; then
	terminate="-T"
fi

if [ ! -f /proc/btrax/subbuf_size ] || [ ! -f /proc/btrax/n_subbufs ]; then
	echo "Btrax kernel module($MODDIR/btrax/bt_mod.ko) not loaded."
	exit 1
fi
if [ ! -d $1 ]; then
	echo "Input directory($1) not found."
	exit 1
fi
if [ ! -d $2 ]; then
	echo "Output directory($2) not found."
	exit 1
fi
sz=`cat /proc/btrax/subbuf_size`
sn=`cat /proc/btrax/n_subbufs`

#rm -rf $2
$bt_read $terminate -s $sz -n $sn -i $1 -o $2
