summaryrefslogtreecommitdiff
path: root/scripts/bt-dev-start.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/bt-dev-start.sh')
-rwxr-xr-xscripts/bt-dev-start.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/bt-dev-start.sh b/scripts/bt-dev-start.sh
new file mode 100755
index 0000000..b2783c4
--- /dev/null
+++ b/scripts/bt-dev-start.sh
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+#
+# Script for registering Marvell 89XX SDIO BT device
+#
+
+SETBD=/usr/etc/bluetooth/bt-set-addr.sh
+RFKILL=/usr/sbin/rfkill
+GREP=/usr/bin/pgrep
+HCI_CONFIG=/usr/bin/hciconfig
+CP="/bin/cp"
+KERNEL_DIR=`uname -a | awk '{print($3)}'`
+DRV_DIR=/lib/modules/$KERNEL_DIR/kernel
+BT_DRIVER=$DRV_DIR/drivers/net/wireless/sd8977/mbt_src/bt8xxx.ko
+
+echo "MARVELL89XX BT START"
+
+echo "Insert BT driver module"
+/usr/sbin/insmod $BT_DRIVER
+
+echo "create bd address and write bd address via /sys/module/bt8xxx/parameters/bt_mac"
+${SETBD}
+
+echo "Unblock bluetooth RFKILL"
+${RFKILL} unblock bluetooth
+
+echo "Power On"
+echo 1 > /sys/devices/platform/sd8x-rfkill/pwr_ctrl
+
+TIMEOUT=20
+
+for (( i=1; i<=$TIMEOUT; i++))
+do
+ /bin/sleep 0.1
+
+ if [ $i -eq $TIMEOUT ]
+ then
+ echo "time expired happen $i"
+ ${RFKILL} block bluetooth
+ exit 1
+ fi
+
+ if (${HCI_CONFIG} | ${GREP} hci); then
+ echo "Bluetooth device is made"
+ break
+ fi
+ echo "Continue...$i"
+done
+exit 0