File bluetooth.sh of Package bluez

#!/bin/bash
# $id$
# Bluetooth hotplug policy agent for Linux 2.6 kernels
#
# Bluetooth hotplug params include:
#
#        ACTION=%s [add or remove]
#        SUBSYSTEM=bluetooth
#
[ x"$SUBSYSTEM" = xbluetooth ] || {
	echo "bad invocation: SUBSYSTEM != bluetooth"
	exit 1
}

. /etc/sysconfig/hardware/scripts/functions

BLUETOOTH_CONFIG=/etc/sysconfig/bluetooth
test -r $BLUETOOTH_CONFIG || exit 6
. $BLUETOOTH_CONFIG

case $ACTION in

	add)
		info_mesg $ACTION $INTERFACE  $START_SERVICES
		if [ $START_SERVICES = "no" ]; then
			exit 0
		fi
		# for later consumption by the bluetooth-coldplug init script
		mkdir /dev/shm/bluetooth-adapter-present
		# this is a fake dbus call, which gets the adapter up via DBus activation
		/bin/dbus-send --system --type=method_call --print-reply --reply-timeout=1000 --dest=org.bluez / org.bluez.hello
		;;

	remove)
		info_mesg $ACTION $INTERFACE
		# Do this only if _all_ bt-devices are finally removed
		# Problem: Devices in hid-proxy-mode are not known as /dev/hciX
		if [ $ALWAYS_STOP_SERVICES = "yes" ]; then
			/etc/init.d/bluetooth stop
		fi
    		;;

	*)
		info_mesg Bluetooth $ACTION event not supported
		exit 1
		;;
esac
openSUSE Build Service is sponsored by