#!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez-utils/files/bluetooth.rc,v 1.4 2004/07/15 00:23:15 agriffis Exp $ UART_CONF="/etc/bluetooth/uart" depend() { after hotplug } 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() { ebegin "Starting Bluetooth" if [ ${HCID_ENABLE} = true -a -x /usr/sbin/hcid ]; then ebegin " Starting hcid" start-stop-daemon --start --quiet --exec /usr/sbin/hcid -- -f $HCID_CONFIG eend $? fi if [ ${SDPD_ENABLE} = true -a -x /usr/sbin/sdpd ]; then ebegin " Starting sdpd" start-stop-daemon --start --quiet --exec /usr/sbin/sdpd eend $? fi if [ ${HIDD_ENABLE} = true -a -x /usr/bin/hidd ]; then ebegin " Starting hidd" start-stop-daemon --start --quiet --exec /usr/bin/hidd -- $HIDD_OPTIONS --server eend $? fi if [ ${HID2HCI_ENABLE} = true -a -x /usr/sbin/hid2hci ]; then ebegin " Running hid2hci" /usr/sbin/hid2hci -0 -q #be quiet eend $? fi if [ ${RFCOMM_ENABLE} = true -a -x /usr/bin/rfcomm ]; then ebegin " Starting rfcomm" start-stop-daemon --start --quiet --exec /usr/bin/rfcomm -- -f $RFCOMM_CONFIG bind all eend $? fi if [ ${DUND_ENABLE} = true -a -x /usr/bin/dund ]; then ebegin " Starting dund" start-stop-daemon --start --quiet --exec /usr/bin/dund -- $DUND_OPTIONS eend $? fi if [ ${PAND_ENABLE} = true -a -x /usr/bin/pand ]; then ebegin " Starting pand" start-stop-daemon --start --quiet --exec /usr/bin/pand -- $PAND_OPTIONS eend $? fi start_uarts eend 0 } stop() { ebegin "Shutting down Bluetooth" if [ ${HIDD_ENABLE} = true -a -x /usr/bin/hidd ]; then ebegin " Stopping hidd" start-stop-daemon --stop --quiet --exec /usr/bin/hidd eend $? fi if [ ${HCID_ENABLE} = true -a -x /usr/sbin/hcid ]; then ebegin " Stopping hcid" start-stop-daemon --stop --quiet --exec /usr/sbin/hcid eend $? fi if [ ${SDPD_ENABLE} = true -a -x /usr/sbin/sdpd ]; then ebegin " Stopping sdpd" start-stop-daemon --stop --quiet --exec /usr/sbin/sdpd eend $? fi if [ ${RFCOMM_ENABLE} = true -a -x /usr/bin/rfcomm ]; then ebegin " Stopping rfcomm" start-stop-daemon --stop --quiet --exec /usr/bin/rfcomm eend $? fi if [ ${DUND_ENABLE} = true -a -x /usr/bin/dund ]; then ebegin " Stopping dund" start-stop-daemon --stop --quiet --exec /usr/bin/dund eend $? fi if [ ${PAND_ENABLE} = true -a -x /usr/bin/pand ]; then ebegin " Stopping pand" start-stop-daemon --stop --quiet --exec /usr/bin/pand eend $? fi #seems as if this doesn't work anyway #/usr/sbin/hid2hci -1 stop_uarts eend 0 }