]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/initscripts/init.d/bluetooth
core81: set need reboot flag and restart apache.
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / bluetooth
index 4dd8ed322c70375cc97cb98bcef3808bf924f264..e3ee1b130e27af11576db5994bf3bcbb02ac2228 100644 (file)
@@ -7,29 +7,45 @@
 . /etc/sysconfig/rc
 . $rc_functions
 
+eval $(/usr/local/bin/readhash /var/ipfire/bluetooth/settings)
+
 case "$1" in
         start)
                 boot_mesg "Starting Bluetooth daemon..."
                 loadproc /usr/sbin/hcid
                sleep 1
+
+               if [ "$PASSKEY_AGENT" == "on" ]; then
+                   boot_mesg "Starting Bluetooth passkey-agent..."
+                   loadproc /usr/bin/passkey-agent --default $PWD &
+               fi
+
+               if [ "$RFCOMM0_BIND" == "on" ]; then
+                   boot_mesg "Bind rfcomm0 to cellphone/modem ${RFCOMM0_DEVICE//-/:}/$RFCOMM0_CHANNEL ..."
+                   rfcomm bind /dev/rfcomm0 ${RFCOMM0_DEVICE//-/:} $RFCOMM0_CHANNEL
+                   evaluate_retval
+               fi
+               if [ "$RFCOMM1_BIND" == "on" ]; then
+                   boot_mesg "Bind rfcomm1 to cellphone/modem ${RFCOMM1_DEVICE//-/:}/${RFCOMM1_CHANNEL} ..."
+                   rfcomm bind /dev/rfcomm1 ${RFCOMM1_DEVICE//-/:} $RFCOMM1_CHANNEL
+                   evaluate_retval
+               fi
+               exit 0;
                
-               # The passkey-agent is only needed for pairing
-               #boot_mesg "Starting Bluetooth passkey-agent..."
-                #loadproc /usr/bin/passkey-agent --default 12345 &
-
-               # Bind rfcomm to a blootooth cellphone/modem
-               #boot_mesg "Bind rfcomm0 to cellphone/modem..."
-               #rfcomm bind /dev/rfcomm0 00:11:22:33:44:55 1
-               #evaluate_retval
                 ;;
 
         stop)
-                #boot_mesg "Realease rfcomm0..."
-               #rfcomm release rfcomm0
-                #boot_mesg "Stopping Bluetooth passkey-agent..."
-               #killproc /usr/bin/passkey-agent
+               if [ -e /dev/rfcomm0 ]; then
+                   boot_mesg "Release rfcomm0..."
+                   rfcomm release rfcomm0
+               fi
+               if [ -e /dev/rfcomm1 ]; then
+                   boot_mesg "Release rfcomm1..."
+                   rfcomm release rfcomm1
+               fi
                 boot_mesg "Stopping Bluetooth daemon..."
                killproc /usr/sbin/hcid
+               exit 0;
                 ;;
 
         restart)
@@ -41,8 +57,7 @@ case "$1" in
         status)
                 statusproc /usr/sbin/hcid
                statusproc /usr/bin/passkey-agent
-               
-                ;;
+               ;;
 
         *)
                 echo "Usage: $0 {start|stop|restart|status}"