NetBSD/etc/rc.d/btdevctl

45 lines
802 B
Plaintext
Raw Normal View History

#!/bin/sh
#
# $NetBSD: btdevctl,v 1.1 2006/08/13 09:03:23 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="${btdev_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"