NetBSD/etc/rc.d/btattach
plunky 486e4624e5 some changes to serial bluetooth host controller interfaces
btuartd(8) should be named btattach(8) for consistency
with other parts of NetBSD

make btattach(8) a single-use tool for less complexity

device specicific initialisation (from btuart(4)) is carried
out prior to activating the line discipline (in btattach(8)),
which simplifies the API somewhat and means that the user
tool and the kernel do not need to be kept in sync.

btuart(4) driver is much reduced; naming is made consistent
and all tsleep() and delay() are removed to userland
2008-04-15 11:17:47 +00:00

45 lines
686 B
Bash

#!/bin/sh
#
# $NetBSD: btattach,v 1.1 2008/04/15 11:17:47 plunky Exp $
#
# PROVIDE: btattach
# REQUIRE: DAEMON
# BEFORE: bluetooth
$_rc_subr_loaded . /etc/rc.subr
name="btattach"
rcvar=${name}
required_files="/etc/bluetooth/btattach.conf"
start_cmd="btattach_start"
stop_cmd="btattach_stop"
btattach_start()
{
while read type tty speed flags; do
case ${type} in
\#*|"")
continue
;;
esac
/usr/sbin/btattach ${flags} ${type} ${tty} ${speed}
done < /etc/bluetooth/btattach.conf
}
btattach_stop()
{
pids="$(check_process btattach)"
if [ -n "${pids}" ]; then
for pid in ${pids}; do
kill $sig_stop $pid
done
fi
}
load_rc_config ${name}
run_rc_command "$1"