NetBSD/etc/rc.d/btdevctl

45 lines
805 B
Bash

#!/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"