From d92941b1dc54171b7a1910529273ae8f6404fe6e Mon Sep 17 00:00:00 2001 From: seungku kim Date: Wed, 11 Feb 2015 20:00:36 +0900 Subject: [PATCH] Code sync: merged tizen 2.4 base source code branch: tizen_2.4 ID: I51bceaa3d811ae4c6e8450ebf237f28678597387 Applied all previous patches in Tizen 3.0 Change-Id: I0f046e94b777805850f939c5ddd5ef2caa052b70 Signed-off-by: seungku kim --- debian/bluetooth-tools.install.in | 2 - debian/changelog | 95 ----------------------------- debian/compat | 1 - debian/control | 18 ------ debian/rules | 115 ------------------------------------ packaging/bluetooth-tools.spec | 29 ++++++++- scripts/CMakeLists.txt | 26 ++++++-- scripts/bt-edutm-dev-up.sh | 16 ++--- scripts/bt-edutm-mode-on.sh | 8 +-- scripts/bt-edutm-off.sh | 2 +- scripts/bt-edutm-on.sh | 46 +++++++++++---- scripts/bt-hci-logdump.sh | 21 +++++++ scripts/bt-run-hcidump.sh | 38 ++++++++++++ scripts/{ => etc}/bluetooth-address | 0 scripts/{ => etc}/bt-reset-env.sh | 0 scripts/{ => etc}/bt-stack-down.sh | 0 scripts/{ => etc}/bt-stack-up.sh | 0 scripts/mobile/bluetooth-address | 9 +++ scripts/mobile/bt-reset-env.sh | 27 +++++++++ scripts/mobile/bt-stack-down.sh | 19 ++++++ scripts/mobile/bt-stack-up.sh | 27 +++++++++ scripts/wearable/bt-reset-env.sh | 27 +++++++++ scripts/wearable/bt-stack-down.sh | 19 ++++++ scripts/wearable/bt-stack-up.sh | 51 ++++++++++++++++ 24 files changed, 330 insertions(+), 266 deletions(-) delete mode 100644 debian/bluetooth-tools.install.in delete mode 100644 debian/changelog delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100755 debian/rules mode change 100644 => 100755 scripts/bt-edutm-dev-up.sh mode change 100644 => 100755 scripts/bt-edutm-on.sh create mode 100755 scripts/bt-hci-logdump.sh create mode 100755 scripts/bt-run-hcidump.sh rename scripts/{ => etc}/bluetooth-address (100%) rename scripts/{ => etc}/bt-reset-env.sh (100%) rename scripts/{ => etc}/bt-stack-down.sh (100%) rename scripts/{ => etc}/bt-stack-up.sh (100%) create mode 100755 scripts/mobile/bluetooth-address create mode 100755 scripts/mobile/bt-reset-env.sh create mode 100755 scripts/mobile/bt-stack-down.sh create mode 100755 scripts/mobile/bt-stack-up.sh create mode 100755 scripts/wearable/bt-reset-env.sh create mode 100755 scripts/wearable/bt-stack-down.sh create mode 100755 scripts/wearable/bt-stack-up.sh diff --git a/debian/bluetooth-tools.install.in b/debian/bluetooth-tools.install.in deleted file mode 100644 index b498cd0..0000000 --- a/debian/bluetooth-tools.install.in +++ /dev/null @@ -1,2 +0,0 @@ -@PREFIX@/etc/bluetooth/* -/etc/rc.d/* diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 4a89341..0000000 --- a/debian/changelog +++ /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 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 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 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 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 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 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 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 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 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 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 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 Mon, 05 Mar 2012 13:48:49 +0900 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 7ed6ff8..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/debian/control b/debian/control deleted file mode 100644 index 3705828..0000000 --- a/debian/control +++ /dev/null @@ -1,18 +0,0 @@ -Source: bluetooth-tools -Section: devel -Priority: optional -Maintainer: DoHyun Pyun , ChanYeol Park , Girish A J , InJun Yang , Jaekyun Lee -Uploaders: Sunil Behera , Syam Sidhardhan -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 index 935af90..0000000 --- a/debian/rules +++ /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 diff --git a/packaging/bluetooth-tools.spec b/packaging/bluetooth-tools.spec index 20439de..f5c7e73 100644 --- a/packaging/bluetooth-tools.spec +++ b/packaging/bluetooth-tools.spec @@ -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 diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index a26f569..03b021d 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -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) diff --git a/scripts/bt-edutm-dev-up.sh b/scripts/bt-edutm-dev-up.sh old mode 100644 new mode 100755 index 8c2f49b..a7b7c16 --- a/scripts/bt-edutm-dev-up.sh +++ b/scripts/bt-edutm-dev-up.sh @@ -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 diff --git a/scripts/bt-edutm-mode-on.sh b/scripts/bt-edutm-mode-on.sh index ae97221..8b12770 100755 --- a/scripts/bt-edutm-mode-on.sh +++ b/scripts/bt-edutm-mode-on.sh @@ -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" diff --git a/scripts/bt-edutm-off.sh b/scripts/bt-edutm-off.sh index d70d551..b0ae19b 100755 --- a/scripts/bt-edutm-off.sh +++ b/scripts/bt-edutm-off.sh @@ -5,7 +5,7 @@ # # Kill BlueZ bluetooth stack -killall bluetoothd +/usr/bin/killall bluetoothd # Remove BT device /usr/etc/bluetooth/bt-dev-end.sh diff --git a/scripts/bt-edutm-on.sh b/scripts/bt-edutm-on.sh old mode 100644 new mode 100755 index ff20d2c..799d4d0 --- a/scripts/bt-edutm-on.sh +++ b/scripts/bt-edutm-on.sh @@ -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 index 0000000..0b703b5 --- /dev/null +++ b/scripts/bt-hci-logdump.sh @@ -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 index 0000000..276483c --- /dev/null +++ b/scripts/bt-run-hcidump.sh @@ -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/bluetooth-address b/scripts/etc/bluetooth-address similarity index 100% rename from scripts/bluetooth-address rename to scripts/etc/bluetooth-address diff --git a/scripts/bt-reset-env.sh b/scripts/etc/bt-reset-env.sh similarity index 100% rename from scripts/bt-reset-env.sh rename to scripts/etc/bt-reset-env.sh diff --git a/scripts/bt-stack-down.sh b/scripts/etc/bt-stack-down.sh similarity index 100% rename from scripts/bt-stack-down.sh rename to scripts/etc/bt-stack-down.sh diff --git a/scripts/bt-stack-up.sh b/scripts/etc/bt-stack-up.sh similarity index 100% rename from scripts/bt-stack-up.sh rename to scripts/etc/bt-stack-up.sh diff --git a/scripts/mobile/bluetooth-address b/scripts/mobile/bluetooth-address new file mode 100755 index 0000000..3a3a4b0 --- /dev/null +++ b/scripts/mobile/bluetooth-address @@ -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 index 0000000..71d1efc --- /dev/null +++ b/scripts/mobile/bt-reset-env.sh @@ -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 index 0000000..ca69555 --- /dev/null +++ b/scripts/mobile/bt-stack-down.sh @@ -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 index 0000000..0b4b302 --- /dev/null +++ b/scripts/mobile/bt-stack-up.sh @@ -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 index 0000000..71d1efc --- /dev/null +++ b/scripts/wearable/bt-reset-env.sh @@ -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 index 0000000..0875c00 --- /dev/null +++ b/scripts/wearable/bt-stack-down.sh @@ -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 index 0000000..2c2074c --- /dev/null +++ b/scripts/wearable/bt-stack-up.sh @@ -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 -- 2.7.4