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
35 daemon /usr/sbin/hcid -f /etc/bluetooth/hcid.conf
39 if is_yes "${SDPD_ENABLE}" && [ -x /usr/sbin/sdpd ]; then
45 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
47 daemon /usr/bin/hidd ${HIDD_OPTIONS} --server
51 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
53 daemon /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
57 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
59 daemon /usr/bin/dund ${DUND_OPTIONS}
63 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
65 daemon /usr/bin/pand ${PAND_OPTIONS}
69 if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
70 grep -v '^#' $UART_CONF | while read i; do
71 /usr/sbin/hciattach $i
74 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bluetooth
76 msg_already_running bluetooth
81 if [ -f /var/lock/subsys/bluetooth ]; then
82 if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
84 killproc /usr/bin/pand
87 if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
89 killproc /usr/bin/dund
92 if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
94 daemon /usr/bin/rfcomm release all
97 if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
99 killproc /usr/bin/hidd
102 if is_yes "${SDPD_ENABLE}" && [ -x /usr/sbin/sdpd ]; then
104 killproc /usr/sbin/sdpd
107 if is_yes "${HCID_ENABLE}" && [ -x /usr/sbin/hcid ]; then
109 killproc /usr/sbin/hcid
112 if [ "$UART_CONF" != "no" ]; then
113 killproc hciattach >/dev/null 2>&1
115 rm -f /var/lock/subsys/bluetooth
117 msg_not_running bluetooth
122 # See how we were called.
135 if [ -f /var/lock/subsys/bluetooth ]; then
140 msg_not_running bluetooth
145 is_yes "${HID2HCI_ENABLE}" && status hid2hci
146 is_yes "${HCID_ENABLE}" && status hcid
147 is_yes "${SDPD_ENABLE}" && status sdpd
148 is_yes "${HIDD_ENABLE}" && status hidd
149 is_yes "${DUND_ENABLE}" && status dund
150 if [ -f /var/lock/subsys/bluetooth ]; then
157 msg_usage "$0 {start|stop|restart|reload|force-reload|status}"