summaryrefslogtreecommitdiff
blob: 2999010e102338152050df1707e3dd3109f7cdd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/sbin/runscript
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez-utils/files/bluetooth.rc,v 1.1 2003/09/19 14:52:11 liquidx Exp $

UART_CONF="/etc/bluetooth/uart"

start_uarts() {
	[ -f /usr/sbin/hciattach -a -f ${UART_CONF} ] || return
	grep -v '^#' $UART_CONF | while read i; do
		/usr/sbin/hciattach $i
	done		
}

stop_uarts() {
	killall hciattach > /dev/null 2>&1
}

start() {
	local RETVAL
   	ebegin "Starting Bluetooth"
	[ -x /usr/sbin/hcid ] && \
		start-stop-daemon --start --quiet --exec /usr/sbin/hcid
	RETVAL=$?		
	[ $RETVAL -a -x /usr/sbin/sdpd ] && \
		start-stop-daemon --start --quiet --exec /usr/sbin/sdpd
	RETVAL=$?
	start_uarts
	eend ${RETVAL}
}
	
stop() {
	local RETVAL
	ebegin "Shutting down Bluetooth"
	[ -x /usr/sbin/hcid ] && \
	  start-stop-daemon --stop --quiet --exec /usr/sbin/hcid
	RETVAL=$?
	[ -x /usr/sbin/sdpd ] && \
		start-stop-daemon --stop --quiet --exec /usr/sbin/sdpd
	RETVAL=$?	
	stop_uarts
	eend ${RETVAL}
}