3 # bluetooth Bluetooth subsystem starting and stopping
7 # description: Bluetooth subsystem
12 # Source function library
13 . /etc/rc.d/init.d/functions
15 UART_CONF="/etc/bluetooth/uart"
16 [ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
18 if [ "$UART_CONF" != "no" -a ! -f "$UART_CONF" ]; then
23 # See how we were called.
26 # Check if the service is already running?
27 if [ ! -f /var/lock/subsys/bluetooth ]; then
28 # show "Starting %s service" Bluetooth
29 msg_starting Bluetooth
30 if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
31 grep -v '^#' $UART_CONF | while read i; do
32 /usr/sbin/hciattach $i
35 daemon /usr/sbin/hcid -f /etc/bluetooth/hcid.conf
37 if [ $RETVAL -ne 0 ]; then
38 killproc hciattach >/dev/null 2>&1
39 elif [ -x /usr/sbin/sdpd ]; then
40 msg_starting "Bluetooth SDP"
43 if [ $RETVAL -ne 0 ]; then
44 killproc hcid >/dev/null 2>&1
45 if [ "$UART_CONF" != "no" ]; then
46 killproc hciattach >/dev/null 2>&1
50 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bluetooth
52 # show "%s service is already running." Bluetooth
53 msg_already_running Bluetooth
57 if [ -f /var/lock/subsys/bluetooth ]; then
58 if [ -x /usr/sbin/sdpd ]; then
59 msg_stopping "Bluetooth SDP"
62 # show "Stopping %s service" Bluetooth
63 msg_stopping Bluetooth
66 if [ "$UART_CONF" != "no" ]; then
67 killproc hciattach >/dev/null 2>&1
69 rm -f /var/lock/subsys/bluetooth
71 # show "%s service is not running." Bluetooth
72 msg_not_running Bluetooth
81 if [ -f /var/lock/subsys/bluetooth ]; then
82 # show "Reload %s service" Bluetooth
83 msg_reloading Bluetooth
87 # show "%s service is not running." Bluetooth
88 msg_not_running Bluetooth
97 # show "Usage: %s {start|stop|restart|reload|force-reload|status}"
98 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
104 # This must be last line !
105 # vi:syntax=sh:tw=78:ts=8:sw=4