summaryrefslogtreecommitdiff
path: root/etc/rc.d/btdevctl
blob: 3573ddbd5ed3adb6b4df11f4e994fdf33c352676 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
#
# $NetBSD: btdevctl,v 1.2 2006/08/14 18:55:18 plunky Exp $
#

# PROVIDE: btdevctl
# REQUIRE: bluetooth
# BEFORE:  LOGIN

$_rc_subr_loaded . /etc/rc.subr

name="btdevctl"
rcvar=${name}
command="/usr/sbin/${name}"
start_cmd="btdevctl_start"
stop_cmd="btdevctl_stop"

btdevctl_start()
{
	echo 'Attaching Bluetooth devices:'

	#
	# If ${btdevctl_devices} is set, it should be a list of devices to
	# attach. Otherwise, all available devices will be attached.
	#

	devs="${btdevctl_devices:-$(cd /dev/ && echo btdev*)}"
	for dev in ${devs}; do
		${command} ${dev} attach -q
	done
}

btdevctl_stop()
{
	echo 'Detach Bluetooth devices:'

	devs="${btdevctl_devices:-$(cd /dev/ && echo btdev*)}"
	for dev in ${devs}; do
		${command} ${dev} detach -q
	done
}

load_rc_config ${name}
run_rc_command "$1"