summaryrefslogtreecommitdiff
blob: a532e2652cdb05ce000d75dc0984449e52948df5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
#
# bluetooth.sh: udev external RUN script
#
# Copyright:
#	2005-2006 Henrik Brix Andersen <brix@gentoo.org>
#   2007      Petteri Räty <betelgeuse@gentoo.org>
#   2008      Tiziano Müller <dev-zero@gentoo.org>
# Distributed under the terms of the GNU General Public License v2

script=/etc/init.d/bluetooth

# Find out where sysfs is mounted. Exit if not available
sysfs=`grep -F sysfs /proc/mounts | awk '{print $2}'`
if [ "$sysfs" = "" ]; then
	echo "sysfs is required"
	exit 1
fi

if [ ! -d $sysfs/class/bluetooth/hci[0-9]* -a ! -d $sysfs/bus/bluetooth/devices/hci[0-9]* ]; then
	if $script --quiet status; then
		IN_HOTPLUG=1 $script --quiet stop
	fi
else
	if ! $script --quiet status; then
		IN_HOTPLUG=1 $script --quiet start
	fi
fi