#!/sbin/runscript # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ UART_CONF="/etc/bluetooth/uart" depend() { after coldplug need dbus } start_uarts() { [ -f /usr/sbin/hciattach -a -f ${UART_CONF} ] || return grep -v '^#' ${UART_CONF} | while read i; do /usr/sbin/hciattach $i done } stop_uarts() { killall hciattach > /dev/null 2>&1 } start() { if [ "${HID2HCI_ENABLE}" = "true" ]; then ebegin "Switch from HID to HCI mode" /usr/sbin/hid2hci -0 -q #be quiet /bin/sleep 1 # delay for hid's to be detected by hotplug eend $? fi if [ -f "${HCID_CONFIG}" ]; then ebegin "Starting hcid" start-stop-daemon --start --quiet \ --exec /usr/sbin/hcid -- -f $HCID_CONFIG eend $? else eerror "Not enabling hcid because HCID_CONFIG is missing." fi start_uarts eend 0 } stop() { #FIXME: doesn't work #if [ "${HID2HCI_ENABLE}" = "true" ]; then # ebegin "Switch from HCI to HID mode" # /usr/sbin/hid2hci -1 -q #be quiet # /bin/sleep 1 # delay for hid's to be detected by hotplug # eend $? #fi ebegin "Stopping hcid" start-stop-daemon --stop --quiet --exec /usr/sbin/hcid eend $? stop_uarts eend 0 }