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 msg_starting bluetooth; started
26 if is_yes "${HID2HCI_ENABLE}" && [ -x /usr/sbin/hid2hci ]; then
28 daemon /usr/sbin/hid2hci -0 -q #be quiet
30 /bin/sleep 1 # delay for hid's to be detected by hotplug
33 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
34 HCID_FLAGS="-f /etc/bluetooth/hcid.conf"
36 if is_yes "${SDPD_ENABLE}" ; then
37 HCID_FLAGS="$HCID_FLAGS -s"
40 daemon /usr/sbin/hcid $HCID_FLAGS
44 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
46 daemon /usr/bin/hidd ${HIDD_OPTIONS} --server
50 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
52 daemon /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
56 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
58 daemon /usr/bin/dund ${DUND_OPTIONS}
62 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
64 daemon /usr/bin/pand ${PAND_OPTIONS}
68 if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
69 grep -v '^#' $UART_CONF | while read i; do
70 /usr/sbin/hciattach $i
73 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bluetooth
75 msg_already_running bluetooth
80 if [ -f /var/lock/subsys/bluetooth ]; then
81 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
83 killproc /usr/bin/pand
86 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
88 killproc /usr/bin/dund
91 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
93 daemon /usr/bin/rfcomm release all
96 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
98 killproc /usr/bin/hidd
101 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
103 killproc /usr/sbin/hcid
106 if [ "$UART_CONF" != "no" ]; then
107 killproc hciattach >/dev/null 2>&1
109 rm -f /var/lock/subsys/bluetooth
111 msg_not_running bluetooth
116 # See how we were called.
129 if [ -f /var/lock/subsys/bluetooth ]; then
134 msg_not_running bluetooth
139 is_yes "${HID2HCI_ENABLE}" && status hid2hci
140 is_yes "${HCID_ENABLE}" && status hcid
141 is_yes "${SDPD_ENABLE}" && status sdpd
142 is_yes "${HIDD_ENABLE}" && status hidd
143 is_yes "${DUND_ENABLE}" && status dund
144 if [ -f /var/lock/subsys/bluetooth ]; then
151 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"