#!/bin/sh
#
# chkconfig: 345 50 83
# description: Bluetooth services for service discovery, authentication, \
#	       Human Interface Devices, etc.
#
### BEGIN INIT INFO
# Required-Start: $syslog messagebus
# Short-Description: Bluetooth services
# Description: Bluetooth services for service discovery, authentication, 
#  Human Interface Devices, etc.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

start()
{
	daemon /usr/sbin/hciattach_ivi ttyTU0 timb-unistone 115200
	RETVAL=$?
	if [ $RETVAL = 0 ]; then
		/usr/sbin/hciconfig hci0 up
		/usr/sbin/hciconfig hci0 voice 0x0060
	fi
	return $RETVAL
}

stop()
{
	echo -n "Stopping Bluetooth services:"
	killproc hciattach_ivi
	RETVAL=$?
	echo ""
	return $RETVAL
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  force-reload|restart|reload)
        stop
        start
        ;;
  status)
        status hciattach_ivi
	RETVAL=$?
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|reload}"
        exit 3
	;;
esac

exit $RETVAL
