Fix TIVI-1723
[platform/core/connectivity/bluetooth-tools.git] / scripts / bt-edutm-on.sh
1 #!/bin/sh
2
3 #
4 # Script for turning on Bluetooth EDUTM
5 #
6
7 # Register BT Device
8 /usr/etc/bluetooth/bt-dev-start.sh
9
10 if !(/usr/sbin/hciconfig | grep hci); then
11         echo "BT EDUTM failed. Registering BT device is failed."
12         exit 1
13 fi
14
15 # Execute BlueZ BT stack
16 echo "Run bluetoothd"
17 /usr/sbin/bluetoothd
18 /usr/bin/bt-service &
19 sleep 0.1
20
21 /usr/sbin/hciconfig hci0 name TIZEN-Mobile
22
23 /usr/sbin/hciconfig hci0 piscan
24
25 if [ -e "/sys/devices/hci0/idle_timeout" ]
26 then
27         echo "Set idle time"
28         echo 0> /sys/devices/hci0/idle_timeout
29 fi
30
31 if [ -e /usr/etc/bluetooth/TIInit_* ]
32 then
33         echo "Reset device"
34         hcitool cmd 0x3 0xFD0C
35 fi
36
37 echo "Configure BT device"
38 hcitool cmd 0x3 0x0005 0x02 0x00 0x02
39
40 echo "Send BT edutm command"
41 hcitool cmd 0x06 0x0003
42
43 echo "BT edutm done"
44
45 # result
46 exit 0