#!/bin/bash

bt_start() 
{
	echo "Enabling bluetooth..."
	mts-io-sysfs store bt-enabled 0
	usleep 200000
	mts-io-sysfs store bt-enabled 1
	sleep 1
	echo "Setting up bluetooth device..."
	hciattach /dev/bt texas
}

bt_stop() {
	echo "Disabling bluetooth..."
	killall hciattach
	mts-io-sysfs store bt-enabled 0
}

case "$1" in
    start)
	bt_start
	;;
    stop)
	bt_stop
	;;
    restart)
	bt_stop
	bt_start
	;;
    *)
	echo "Usage $0: start|stop|restart"
	exit 1
	;;
esac