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 "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
40 daemon /usr/bin/hidd ${HIDD_OPTIONS} --server
44 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
46 daemon /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
50 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
52 daemon /usr/bin/dund ${DUND_OPTIONS}
56 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
58 daemon /usr/bin/pand ${PAND_OPTIONS}
62 if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
63 grep -v '^#' $UART_CONF | while read i; do
64 /usr/sbin/hciattach $i
67 touch /var/lock/subsys/bluetooth
69 msg_already_running bluetooth
74 if [ -f /var/lock/subsys/bluetooth ]; then
75 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
77 killproc /usr/bin/pand
80 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
82 killproc /usr/bin/dund
85 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
87 daemon /usr/bin/rfcomm release all
90 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
92 killproc /usr/bin/hidd
95 if is_yes "${DAEMON_ENABLE}" && [ -x /usr/sbin/bluetoothd ]; then
96 msg_stopping bluetooth
97 killproc /usr/sbin/bluetoothd
100 if [ "$UART_CONF" != "no" ]; then
101 killproc hciattach >/dev/null 2>&1
103 rm -f /var/lock/subsys/bluetooth
105 msg_not_running bluetooth
110 if [ -f /var/lock/subsys/bluetooth ]; then
114 msg_not_running bluetooth
120 # See how we were called.
136 if [ -f /var/lock/subsys/bluetooth ]; then
137 msg_reloading bluetoothd
138 killproc bluetoothd -HUP
141 msg_not_running bluetooth
146 is_yes "${HID2HCI_ENABLE}" && status hid2hci
147 is_yes "${HCID_ENABLE}" && status bluetoothd
148 is_yes "${HIDD_ENABLE}" && status hidd
149 is_yes "${DUND_ENABLE}" && status dund
150 is_yes "${PAND_ENABLE}" && status pand
151 if [ -f /var/lock/subsys/bluetooth ]; then
158 msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"