2006-07-26 15:14:55 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2006-08-13 13:03:21 +04:00
|
|
|
# $NetBSD: btdevctl,v 1.1 2006/08/13 09:03:23 plunky Exp $
|
2006-07-26 15:14:55 +04:00
|
|
|
#
|
|
|
|
|
2006-08-13 13:03:21 +04:00
|
|
|
# PROVIDE: btdevctl
|
2006-07-26 15:14:55 +04:00
|
|
|
# REQUIRE: bluetooth
|
|
|
|
# BEFORE: LOGIN
|
|
|
|
|
|
|
|
$_rc_subr_loaded . /etc/rc.subr
|
|
|
|
|
2006-08-13 13:03:21 +04:00
|
|
|
name="btdevctl"
|
2006-07-26 15:14:55 +04:00
|
|
|
rcvar=${name}
|
|
|
|
command="/usr/sbin/${name}"
|
2006-08-13 13:03:21 +04:00
|
|
|
start_cmd="btdevctl_start"
|
|
|
|
stop_cmd="btdevctl_stop"
|
2006-07-26 15:14:55 +04:00
|
|
|
|
2006-08-13 13:03:21 +04:00
|
|
|
btdevctl_start()
|
2006-07-26 15:14:55 +04:00
|
|
|
{
|
|
|
|
echo 'Attaching Bluetooth devices:'
|
|
|
|
|
|
|
|
#
|
2006-08-13 13:03:21 +04:00
|
|
|
# If ${btdevctl_devices} is set, it should be a list of devices to
|
2006-07-26 15:14:55 +04:00
|
|
|
# attach. Otherwise, all available devices will be attached.
|
|
|
|
#
|
|
|
|
|
2006-08-13 13:03:21 +04:00
|
|
|
devs="${btdev_devices:-$(cd /dev/ && echo btdev*)}"
|
2006-07-26 15:14:55 +04:00
|
|
|
for dev in ${devs}; do
|
|
|
|
${command} ${dev} attach -q
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2006-08-13 13:03:21 +04:00
|
|
|
btdevctl_stop()
|
2006-07-26 15:14:55 +04:00
|
|
|
{
|
|
|
|
echo 'Detach Bluetooth devices:'
|
|
|
|
|
2006-08-13 13:03:21 +04:00
|
|
|
devs="${btdevctl_devices:-$(cd /dev/ && echo btdev*)}"
|
2006-07-26 15:14:55 +04:00
|
|
|
for dev in ${devs}; do
|
|
|
|
${command} ${dev} detach -q
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config ${name}
|
|
|
|
run_rc_command "$1"
|