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 # Check if the service is already running?
24 if [ ! -f /var/lock/subsys/bluetooth ]; then
25 if is_yes "${DAEMON_ENABLE}" && [ -x /usr/sbin/bluetoothd ]; then
26 msg_starting bluetooth
27 daemon /usr/sbin/bluetoothd
31 if is_yes "${HID2HCI_ENABLE}" && [ -x /usr/sbin/hid2hci ]; then
33 daemon /usr/sbin/hid2hci -0 -q #be quiet
35 /bin/sleep 1 # delay for hid's to be detected by hotplug
38 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
39 HCID_FLAGS="-f /etc/bluetooth/hcid.conf"
41 if is_yes "${SDPD_ENABLE}" ; then
42 HCID_FLAGS="$HCID_FLAGS -s"
45 daemon /usr/sbin/hcid $HCID_FLAGS
49 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
51 daemon /usr/bin/hidd ${HIDD_OPTIONS} --server
55 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
57 daemon /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
61 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
63 daemon /usr/bin/dund ${DUND_OPTIONS}
67 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
69 daemon /usr/bin/pand ${PAND_OPTIONS}
73 if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
74 grep -v '^#' $UART_CONF | while read i; do
75 /usr/sbin/hciattach $i
78 touch /var/lock/subsys/bluetooth
80 msg_already_running bluetooth
85 if [ -f /var/lock/subsys/bluetooth ]; then
86 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
88 killproc /usr/bin/pand
91 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
93 killproc /usr/bin/dund
96 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
98 daemon /usr/bin/rfcomm release all
101 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
103 killproc /usr/bin/hidd
106 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
108 killproc /usr/sbin/hcid
111 if is_yes "${DAEMON_ENABLE}" && [ -x /usr/sbin/bluetoothd ]; then
112 msg_stopping bluetooth
113 killproc /usr/sbin/bluetoothd
116 if [ "$UART_CONF" != "no" ]; then
117 killproc hciattach >/dev/null 2>&1
119 rm -f /var/lock/subsys/bluetooth
121 msg_not_running bluetooth
126 # See how we were called.
139 if [ -f /var/lock/subsys/bluetooth ]; then
144 msg_not_running bluetooth
149 is_yes "${HID2HCI_ENABLE}" && status hid2hci
150 is_yes "${HCID_ENABLE}" && status hcid
151 is_yes "${SDPD_ENABLE}" && status sdpd
152 is_yes "${HIDD_ENABLE}" && status hidd
153 is_yes "${DUND_ENABLE}" && status dund
154 if [ -f /var/lock/subsys/bluetooth ]; then
161 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"