4
# Required-Start: $local_fs $syslog $remote_fs dbus
5
# Required-Stop: $local_fs $syslog $remote_fs
6
# Default-Start: 2 3 4 5
8
# Short-Description: Start bluetooth daemons
11
# bluez Bluetooth subsystem starting and stopping
13
# originally from bluez's scripts/bluetooth.init
15
# Edd Dumbill <ejad@debian.org>
16
# LSB 3.0 compilance and enhancements by Filippo Giunchedi <filippo@debian.org>
18
# Updated for bluez 4.7 by Mario Limonciello <mario_limonciello@dell.com>
20
# Note: older daemons like dund pand hidd are now shipped inside the
21
# bluez-compat package
23
PATH=/sbin:/bin:/usr/sbin:/usr/bin
26
DAEMON=/usr/sbin/bluetoothd
27
HCIATTACH=/usr/sbin/hciattach
32
UART_CONF=/etc/bluetooth/uart
35
RFCOMM=/usr/bin/$RFCOMM_NAME
36
RFCOMM_CONF=/etc/bluetooth/$RFCOMM_NAME.conf
37
SDPTOOL=/usr/bin/sdptool
39
SSD_OPTIONS="--oknodo --quiet --exec $DAEMON"
41
test -f $DAEMON || exit 0
43
# FIXME: any of the sourced files may fail if/with syntax errors
44
test -f /etc/default/bluetooth && . /etc/default/bluetooth
45
test -f /etc/default/rcS && . /etc/default/rcS
47
. /lib/lsb/init-functions
51
# FIXME: this function is possibly a no-op
54
# declaring IFS local in this function, removes the need to
58
test -x $SDPTOOL || return 1
60
# FIXME: where does SDPTOOL_OPTIONS come from?
61
if ! test -z "$SDPTOOL_OPTIONS" ; then
63
for o in $SDPTOOL_OPTIONS ; do
64
#echo "execing $SDPTOOL $o"
66
if [ "$VERBOSE" != no ]; then
69
$SDPTOOL $o >/dev/null 2>&1
77
log_progress_msg "switching to HID/HCI no longer done in init script, see /usr/share/doc/bluez/NEWS.Debian.gz" || :
79
alias enable_hci_input=hci_input
80
alias disable_hci_input=hci_input
84
[ -f $HCIATTACH ] && [ -f $UART_CONF ] || return
85
grep -v '^#' $UART_CONF | while read i; do
86
if [ "$VERBOSE" != no ]; then
89
$HCIATTACH $i >/dev/null 2>&1
96
killall ${HCIATTACH##*/} >/dev/null 2>&1 || :
101
if [ -x $RFCOMM ] && [ -f $RFCOMM_CONF ] ; then
102
# rfcomm must always succeed for now: users
103
# may not yet have an rfcomm-enabled kernel
104
if [ "$VERBOSE" != no ]; then
105
log_progress_msg "${RFCOMM##*/}"
106
$RFCOMM -f $RFCOMM_CONF bind all || :
108
$RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || :
115
if [ -x $RFCOMM ] ; then
116
if [ "$VERBOSE" != no ]; then
117
log_progress_msg "${RFCOMM##*/}"
118
$RFCOMM unbind all || :
120
$RFCOMM unbind all >/dev/null 2>&1 || :
127
if [ -x $RFCOMM ] && [ -f $RFCOMM_CONF ] ; then
128
if [ "$VERBOSE" != no ]; then
129
log_progress_msg "${RFCOMM##*/}"
130
$RFCOMM unbind all || :
131
$RFCOMM -f $RFCOMM_CONF bind all || :
133
$RFCOMM unbind all >/dev/null 2>&1|| :
134
$RFCOMM -f $RFCOMM_CONF bind all >/dev/null 2>&1 || :
141
log_daemon_msg "Starting $DESC"
143
if test "$BLUETOOTH_ENABLED" = 0; then
144
log_progress_msg "disabled. see /etc/default/bluetooth"
149
start-stop-daemon --start $SSD_OPTIONS
150
log_progress_msg "${DAEMON##*/}"
156
if test "$HID2HCI_ENABLED" = 1; then
161
if test "$HIDD_ENABLED" = 1 ||
162
test "$PAND_ENABLED" = 1 || test "$DUND_ENABLED" = 1; then
163
log_progress_msg "compatibily daemons not started, see bluez-compat package"
169
log_daemon_msg "Stopping $DESC"
170
if test "$BLUETOOTH_ENABLED" = 0; then
171
log_progress_msg "disabled."
176
if test "$HID2HCI_UNDO" = 1; then
179
start-stop-daemon --stop $SSD_OPTIONS
180
log_progress_msg "${DAEMON}"
184
restart|force-reload)
190
status_of_proc "$DAEMON" "$DESC" && exit 0 || exit $?
193
N=/etc/init.d/bluetooth
194
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2