# Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
# Bug-Reports: see http://grml.org/bugs/
# License: This file is licensed under the GPL v2.
-# Latest change: Son Aug 06 20:30:34 CEST 2006 [mika]
+# Latest change: Mon Jän 14 20:36:21 CET 2008 [mika]
################################################################################
. /etc/grml/lsb-functions
+. /etc/grml/script-functions
-if [ $UID != 0 ] ; then
- eerror "Need root privileges. Please run $0 as user root." ; eend 1
+check4root || exit 1
+
+if ! modprobe -l | grep snd-bt-sco ; then
+ eerror "Sorry, could not find kernel module snd-bt-sco. Exiting." ; eend 1
+ ewarn "The kernel version you are using either does not support the snd-bt-sco module..."
+ ewarn "... yet or you should take a look at Debian package bluez-audio."
exit 1
fi
einfo "Starting bluetooth support."
eindent
- if ! [ -r $HCID_CONF ] ; then
+ if ! [ -r "$HCID_CONF" ] ; then
ewarn "$HCID_CONF does not exist. Setting it up."
cat > $HCID_CONF <<EOF
# Bluetooth headset configuration file created by bt-audio.
rm -f $SUCCESS $ERROR
;;
stop)
- einfo "Stopping hcid."
- killall hcid ; eend $? # workaround because start-stop-daemon does not work :-/
+ HCIDAEMON=$(pgrep hcid)
+ if [ -n "$HCIDAEMON" ] ; then
+ einfo "Stopping hcid."
+ kill $HCIDAEMON
+ eend $? # workaround because start-stop-daemon does not work :-/
+ else
+ einfo "No running hcid found, nothing to stop."
+ eend 0
+ fi
+
ewarn "Will not stop dbus as it might be used by other services." ; eend 0
+
einfo "Disconnecting all human input devices."
logger -t "bluez-connect" "disconnected all human input devices"
hidd --killall ; eend $?