]> git.pld-linux.org Git - packages/bluez.git/blobdiff - bluez.init
- Up to 4.60.
[packages/bluez.git] / bluez.init
index ec8fbf8a07e91c328531dca55072ed25b5af4357..23292810e4c50787748d563a02019de24baa8988 100644 (file)
@@ -1,8 +1,8 @@
 #!/bin/sh
 #
-# bluetooth    Bluetooth subsystem starting and stopping
+# bluetooth    Bluetooth subsystem starting and stopping. Turn HID adapters into Bluetooth ones.
 #
-# chkconfig:   345 25 90
+# chkconfig:   345 50 83
 #
 # description: Bluetooth subsystem
 #
 # Source function library
 . /etc/rc.d/init.d/functions
 
-UART_CONF="/etc/bluetooth/uart"
 [ -f /etc/sysconfig/bluetooth ] && . /etc/sysconfig/bluetooth
 
-if [ "$UART_CONF" != "no" -a ! -f "$UART_CONF" ]; then
-       UART_CONF="no"
-fi
-
 start() {
        # Check if the service is already running?
        if [ ! -f /var/lock/subsys/bluetooth ]; then
-               if is_yes "${DAEMON_ENABLE}" && [ -x /usr/sbin/bluetoothd ]; then
-                       msg_starting bluetooth
-                       daemon /usr/sbin/bluetoothd
+               if [ -x /sbin/udevadm ]; then
+                       msg_starting "Bluetooth devices"
+                       daemon /sbin/udevadm trigger --subsystem-match=bluetooth
                        RETVAL=$?
+                       touch /var/lock/subsys/bluetooth
                fi
-
-               if is_yes "${HID2HCI_ENABLE}" && [ -x /usr/sbin/hid2hci ]; then
-                       msg_starting hid2hci
-                       daemon /usr/sbin/hid2hci -0 -q  # be quiet
-                       RETVAL=$?
-                       /bin/sleep 1 # delay for hid's to be detected by hotplug
-               fi
-
-               if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
-                       msg_starting hidd
-                       daemon /usr/bin/hidd ${HIDD_OPTIONS} --server
-                       RETVAL=$?
-               fi
-
-               if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
-                       msg_starting rfcomm
-                       daemon /usr/bin/rfcomm -f /etc/bluetooth/rfcomm.conf bind all
-                       RETVAL=$?
-               fi
-
-               if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
-                       msg_starting dund
-                       daemon /usr/bin/dund ${DUND_OPTIONS}
-                       RETVAL=$?
-               fi
-
-               if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
-                       msg_starting pand
-                       daemon /usr/bin/pand ${PAND_OPTIONS}
-                       RETVAL=$?
-               fi
-
-               if [ -f /usr/sbin/hciattach -a "$UART_CONF" != "no" ]; then
-                       grep -v '^#' $UART_CONF | while read i; do
-                               /usr/sbin/hciattach $i
-                       done
-               fi
-               touch /var/lock/subsys/bluetooth
        else
                msg_already_running bluetooth
        fi
@@ -72,34 +30,7 @@ start() {
 
 stop() {
        if [ -f /var/lock/subsys/bluetooth ]; then
-               if is_yes "${PAND_ENABLE}" && [ -x /usr/bin/pand ]; then
-                       msg_stopping pand
-                       killproc /usr/bin/pand
-               fi
-
-               if is_yes "${DUND_ENABLE}" && [ -x /usr/bin/dund ]; then
-                       msg_stopping dund
-                       killproc /usr/bin/dund
-               fi
-
-               if is_yes "${RFCOMM_ENABLE}" && [ -x /usr/bin/rfcomm ]; then
-                       msg_stopping rfcomm
-                       daemon /usr/bin/rfcomm release all
-               fi
-
-               if is_yes "${HIDD_ENABLE}" && [ -x /usr/bin/hidd ]; then
-                       msg_stopping hidd
-                       killproc /usr/bin/hidd
-               fi
-
-               if is_yes "${DAEMON_ENABLE}" && [ -x /usr/sbin/bluetoothd ]; then
-                       msg_stopping bluetooth
-                       killproc /usr/sbin/bluetoothd
-               fi
-
-               if [ "$UART_CONF" != "no" ]; then
-                       killproc hciattach >/dev/null 2>&1
-               fi
+               # nothing needed to stop it
                rm -f /var/lock/subsys/bluetooth
        else
                msg_not_running bluetooth
@@ -125,29 +56,14 @@ case "$1" in
   stop)
        stop
        ;;
-  restart)
+  restart|reload|force-reload)
        stop
        start
        ;;
   try-restart)
        condrestart 0
        ;;
-  reload|force-reload)
-       if [ -f /var/lock/subsys/bluetooth ]; then
-               msg_reloading bluetoothd
-               killproc bluetoothd -HUP
-               RETVAL=$?
-       else
-               msg_not_running bluetooth
-               exit 7
-       fi
-       ;;
   status)
-       is_yes "${HID2HCI_ENABLE}" && status hid2hci
-       is_yes "${HCID_ENABLE}" && status bluetoothd
-       is_yes "${HIDD_ENABLE}" && status hidd
-       is_yes "${DUND_ENABLE}" && status dund
-       is_yes "${PAND_ENABLE}" && status pand
        if [ -f /var/lock/subsys/bluetooth ]; then
                exit 0
        else
This page took 0.047536 seconds and 4 git commands to generate.