#!/bin/sh # # $NetBSD: btdevctl,v 1.3 2006/09/10 15:45:55 plunky Exp $ # # PROVIDE: btdevctl # REQUIRE: bluetooth # BEFORE: LOGIN $_rc_subr_loaded . /etc/rc.subr name="btdevctl" rcvar=${name} required_files="/etc/bluetooth/btdevctl.conf" start_cmd='do_btdevctl "-A" "Attaching"' stop_cmd='do_btdevctl "-D" "Detaching"' do_btdevctl() { echo "${2} Bluetooth devices:" while read -r service address device junk; do case ${service} in \#*|"") continue ;; esac if [ -z ${device} -o ${junk} ]; then echo "${name}: invalid entry" return 1 fi /usr/sbin/btdevctl ${1} "-a" ${address} "-d" ${device} "-s" ${service} done < /etc/bluetooth/btdevctl.conf } load_rc_config ${name} run_rc_command "$1"