]> git.pld-linux.org Git - packages/bluez.git/blobdiff - bluez.init
up to 5.75
[packages/bluez.git] / bluez.init
index 7fdee4929b09572c62964defbe053ce0afc5ce07..6b89ff4c522349a5e4c0fa4b9fa317c7ea8a603a 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# bluetooth    Bluetooth subsystem starting and stopping
+# bluetooth    Bluetooth subsystem starting and stopping. Turn HID adapters into Bluetooth ones.
 #
 # chkconfig:   345 50 83
 #
 
 start() {
        # Check if the service is already running?
-       if [ ! -f /var/lock/subsys/bluetooth ]; then
-               msg_starting hid2hci
-               daemon /usr/sbin/hid2hci -q -r hci
-               RETVAL=$?
-               /bin/sleep 1 # delay for hid's to be detected by hotplug
-               touch /var/lock/subsys/bluetooth
-       else
+       if [ -f /var/lock/subsys/bluetooth ]; then
                msg_already_running bluetooth
+               return
+       fi
+
+       if [ ! -x /sbin/udevadm ]; then
+               return
        fi
+
+       msg_starting "Bluetooth devices"
+       daemon /sbin/udevadm trigger --subsystem-match=bluetooth --action=add
+       RETVAL=$?
+       touch /var/lock/subsys/bluetooth
 }
 
 stop() {
-       if [ -f /var/lock/subsys/bluetooth ]; then
-               msg_stopping hid2hci
-               daemon /usr/sbin/hid2hci -q -r hid
-               rm -f /var/lock/subsys/bluetooth
-       else
+       if [ ! -f /var/lock/subsys/bluetooth ]; then
                msg_not_running bluetooth
+               return
        fi
+
+       # nothing needed to stop it
+       rm -f /var/lock/subsys/bluetooth
 }
 
 condrestart() {
-       if [ -f /var/lock/subsys/bluetooth ]; then
-               stop
-               start
-       else
+       if [ ! -f /var/lock/subsys/bluetooth ]; then
                msg_not_running bluetooth
                RETVAL=$1
+               return
        fi
+
+       stop
+       start
+}
+
+status() {
+       if [ ! -f /var/lock/subsys/bluetooth ]; then
+               msg_not_running bluetooth
+               RETVAL=3
+               return $RETVAL
+       fi
+
+       nls "bluetooth is running"
 }
 
 RETVAL=0
@@ -64,11 +79,8 @@ case "$1" in
        condrestart 0
        ;;
   status)
-       if [ -f /var/lock/subsys/bluetooth ]; then
-               exit 0
-       else
-               exit 1
-       fi
+       status
+       RETVAL=$?
        ;;
   *)
        msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
This page took 0.074374 seconds and 4 git commands to generate.