updated on Sat Jan 14 00:11:12 UTC 2012
[aur-mirror.git] / bluez-git / rc.bluetooth
bloba46ee2abbf18c2409ceb881121f33d28f2167cdd
1 #!/bin/bash
3 # Start/stop the Bluetooth daemons
6 . /etc/rc.conf
7 . /etc/rc.d/functions
9 DAEMON_NAME="bluetoothd"
10 HIDD_NAME="hidd"
11 RFCOMM_NAME="rfcomm"
12 PAND_NAME="pand"
13 DUND_NAME="dund"
15 DAEMON_EXEC="/usr/sbin/bluetoothd"
16 HIDD_EXEC="/usr/bin/hidd"
17 RFCOMM_EXEC="/usr/bin/rfcomm"
18 PAND_EXEC="/usr/bin/pand"
19 DUND_EXEC="/usr/bin/dund"
21 DAEMON_ENABLE="true"
22 HIDD_ENABLE="false"
23 RFCOMM_ENABLE="false"
24 DUND_ENABLE="false"
25 PAND_ENABLE="false"
27 RFCOMM_CONFIG="/etc/bluetooth/rfcomm.conf"
29 HIDD_OPTIONS=""
30 DUND_OPTIONS=""
31 PAND_OPTIONS=""
33 [ -f /etc/conf.d/bluetooth ] && . /etc/conf.d/bluetooth
35 case "$1" in
36 start)
37 stat_busy "Starting bluetooth subsystem:"
38 if [ "$DAEMON_ENABLE" = "true" -a -x "$DAEMON_EXEC" ] ; then
39 stat_append " $DAEMON_NAME"
40 $DAEMON_EXEC
41 sleep 1
43 if [ "$SDPD_ENABLE" = "true" -a -x "$SDPD_EXEC" ] ; then
44 stat_append " $SDPD_NAME"
45 $SDPD_EXEC
47 if [ "$HIDD_ENABLE" = "true" -a -x "$HIDD_EXEC" ]; then
48 stat_append " $HIDD_NAME"
49 $HIDD_EXEC $HIDD_OPTIONS
51 if [ "$RFCOMM_ENABLE" = "true" -a -x "$RFCOMM_EXEC" -a -f "$RFCOMM_CONFIG" ]; then
52 stat_append " $RFCOMM_NAME"
53 $RFCOMM_EXEC -f $RFCOMM_CONFIG bind all
55 if [ "$DUND_ENABLE" = "true" -a -x "$DUND_EXEC" -a -n "$DUND_OPTIONS" ]; then
56 stat_append " $DUND_NAME"
57 $DUND_EXEC $DUND_OPTIONS
59 if [ "$PAND_ENABLE" = "true" -a -x "$PAND_EXEC" -a -n "$PAND_OPTIONS" ]; then
60 stat_append " $PAND_NAME"
61 $PAND_EXEC $PAND_OPTIONS
63 add_daemon bluetooth
64 stat_done
66 stop)
67 stat_busy "Stopping bluetooth subsystem:"
69 stat_append " $PAND_NAME"
70 killall $PAND_NAME >/dev/null 2>&1
72 stat_append " $DUND_NAME"
73 killall $DUND_NAME >/dev/null 2>&1
75 if [ -x "$RFCOMM_EXEC" ]; then
76 stat_append " $RFCOMM_NAME"
77 $RFCOMM_EXEC release all >/dev/null 2>&1
80 stat_append " $HIDD_NAME"
81 killall $HIDD_NAME >/dev/null 2>&1
83 stat_append " $SDPD_NAME"
84 killall $SDPD_NAME >/dev/null 2>&1
86 stat_append " $DAEMON_NAME"
87 killall $DAEMON_NAME >/dev/null 2>&1
89 rm_daemon bluetooth
90 stat_done
92 restart)
93 $0 stop
94 sleep 1
95 $0 start
98 echo "usage: $0 {start|stop|restart}"
99 esac
100 exit 0