From: Michael Mrozek Date: Tue, 6 Apr 2010 22:09:07 +0000 (+0200) Subject: Fixed Bluetooth-Script to properly toggle BT on and off and restores last state on... X-Git-Tag: Release-2010-05/1~87 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2118d8379a1fd258f923ef79081bac15f9915ef7;p=openpandora.oe.git Fixed Bluetooth-Script to properly toggle BT on and off and restores last state on startup. --- diff --git a/recipes/pandora-system/pandora-scripts/op_bluetooth.sh b/recipes/pandora-system/pandora-scripts/op_bluetooth.sh index b195a7d..25fc72f 100644 --- a/recipes/pandora-system/pandora-scripts/op_bluetooth.sh +++ b/recipes/pandora-system/pandora-scripts/op_bluetooth.sh @@ -2,29 +2,30 @@ # # Released under the GPL -STARTUP=0 - -if [ ${1} = startup ]; then - STARTUP=1 -fi +#if [ $1 ]; then +# startup = "$1" +# echo $ +# echo $1 +#fi INTERFACE="`hciconfig | grep "^hci" | cut -d ':' -f 1`" -if [ ${STARTUP} = 1 ]; then +if [ ${1} = "startup" ]; then [ -f ~/.op_btenabled ] && sudo /usr/sbin/hciconfig ${INTERFACE} up pscan && sudo /usr/sbin/bluetoothd ||echo "Bluetooth: User has not enabled Bluetooth." else - + # Figure out if Bluetooth is running or not if [ "`hciconfig ${INTERFACE} | grep UP`" ] then - notify-send -u normal "Bluetooth" "Bluetooth is being disabled..." -i /usr/share/icons/hicolor/32x32/apps/bluetooth.png + notify-send -u normal "Bluetooth" "Bluetooth is being disabled..." -i /usr/share/icons/hicolor/32x32/apps/blueman.png sudo /usr/sbin/hciconfig ${INTERFACE} down rm ~/.op_btenabled else pgrep bluetoothd - if [ $? -ne 1 ]; then - notify-send -u normal "Bluetooth" "Bluetooth is being enabled..." -i /usr/share/icons/hicolor/32x32/apps/bluetooth.png + echo $INTERFACE + if [ $? -ne 1 ]; then + notify-send -u normal "Bluetooth" "Bluetooth is being enabled..." -i /usr/share/icons/hicolor/32x32/apps/blueman.png sudo /usr/sbin/hciconfig ${INTERFACE} down sudo /usr/sbin/hciconfig ${INTERFACE} up pscan sudo /usr/sbin/bluetoothd