3
# Laptop mode tools module: bluetooth
7
if [ x$CONTROL_BLUETOOTH = x1 ] ; then
8
ENABLE_BLUETOOTH=$BATT_ENABLE_BLUETOOTH
9
if [ $ON_AC -eq 1 ] ; then
10
ENABLE_BLUETOOTH=$AC_ENABLE_BLUETOOTH
12
if [ x$ENABLE_BLUETOOTH = x1 ] ; then
13
$LM_VERBOSE && echo "Enabling bluetooth." >> $OUTPUT
15
for INTF in $BLUETOOTH_INTERFACES ; do
16
[ -d /sys/class/bluetooth/$INTF ] || continue
17
hciconfig $INTF up 2>&1 >> $OUTPUT
20
$LM_VERBOSE && echo "Disabling bluetooth." >> $OUTPUT
21
for INTF in $BLUETOOTH_INTERFACES ; do
22
[ -d /sys/class/bluetooth/$INTF ] || continue
23
hciconfig $INTF down 2>&1 >> $OUTPUT
25
# This may take a while to work because the module may be
26
# temporarily in use; we try three times. We don't use rmmod
27
# --wait, because that might hang!
28
modprobe -rq hci_usb || (sleep 1 ; modprobe -rq hci_usb) || (sleep 1 ; modprobe -rq hci_usb)