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 msg_starting bluetooth; started
29 if is_yes "${HID2HCI_ENABLE}" && [ -x /usr/sbin/hid2hci ]; then
31 daemon /usr/sbin/hid2hci -0 -q #be quiet
33 /bin/sleep 1 # delay for hid's to be detected by hotplug
36 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
38 daemon /usr/sbin/hcid -f /etc/bluetooth/hcid.conf
42 if is_yes "${SDPD_ENABLE}" && [ -x /usr/sbin/sdpd ]; then
48 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
50 daemon /usr/bin/hidd ${HIDD_OPTIONS} --server
54 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
56 daemon /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
60 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
62 daemon /usr/bin/dund ${DUND_OPTIONS}
66 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
68 daemon /usr/bin/pand ${PAND_OPTIONS}
72 if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
73 grep -v '^#' $UART_CONF | while read i; do
74 /usr/sbin/hciattach $i
77 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bluetooth
79 msg_already_running bluetooth
83 if [ -f /var/lock/subsys/bluetooth ]; then
84 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
86 killproc /usr/bin/pand
89 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
91 killproc /usr/bin/dund
94 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
96 daemon /usr/bin/rfcomm release all
99 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
101 killproc /usr/bin/hidd
104 if is_yes "${SDPD_ENABLE}" && [ -x /usr/sbin/sdpd ]; then
106 killproc /usr/sbin/sdpd
109 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
111 daemon /usr/sbin/hcid
114 if [ "$UART_CONF" != "no" ]; then
115 killproc hciattach >/dev/null 2>&1
117 rm -f /var/lock/subsys/bluetooth
119 msg_not_running bluetooth
128 if [ -f /var/lock/subsys/bluetooth ]; then
133 msg_not_running bluetooth >&2
138 is_yes "${HID2HCI_ENABLE}" && status hid2hci
139 is_yes "${HCID_ENABLE}" && status hcid
140 is_yes "${SDPD_ENABLE}" && status sdpd
141 is_yes "${HIDD_ENABLE}" && status hidd
142 is_yes "${DUND_ENABLE}" && status dund
146 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
152 # This must be last line !
153 # vi:syntax=sh:tw=78:ts=8:sw=4