blob: 3e80196a1cf690731e2524109686a8f6eb4b98e5 [file] [log] [blame]
jeonghoon.lim6a2ca5a2012-07-13 13:00:37 -07001#!/system/bin/sh
2
3BLUETOOTH_SLEEP_PATH=/proc/bluetooth/sleep/proto
4LOG_TAG="mako-bluetooth"
5LOG_NAME="${0}:"
6
7hciattach_pid=""
8
9loge ()
10{
11 /system/bin/log -t $LOG_TAG -p e "$LOG_NAME $@"
12}
13
14logi ()
15{
16 /system/bin/log -t $LOG_TAG -p i "$LOG_NAME $@"
17}
18
19failed ()
20{
21 loge "$1: exit code $2"
22 exit $2
23}
24
25# Note that "hci_qcomm_init -e" prints expressions to set the shell variables
26# BTS_DEVICE, BTS_TYPE, BTS_BAUD, and BTS_ADDRESS.
27
28POWER_CLASS=`getprop qcom.bt.dev_power_class`
29TRANSPORT=`getprop ro.qualcomm.bt.hci_transport`
30
31#find the transport type
32logi "Transport : $TRANSPORT"
33
34case $POWER_CLASS in
35 1) PWR_CLASS="-p 0" ;
36 logi "Power Class: 1";;
37 2) PWR_CLASS="-p 1" ;
38 logi "Power Class: 2";;
39 3) PWR_CLASS="-p 2" ;
40 logi "Power Class: CUSTOM";;
41 *) PWR_CLASS="";
42 logi "Power Class: Ignored. Default(1) used (1-CLASS1/2-CLASS2/3-CUSTOM)";
43 logi "Power Class: To override, Before turning BT ON; setprop qcom.bt.dev_power_class <1 or 2 or 3>";;
44esac
45
46logwrapper /system/bin/hci_qcomm_init -e $PWR_CLASS
47
48case $? in
49 0) logi "Bluetooth QSoC firmware download succeeded, $BTS_DEVICE $BTS_TYPE $BTS_BAUD $BTS_ADDRESS";;
50 *) failed "Bluetooth QSoC firmware download failed" $exit_code_hci_qcomm_init;
51 exit $exit_code_hci_qcomm_init;;
52esac
53
54logi "start bluetooth smd transport"
55
56echo 1 > /sys/module/hci_smd/parameters/hcismd_set
57
58exit 0