Modify bluetoothd path in stack up script
[platform/core/connectivity/bluetooth-tools.git] / scripts / wearable / bt-stack-up.sh
1 #!/bin/sh
2
3 HCIDUMP_DIR="/opt/usr/media/.bluetooth"
4 HCIDUMP_FILENAME="bt_hcidump.log"
5 HCIDUMP_PATH="${HCIDUMP_DIR}/${HCIDUMP_FILENAME}"
6 LOGDUMP_DIR="/opt/etc/dump.d/module.d"
7 LOGDUMP_PATH="${LOGDUMP_DIR}/bt-hci-logdump.sh"
8
9 /usr/bin/bluetooth-hf-agent &
10 #
11 # Script for executing Bluetooth stack
12 #
13
14 # Register BT Device
15 /usr/etc/bluetooth/bt-dev-start.sh
16
17 if !(/usr/bin/hciconfig | grep hci); then
18         echo "Registering BT device is failed."
19         exit 1
20 fi
21
22 debug_mode=`cat /sys/module/sec_debug/parameters/enable`
23 debug_mode_user=`cat /sys/module/sec_debug/parameters/enable_user`
24
25 if [ ${debug_mode} = '1' -o ${debug_mode_user} = '1' ]
26 then
27         if [ -e /usr/sbin/hcidump ]
28         then
29                 # When *#9900# is typed, this is executed to archive logs. #
30                 /bin/mkdir -p ${LOGDUMP_DIR}
31                 /bin/cp -f /usr/etc/bluetooth/bt-hci-logdump.sh ${LOGDUMP_PATH}
32
33                 /bin/mkdir -p ${HCIDUMP_DIR}/old_hcidump
34                 /bin/rm -f ${HCIDUMP_DIR}/old_hcidump/*
35                 /bin/mv ${HCIDUMP_PATH}* ${HCIDUMP_DIR}/old_hcidump/
36                 /usr/sbin/hcidump -w ${HCIDUMP_PATH} &
37         fi
38 elif [ -e ${HCIDUMP_DIR} ]
39 then
40         /bin/rm -rf ${HCIDUMP_DIR}
41 fi
42
43 # Execute BlueZ BT stack
44 echo "Run bluetoothd"
45 /usr/libexec/bluetooth/bluetoothd -d -C &
46 /usr/bin/dbus-send --print-reply --system --type=method_call \
47                 --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 \
48                 org.freedesktop.systemd1.Manager.StartUnit \
49                 string:'wms.service' string:'fail'
50
51 exit 0