Code sync: merged tizen 2.4 base source code 42/37342/1 accepted/tizen/common/20150521.125352 accepted/tizen/tv/20150401.063353 accepted/tizen/tv/20150505.044216 accepted/tizen/wearable/20150401.061021 submit/tizen_common/20150520.888882 submit/tizen_mobile/20150401.025911 submit/tizen_mobile/20150504.081008 submit/tizen_tv/20150401.025921 submit/tizen_tv/20150504.081003 submit/tizen_wearable/20150401.025929
authorseungku kim <seungku.kim@samsung.com>
Wed, 11 Feb 2015 11:00:36 +0000 (20:00 +0900)
committerseungku kim <seungku.kim@samsung.com>
Wed, 25 Mar 2015 00:53:50 +0000 (09:53 +0900)
branch: tizen_2.4
ID: I51bceaa3d811ae4c6e8450ebf237f28678597387

Applied all previous patches in Tizen 3.0

Change-Id: I0f046e94b777805850f939c5ddd5ef2caa052b70
Signed-off-by: seungku kim <seungku.kim@samsung.com>
24 files changed:
debian/bluetooth-tools.install.in [deleted file]
debian/changelog [deleted file]
debian/compat [deleted file]
debian/control [deleted file]
debian/rules [deleted file]
packaging/bluetooth-tools.spec
scripts/CMakeLists.txt
scripts/bt-edutm-dev-up.sh [changed mode: 0644->0755]
scripts/bt-edutm-mode-on.sh
scripts/bt-edutm-off.sh
scripts/bt-edutm-on.sh [changed mode: 0644->0755]
scripts/bt-hci-logdump.sh [new file with mode: 0755]
scripts/bt-run-hcidump.sh [new file with mode: 0755]
scripts/etc/bluetooth-address [moved from scripts/bluetooth-address with 100% similarity]
scripts/etc/bt-reset-env.sh [moved from scripts/bt-reset-env.sh with 100% similarity]
scripts/etc/bt-stack-down.sh [moved from scripts/bt-stack-down.sh with 100% similarity]
scripts/etc/bt-stack-up.sh [moved from scripts/bt-stack-up.sh with 100% similarity]
scripts/mobile/bluetooth-address [new file with mode: 0755]
scripts/mobile/bt-reset-env.sh [new file with mode: 0755]
scripts/mobile/bt-stack-down.sh [new file with mode: 0755]
scripts/mobile/bt-stack-up.sh [new file with mode: 0755]
scripts/wearable/bt-reset-env.sh [new file with mode: 0755]
scripts/wearable/bt-stack-down.sh [new file with mode: 0755]
scripts/wearable/bt-stack-up.sh [new file with mode: 0755]

diff --git a/debian/bluetooth-tools.install.in b/debian/bluetooth-tools.install.in
deleted file mode 100644 (file)
index b498cd0..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-@PREFIX@/etc/bluetooth/*
-/etc/rc.d/*
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644 (file)
index 4a89341..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-bluetooth-tools (0.2.35) precise; urgency=low
-
-  * Synchronize the code with Private git
-  * Git: adaptation/devices/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.35
-
- -- Jaekyun Lee <jkyun.lee@samsung.com>  Fri, 07 Dec 2012 14:42:28 +0900
-
-bluetooth-tools (0.2.32) unstable; urgency=low
-
-  * Upload the package
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.32
-
- -- DoHyun Pyun <dh79.pyun@samsung.com>  Fri, 05 Oct 2012 15:04:50 +0900
-
-bluetooth-tools (0.2.31) unstable; urgency=low
-
-  * Upload the package
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.31
-
- -- DoHyun Pyun <dh79.pyun@samsung.com>  Wed, 26 Sep 2012 13:31:06 +0900
-
-bluetooth-tools (0.2.30) unstable; urgency=low
-
-  * Change SMACK domain name
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.30
-
- -- DoHyun Pyun <dh79.pyun@samsung.com>  Wed, 26 Sep 2012 08:45:53 +0900
-
-bluetooth-tools (0.2.29) unstable; urgency=low
-
-  * Change SMACK domain name
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.29
-
- -- Sangki Park <sangki79.park@samsung.com>  Tue, 25 Sep 2012 10:35:52 +0900
-
-bluetooth-tools (0.2.28) unstable; urgency=low
-
-  * Upload the package
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.28
-
- -- Sangki Park <sangki79.park@samsung.com>  Fri, 21 Sep 2012 09:06:54 +0900
-
-bluetooth-tools (0.2.27) natty; urgency=low
-
-  * Upload the package
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.27
-
- -- DoHyun Pyun <dh79.pyun@samsung.com>  Mon, 17 Sep 2012 10:56:45 +0900
-
-bluetooth-tools (0.2.26) unstable; urgency=low
-
-  * Upload the package
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.26
-
- -- Divya yadav <divya.yadav@samsung.com>  Tue, 07 Aug 2012 12:48:23 +0530
-
-bluetooth-tools (0.2.25) unstable; urgency=low
-
-  * Upload the package
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.25
-
- -- DoHyun Pyun <dh79.pyun@samsung.com>  Wed, 23 May 2012 12:15:46 +0900
-
-bluetooth-tools (0.2.24) unstable; urgency=low
-
-  * Remove the code to launch the Obexd
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.24
-
- -- DoHyun Pyun <dh79.pyun@samsung.com>  Fri, 11 May 2012 09:42:39 +0900
-
-bluetooth-tools (0.2.23) unstable; urgency=low
-
-  * Changhe the basic FTP root folder
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.23
-
- -- DoHyun Pyun <dh79.pyun@samsung.com>  Tue, 08 May 2012 08:53:47 +0900
-
-bluetooth-tools (0.2.22) unstable; urgency=low
-
-  * split from bluetooth-dev-tools
-  * Git: slp/pkgs/b/bluetooth-tools
-  * Tag: bluetooth-tools_0.2.22
-
- -- Jkyun Lee <jkyun.lee@samsung.com>  Mon, 05 Mar 2012 13:48:49 +0900
diff --git a/debian/compat b/debian/compat
deleted file mode 100644 (file)
index 7ed6ff8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/debian/control b/debian/control
deleted file mode 100644 (file)
index 3705828..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-Source: bluetooth-tools
-Section: devel
-Priority: optional
-Maintainer: DoHyun Pyun <dh79.pyun@samsung.com>, ChanYeol Park <chanyeol.park@samsung.com>, Girish A J <girish.joshi@samsung.com>, InJun Yang <injun.yang@samsung.com>, Jaekyun Lee <jkyun.lee@samsung.com>
-Uploaders: Sunil Behera <sunil.behera@samsung.com>, Syam Sidhardhan <s.syam@samsung.com>
-Build-Depends: debhelper (>= 5), libglib2.0-dev, libdbus-glib-1-dev, libvconf-dev
-Standards-Version: 3.7.2
-Homepage: N/A
-
-Package: bluetooth-tools
-Architecture: any
-Section: utils
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Conflicts: bluetooth-dev-tool
-Breaks: bluetooth-dev-tool
-Replaces: bluetooth-dev-tool
-Description: Tools and scripts for Bluetooth stack
- Tools for Bluetooth
diff --git a/debian/rules b/debian/rules
deleted file mode 100755 (executable)
index 935af90..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/make -f
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-CFLAGS ?= -Wall -g
-LDFLAGS ?=
-PREFIX ?= /usr
-DATADIR ?= /opt
-PLUGIN_PREFIX ?= /usr
-
-
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-       CFLAGS += -O0
-else
-       CFLAGS += -O2
-endif
-
-LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs
-
-configure: configure-stamp
-configure-stamp:
-       dh_testdir
-       # Add here commands to configure the package.
-       mkdir -p $(CMAKE_BUILD_DIR) && \
-       cd $(CMAKE_BUILD_DIR) && \
-       CFLAGS="$(CFLAGS) -fpie" LDFLAGS="$(LDFLAGS) -pie" \
-       cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPLUGIN_INSTALL_PREFIX=$(PLUGIN_PREFIX)
-
-       touch configure-stamp
-
-build: build-stamp
-
-build-stamp: configure-stamp
-       dh_testdir
-
-       # Add here commands to compile the package.
-       cd $(CMAKE_BUILD_DIR) && $(MAKE)
-
-       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
-               cat $$f > $${f%.in}; \
-               sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
-               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
-               sed -i -e "s#@PLUGIN_PREFIX@#$(PLUGIN_PREFIX)#g" $${f%.in}; \
-       done
-
-       touch $@
-
-clean:
-       dh_testdir
-       dh_testroot
-       rm -f build-stamp configure-stamp
-
-       # Add here commands to clean up after the build process.
-       -rm -rf $(CMAKE_BUILD_DIR)
-
-       for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
-               rm -f $${f%.in}; \
-       done
-       dh_clean
-
-install: build
-       dh_testdir
-       dh_testroot
-       dh_clean -k
-       dh_installdirs
-
-       # Add here commands to install the package into debian/wavplayer.
-       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-       # Booting script
-       mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d
-       mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d
-       ln -s ../init.d/bluetooth-address $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S60bluetooth-address
-       ln -s ../init.d/bluetooth-address $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S60bluetooth-address
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
-       dh_testdir
-       dh_testroot
-       dh_installchangelogs
-       dh_installdocs
-       dh_installexamples
-       dh_install --sourcedir=debian/tmp
-#      dh_installmenu
-#      dh_installdebconf
-#      dh_installlogrotate
-#      dh_installemacsen
-#      dh_installpam
-#      dh_installmime
-#      dh_python
-#      dh_installinit
-#      dh_installcron
-#      dh_installinfo
-       dh_installman
-       dh_link
-#      dh_strip --dbg-package=bluetooth-tools-dbg
-       dh_compress
-       dh_fixperms
-#      dh_perl
-       dh_makeshlibs
-       dh_installdeb
-       dh_shlibdeps
-       dh_gencontrol
-       dh_md5sums
-       dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
index 20439de..f5c7e73 100644 (file)
@@ -28,11 +28,31 @@ On/Off bluetooth device
 %setup -q
 
 %build
-export CFLAGS="${CFLAGS} -fpie -fvisibility=hidden"
-export LDFLAGS="${LDFLAGS} -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
+export CFLAGS+=" -fpie -fvisibility=hidden"
+export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie"
+
+%if "%{profile}" == "mobile"
+export CFLAGS="$CFLAGS -DTIZEN_MOBILE"
+%elseif "%{profile}" == "wearable"
+export CFLAGS="$CFLAGS -DTIZEN_WEARABLE"
+%endif
+
+%cmake \
+%if "%{profile}" == "mobile"
+       -DTIZEN_MOBILE=YES \
+       -DTIZEN_WEARABLE=NO \
+%elseif "%{profile}" == "wearable"
+       -DTIZEN_MOBILE=NO \
+        -DTIZEN_WEARABLE=YES \
+%else
+        -DTIZEN_MOBILE=NO \
+        -DTIZEN_WEARABLE=NO \
+%endif
 
 %cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
 %__make %{?_smp_mflags}
+#cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+#make %{?jobs:-j%jobs}
 
 %install
 rm -rf %{buildroot}
@@ -50,6 +70,7 @@ ln -s ../bluetooth-address.service %{buildroot}%{_unitdir}/multi-user.target.wan
 mkdir -p %{buildroot}%{_prefix}/etc/bluetooth/
 install -m 0755 scripts/bt-dev-start.sh %{buildroot}%{_prefix}/etc/bluetooth/bt-dev-start.sh
 install -m 0755 scripts/bt-dev-end.sh %{buildroot}%{_prefix}/etc/bluetooth/bt-dev-end.sh
+install -D -m 0644 LICENSE.APLv2 %{buildroot}%{_datadir}/license/bluetooth-tools
 
 %files
 %manifest %{name}.manifest
@@ -64,7 +85,9 @@ install -m 0755 scripts/bt-dev-end.sh %{buildroot}%{_prefix}/etc/bluetooth/bt-de
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-edutm-dev-up.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-edutm-mode-on.sh
 %attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-edutm-off.sh
-
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-hci-logdump.sh
+%attr(0755,-,-) %{_prefix}/etc/bluetooth/bt-run-hcidump.sh
+%{_datadir}/license/bluetooth-tools
 %{_unitdir}/multi-user.target.wants/bluetooth-address.service
 %{_unitdir}/bluetooth-address.service
 
index a26f569..03b021d 100755 (executable)
@@ -1,13 +1,27 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
 # install script files
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-stack-up.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-stack-down.sh DESTINATION etc/bluetooth)
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-reset-env.sh DESTINATION etc/bluetooth)
+
+IF (TIZEN_MOBILE)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-stack-up.sh DESTINATION etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-stack-down.sh DESTINATION etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mobile/bt-reset-env.sh DESTINATION etc/bluetooth)
+ELSE ()
+IF (TIZEN_WEARABLE)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-stack-up.sh DESTINATION etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-stack-down.sh DESTINATION etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/wearable/bt-reset-env.sh DESTINATION etc/bluetooth)
+ELSE ()
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-stack-up.sh DESTINATION etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-stack-down.sh DESTINATION etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bt-reset-env.sh DESTINATION etc/bluetooth)
+# install booting script
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/etc/bluetooth-address DESTINATION /etc/rc.d/init.d)
+ENDIF (TIZEN_WEARABLE)
+ENDIF (TIZEN_MOBILE)
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-edutm-on.sh DESTINATION etc/bluetooth)
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-edutm-dev-up.sh DESTINATION etc/bluetooth)
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-edutm-mode-on.sh DESTINATION etc/bluetooth)
 INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-edutm-off.sh DESTINATION etc/bluetooth)
-
-# install booting script
-INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-address DESTINATION /etc/rc.d/init.d)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-hci-logdump.sh DESTINATION etc/bluetooth)
+INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-run-hcidump.sh DESTINATION etc/bluetooth)
old mode 100644 (file)
new mode 100755 (executable)
index 8c2f49b..a7b7c16
@@ -4,31 +4,31 @@
 # Script for turning on Bluetooth (EDUTM)
 #
 
-if /usr/sbin/hciconfig | grep hci; then
+if /usr/bin/hciconfig | /bin/grep hci; then
        /usr/etc/bluetooth/bt-stack-down.sh
-       sleep 1
+       /bin/sleep 1
 fi
 
 # Register BT Device
 /usr/etc/bluetooth/bt-dev-start.sh
 
-if !(/usr/sbin/hciconfig | grep hci); then
+if !(/usr/bin/hciconfig | /bin/grep hci); then
        echo "BT EDUTM failed. Registering BT device is failed."
        exit 1
 fi
 
 # Execute BlueZ BT stack
 echo "Run bluetoothd"
-/usr/sbin/bluetoothd
+/usr/lib/bluetooth/bluetoothd &
 /usr/bin/bt-service &
-sleep 0.1
+/bin/sleep 0.1
 
-/usr/sbin/hciconfig hci0 name TIZEN-Mobile
+/usr/bin/hciconfig hci0 name TIZEN-Mobile
 
-/usr/sbin/hciconfig hci0 piscan
+/usr/bin/hciconfig hci0 piscan
 
 if [ -e "/sys/devices/hci0/idle_timeout" ]
 then
        echo "Set idle time"
-       echo 0> /sys/devices/hci0/idle_timeout
+       echo 0 > /sys/devices/hci0/idle_timeout
 fi
index ae97221..8b12770 100755 (executable)
@@ -4,7 +4,7 @@
 # Script for turning on EDUTM mode
 #
 
-if /usr/sbin/hciconfig | grep hci; then
+if /usr/bin/hciconfig | /bin/grep hci; then
        echo EDUTM already done, exit
 else
        echo Start EDUTM
@@ -14,13 +14,13 @@ fi
 if [ -e /usr/etc/bluetooth/TIInit_* ]
 then
        echo "Reset device"
-       hcitool cmd 0x3 0xFD0C
+       /usr/bin/hcitool cmd 0x3 0xFD0C
 fi
 
 echo "Configure BT device"
-hcitool cmd 0x3 0x0005 0x02 0x00 0x02
+/usr/bin/hcitool cmd 0x3 0x0005 0x02 0x00 0x02
 
 echo "Send BT edutm command"
-hcitool cmd 0x06 0x0003
+/usr/bin/hcitool cmd 0x06 0x0003
 
 echo "BT edutm done"
index d70d551..b0ae19b 100755 (executable)
@@ -5,7 +5,7 @@
 #
 
 # Kill BlueZ bluetooth stack
-killall bluetoothd
+/usr/bin/killall bluetoothd
 
 # Remove BT device
 /usr/etc/bluetooth/bt-dev-end.sh
old mode 100644 (file)
new mode 100755 (executable)
index ff20d2c..799d4d0
@@ -4,42 +4,62 @@
 # Script for turning on Bluetooth EDUTM
 #
 
+HCIDUMP_ENABLE="true"  # Available values : true | false (default : false)
+HCIDUMP_DIR="/opt/usr/media/.bt_dump"
+HCIDUMP_FILENAME="bt_hcidump.log"
+HCIDUMP_PATH="${HCIDUMP_DIR}/${HCIDUMP_FILENAME}"
+LOGDUMP_DIR="/opt/etc/dump.d/module.d"
+LOGDUMP_PATH="${LOGDUMP_DIR}/bt-hci-logdump.sh"
+
 # Register BT Device
 /usr/etc/bluetooth/bt-dev-start.sh
 
-if !(/usr/sbin/hciconfig | grep hci); then
+if !(/usr/bin/hciconfig | /bin/grep hci); then
        echo "BT EDUTM failed. Registering BT device is failed."
        exit 1
 fi
 
+if [ -e /usr/sbin/hcidump -a ${HCIDUMP_ENABLE} = "true" ]
+then
+       # When *#9900# is typed, this is executed to archive logs. #
+       /bin/mkdir -p ${LOGDUMP_DIR}
+       /bin/cp -f /usr/etc/bluetooth/bt-hci-logdump.sh ${LOGDUMP_PATH}
+
+       /bin/mkdir -p ${HCIDUMP_DIR}/old_hcidump
+#      /bin/rm -f ${HCIDUMP_DIR}/old_hcidump/*
+       /bin/mv ${HCIDUMP_PATH}* ${HCIDUMP_DIR}/old_hcidump/
+       /usr/sbin/hcidump -w ${HCIDUMP_PATH}_`date +%s_%N` &    # You can get unique file name.
+#      /usr/sbin/hcidump -w ${HCIDUMP_PATH} &
+fi
+
+echo "Configure BT device"
+/usr/bin/hcitool cmd 0x3 0x0005 0x02 0x00 0x02
+
+echo "Send BT edutm command"
+/usr/bin/hcitool cmd 0x06 0x0003
+
 # Execute BlueZ BT stack
 echo "Run bluetoothd"
-/usr/sbin/bluetoothd
+/usr/lib/bluetooth/bluetoothd &
 /usr/bin/bt-service &
-sleep 0.1
+/bin/sleep 0.1
 
-/usr/sbin/hciconfig hci0 name TIZEN-Mobile
+/usr/bin/hciconfig hci0 name TIZEN-Mobile
 
-/usr/sbin/hciconfig hci0 piscan
+/usr/bin/hciconfig hci0 piscan
 
 if [ -e "/sys/devices/hci0/idle_timeout" ]
 then
        echo "Set idle time"
-       echo 0> /sys/devices/hci0/idle_timeout
+       echo 0 > /sys/devices/hci0/idle_timeout
 fi
 
 if [ -e /usr/etc/bluetooth/TIInit_* ]
 then
        echo "Reset device"
-       hcitool cmd 0x3 0xFD0C
+       /usr/bin/hcitool cmd 0x3 0xFD0C
 fi
 
-echo "Configure BT device"
-hcitool cmd 0x3 0x0005 0x02 0x00 0x02
-
-echo "Send BT edutm command"
-hcitool cmd 0x06 0x0003
-
 echo "BT edutm done"
 
 # result
diff --git a/scripts/bt-hci-logdump.sh b/scripts/bt-hci-logdump.sh
new file mode 100755 (executable)
index 0000000..0b703b5
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+#--------------------------------------
+#    bluetooth hci
+#--------------------------------------
+
+BLUETOOTH_DEBUG=${1}/bluetooth
+PREV_PWD=${PWD}
+BT_DUMP_DIR=/opt/usr/media/Others/.bt_dump
+
+if [ ! -e ${BT_DUMP_DIR} ]
+then
+       exit 0
+fi
+
+/bin/mkdir -p ${BLUETOOTH_DEBUG}
+
+cd ${BT_DUMP_DIR}
+/bin/tar -cvzf ${BLUETOOTH_DEBUG}/bt_dump.tar.gz *
+
+cd ${PREV_PWD}
diff --git a/scripts/bt-run-hcidump.sh b/scripts/bt-run-hcidump.sh
new file mode 100755 (executable)
index 0000000..276483c
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+HCIDUMP_BASEDIR="/opt/usr/media/Others"
+HCIDUMP_DIR="${HCIDUMP_BASEDIR}/.bt_dump"
+HCIDUMP_FILENAME="bt_hcidump.log"
+HCIDUMP_PATH="${HCIDUMP_DIR}/${HCIDUMP_FILENAME}"
+
+LOGDUMP_DIR="/opt/etc/dump.d/module.d"
+LOGDUMP_PATH="${LOGDUMP_DIR}/bt-hci-logdump.sh"
+
+debug_mode=`/bin/cat /sys/module/sec_debug/parameters/enable`
+debug_mode_user=`/bin/cat /sys/module/sec_debug/parameters/enable_user`
+
+if [ ${debug_mode} = '1' -o ${debug_mode_user} = '1' ]
+then
+       if [ -e /usr/sbin/hcidump ]
+       then
+               # When *#9900# is typed, this is executed to archive logs.
+               /bin/mkdir -p ${LOGDUMP_DIR}
+               /bin/cp -f /usr/etc/bluetooth/bt-hci-logdump.sh ${LOGDUMP_PATH}
+
+               # Create base directory as proper owner and smack rule
+               # if it doesn't exist
+               if [ ! -e ${HCIDUMP_BASEDIR} ]
+               then
+                       /bin/mkdir - p ${HCIDUMP_BASEDIR}
+                       /bin/chown 5000:5000 ${HCIDUMP_BASEDIR}
+                       /usr/bin/chsmack -t -a 'system::media' ${HCIDUMP_BASEDIR}
+               fi
+               /bin/mkdir -p ${HCIDUMP_DIR}/old_hcidump
+               /bin/rm -f ${HCIDUMP_DIR}/old_hcidump/*
+               /bin/mv ${HCIDUMP_PATH}* ${HCIDUMP_DIR}/old_hcidump/
+               /usr/sbin/hcidump -w ${HCIDUMP_PATH} &
+       fi
+elif [ -e ${HCIDUMP_DIR} ]
+then
+       /bin/rm -rf ${HCIDUMP_DIR}
+fi
diff --git a/scripts/mobile/bluetooth-address b/scripts/mobile/bluetooth-address
new file mode 100755 (executable)
index 0000000..3a3a4b0
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+#
+# Script for setting local Bluetooth Address during booting time
+#
+
+if [ -x /usr/etc/bluetooth/bt-set-addr.sh ]; then
+       /usr/etc/bluetooth/bt-set-addr.sh &
+fi
diff --git a/scripts/mobile/bt-reset-env.sh b/scripts/mobile/bt-reset-env.sh
new file mode 100755 (executable)
index 0000000..71d1efc
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# BT Stack and device stop
+/usr/etc/bluetooth/bt-stack-down.sh
+
+killall -9 hciattach
+
+# Remove BT files and setting
+rm -rf /opt/data/bluetooth/.bt_paired
+rm -rf /var/lib/bluetooth/*
+
+# Initialize BT vconf values
+vconftool set -tf int db/bluetooth/status "0" -g 6520
+vconftool set -tf int file/private/bt-service/flight_mode_deactivated "0" -g 6520 -i
+vconftool set -tf string memory/bluetooth/sco_headset_name "" -g 6520 -i
+vconftool set -tf int memory/bluetooth/device "0" -g 6520 -i
+vconftool set -tf int file/private/libug-setting-bluetooth-efl/visibility_time "0" -g 6520
+vconftool set -tf bool memory/private/bluetooth-share/quickpanel_clear_btn_status FALSE -g 6520 -i
+vconftool set -tf bool memory/private/bluetooth-share/opp_server_init FALSE -g 6520 -i
+
+# Remove BT shared memory
+list=`ipcs -m | awk '$1==0x0001000 {print $2}'`
+for i in $list
+do
+       ipcrm -m $i
+done
+ipcs -m | grep "0x00001000" | awk '{ print $2 }'
diff --git a/scripts/mobile/bt-stack-down.sh b/scripts/mobile/bt-stack-down.sh
new file mode 100755 (executable)
index 0000000..ca69555
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#
+# Script for stopping Bluetooth stack
+#
+
+# Remove BT device
+/usr/etc/bluetooth/bt-dev-end.sh
+
+# Kill BlueZ bluetooth stack
+killall obexd obex-client
+killall bt-syspopup
+killall bluetooth-pb-agent
+killall bluetooth-map-agent
+killall bluetooth-hfp-agent
+killall bluetoothd
+
+# result
+exit 0
diff --git a/scripts/mobile/bt-stack-up.sh b/scripts/mobile/bt-stack-up.sh
new file mode 100755 (executable)
index 0000000..0b4b302
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+#
+# Script for executing Bluetooth stack
+#
+
+# Register BT Device
+/usr/etc/bluetooth/bt-dev-start.sh
+
+if !(/usr/bin/hciconfig | grep hci); then
+       echo "Registering BT device is failed."
+       exit 1
+fi
+
+# We have to handle both systemd and sysvinit cases differently
+if [ -d /sys/fs/cgroup/systemd ]; then
+   # bt-service changes USER to 'app' via libprivilege-control, so it needs
+   # to know where the session bus is located under systemd
+   export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/app/dbus/user_bus_socket
+fi
+
+# Execute BlueZ BT stack
+echo "Run bluetoothd"
+/usr/lib/bluetooth/bluetoothd -d -C &
+/usr/bin/bluetooth-share &
+
+exit 0
diff --git a/scripts/wearable/bt-reset-env.sh b/scripts/wearable/bt-reset-env.sh
new file mode 100755 (executable)
index 0000000..71d1efc
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# BT Stack and device stop
+/usr/etc/bluetooth/bt-stack-down.sh
+
+killall -9 hciattach
+
+# Remove BT files and setting
+rm -rf /opt/data/bluetooth/.bt_paired
+rm -rf /var/lib/bluetooth/*
+
+# Initialize BT vconf values
+vconftool set -tf int db/bluetooth/status "0" -g 6520
+vconftool set -tf int file/private/bt-service/flight_mode_deactivated "0" -g 6520 -i
+vconftool set -tf string memory/bluetooth/sco_headset_name "" -g 6520 -i
+vconftool set -tf int memory/bluetooth/device "0" -g 6520 -i
+vconftool set -tf int file/private/libug-setting-bluetooth-efl/visibility_time "0" -g 6520
+vconftool set -tf bool memory/private/bluetooth-share/quickpanel_clear_btn_status FALSE -g 6520 -i
+vconftool set -tf bool memory/private/bluetooth-share/opp_server_init FALSE -g 6520 -i
+
+# Remove BT shared memory
+list=`ipcs -m | awk '$1==0x0001000 {print $2}'`
+for i in $list
+do
+       ipcrm -m $i
+done
+ipcs -m | grep "0x00001000" | awk '{ print $2 }'
diff --git a/scripts/wearable/bt-stack-down.sh b/scripts/wearable/bt-stack-down.sh
new file mode 100755 (executable)
index 0000000..0875c00
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#
+# Script for stopping Bluetooth stack
+#
+
+# Remove BT device
+/usr/etc/bluetooth/bt-dev-end.sh
+
+# Kill BlueZ bluetooth stack
+killall obexd obex-client
+killall bluetooth-pb-agent
+killall bluetooth-map-agent
+killall bluetooth-hfp-agent
+killall bluetooth-hf-agent
+killall bluetoothd
+
+# result
+exit 0
diff --git a/scripts/wearable/bt-stack-up.sh b/scripts/wearable/bt-stack-up.sh
new file mode 100755 (executable)
index 0000000..2c2074c
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+HCIDUMP_DIR="/opt/usr/media/.bluetooth"
+HCIDUMP_FILENAME="bt_hcidump.log"
+HCIDUMP_PATH="${HCIDUMP_DIR}/${HCIDUMP_FILENAME}"
+LOGDUMP_DIR="/opt/etc/dump.d/module.d"
+LOGDUMP_PATH="${LOGDUMP_DIR}/bt-hci-logdump.sh"
+
+/usr/bin/bluetooth-hf-agent &
+#
+# Script for executing Bluetooth stack
+#
+
+# Register BT Device
+/usr/etc/bluetooth/bt-dev-start.sh
+
+if !(/usr/bin/hciconfig | grep hci); then
+       echo "Registering BT device is failed."
+       exit 1
+fi
+
+debug_mode=`cat /sys/module/sec_debug/parameters/enable`
+debug_mode_user=`cat /sys/module/sec_debug/parameters/enable_user`
+
+if [ ${debug_mode} = '1' -o ${debug_mode_user} = '1' ]
+then
+       if [ -e /usr/sbin/hcidump ]
+       then
+               # When *#9900# is typed, this is executed to archive logs. #
+               /bin/mkdir -p ${LOGDUMP_DIR}
+               /bin/cp -f /usr/etc/bluetooth/bt-hci-logdump.sh ${LOGDUMP_PATH}
+
+               /bin/mkdir -p ${HCIDUMP_DIR}/old_hcidump
+               /bin/rm -f ${HCIDUMP_DIR}/old_hcidump/*
+               /bin/mv ${HCIDUMP_PATH}* ${HCIDUMP_DIR}/old_hcidump/
+               /usr/sbin/hcidump -w ${HCIDUMP_PATH} &
+       fi
+elif [ -e ${HCIDUMP_DIR} ]
+then
+       /bin/rm -rf ${HCIDUMP_DIR}
+fi
+
+# Execute BlueZ BT stack
+echo "Run bluetoothd"
+/usr/lib/bluetooth/bluetoothd -d -C &
+/usr/bin/dbus-send --print-reply --system --type=method_call \
+               --dest=org.freedesktop.systemd1 /org/freedesktop/systemd1 \
+               org.freedesktop.systemd1.Manager.StartUnit \
+               string:'wms.service' string:'fail'
+
+exit 0