1116e6b9eaef72eb2bec128b0f6c9989e0e4691e
[platform/core/connectivity/bluetooth-tools.git] / scripts / wearable / bt-stack-up.sh
1 #!/bin/sh
2 PATH=/bin:/usr/bin:/sbin:/usr/sbin
3
4 RFKILL=/usr/sbin/rfkill
5 GREP=/usr/bin/grep
6 HFP_HF=hfp_hf
7
8 echo "Check for bcm43012 device - TW2"
9 if (${RFKILL} list | ${GREP} bcm43012); then
10         echo "Solis TW2 device"
11         HFP_AG=hfp_ag
12 fi
13
14 if [ $HFP_HF ]
15 then
16 /usr/bin/bluetooth-hf-agent &
17 fi
18
19 if [ $HFP_AG ]
20 then
21 /usr/bin/bluetooth-ag-agent &
22 fi
23
24 #
25 # Script for executing Bluetooth stack
26 #
27
28 # Start HCI logging
29 systemctl start bluetooth-hci-logger.service
30
31 # Register BT Device
32 /usr/etc/bluetooth/bt-dev-start.sh
33
34 if !(/usr/bin/hciconfig | grep hci); then
35         echo "Registering BT device is failed."
36         systemctl stop bluetooth-hci-logger.service
37         exit 1
38 fi
39
40 # Execute BlueZ BT stack
41 echo "Run bluetoothd"
42 /usr/libexec/bluetooth/bluetoothd -d -C &
43
44 exit 0