diff options
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | debian/bt-firmware-43xx.install | 3 | ||||
-rw-r--r-- | debian/bt-firmware-43xx.install.in | 4 | ||||
-rw-r--r-- | debian/bt-firmware-43xx.postinst | 19 | ||||
-rw-r--r-- | debian/bt-firmware-43xx.postinst.in | 10 | ||||
-rwxr-xr-x | debian/changelog | 12 | ||||
-rw-r--r-- | debian/control | 12 | ||||
-rwxr-xr-x | debian/rules | 54 | ||||
-rw-r--r-- | firmware/BCM4330B1_002.001.003.0221.0265.hcd (renamed from scripts/broadcom/BCM4330B1_002.001.003.0221.0265.hcd) | bin | 32195 -> 32195 bytes | |||
-rwxr-xr-x | firmware/CMakeLists.txt | 2 | ||||
-rw-r--r-- | packaging/bt-firmware-43xx.spec | 33 | ||||
-rwxr-xr-x | scripts/CMakeLists.txt | 50 | ||||
-rwxr-xr-x | scripts/bluetooth-address | 9 | ||||
-rwxr-xr-x | scripts/bt-dev-end.sh (renamed from scripts/broadcom/bt-dev-end.sh.broadcom) | 0 | ||||
-rwxr-xr-x | scripts/bt-dev-start.sh (renamed from scripts/broadcom/bt-dev-start.sh.broadcom) | 3 | ||||
-rwxr-xr-x | scripts/bt-reset-env.sh | 29 | ||||
-rwxr-xr-x | scripts/bt-set-addr.sh (renamed from scripts/broadcom/bt-set-addr.sh.broadcom) | 0 | ||||
-rwxr-xr-x | scripts/bt-stack-down.sh | 18 | ||||
-rwxr-xr-x | scripts/bt-stack-up.sh | 31 | ||||
-rw-r--r-- | set-address/CMakeLists.txt | 10 | ||||
-rw-r--r-- | set-address/setbd.c | 136 | ||||
-rw-r--r-- | tools/CMakeLists.txt | 25 | ||||
-rw-r--r-- | tools/bcmtool_4330b1.c (renamed from scripts/broadcom/bcmtool_4330b1.c) | 0 |
24 files changed, 242 insertions, 231 deletions
diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 71e3ece..0000000 --- a/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -HyeongBae Park <jupio.park@samsung.com>
-Ankur Gandhi <a.gandhi@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt index defa1dd..8608e04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,15 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +INCLUDE(FindPkgConfig) +pkg_check_modules(package REQUIRED glib-2.0 dbus-glib-1 vconf) + +FOREACH(flag ${package_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") + ADD_SUBDIRECTORY(set-address) +ADD_SUBDIRECTORY(tools) +ADD_SUBDIRECTORY(firmware) ADD_SUBDIRECTORY(scripts) diff --git a/debian/bt-firmware-43xx.install b/debian/bt-firmware-43xx.install new file mode 100644 index 0000000..4ae9840 --- /dev/null +++ b/debian/bt-firmware-43xx.install @@ -0,0 +1,3 @@ +usr/bin/* +usr/etc/bluetooth/BCM4330B1_002.001.003.0221.0265.hcd +usr/etc/bluetooth/* diff --git a/debian/bt-firmware-43xx.install.in b/debian/bt-firmware-43xx.install.in deleted file mode 100644 index e228a1d..0000000 --- a/debian/bt-firmware-43xx.install.in +++ /dev/null @@ -1,4 +0,0 @@ -@PLUGIN_PREFIX@/bin/* -@PREFIX@/bin/setbd -@PREFIX@/etc/bluetooth/* -/etc/* diff --git a/debian/bt-firmware-43xx.postinst b/debian/bt-firmware-43xx.postinst deleted file mode 100644 index 39af43a..0000000 --- a/debian/bt-firmware-43xx.postinst +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -####################################################################### -# Rename the script files -mv ${SYSLAYER}/usr/etc/bluetooth/bt-dev-start.sh.broadcom ${SYSLAYER}/usr/etc/bluetooth/bt-dev-start.sh -mv ${SYSLAYER}/usr/etc/bluetooth/bt-dev-end.sh.broadcom ${SYSLAYER}/usr/etc/bluetooth/bt-dev-end.sh -mv /usr/etc/bluetooth/bt-set-addr.sh.broadcom /usr/etc/bluetooth/bt-set-addr.sh - -#BCM4330B1_002.001.003.0221.0265.hcd (U1 Commercial Firmware 2.3.5) -# Change File Permission -chmod 644 ${SYSLAYER}/usr/etc/bluetooth/BCM4330B1_002.001.003.0221.0265.hcd - - -# root case -if [ ${USER} = "root" ] -then -chown root:root ${SYSLAYER}/usr/etc/bluetooth/BCM4330B1_002.001.003.0221.0265.hcd - -fi diff --git a/debian/bt-firmware-43xx.postinst.in b/debian/bt-firmware-43xx.postinst.in new file mode 100644 index 0000000..cb03b3c --- /dev/null +++ b/debian/bt-firmware-43xx.postinst.in @@ -0,0 +1,10 @@ +#!/bin/sh + +# Change File Permission +chmod 644 @PREFIX@/etc/bluetooth/BCM4330B1_002.001.003.0221.0265.hcd + +# root case +if [ ${USER} = "root" ] +then + chown root:root @PREFIX@/etc/bluetooth/BCM4330B1_002.001.003.0221.0265.hcd +fi diff --git a/debian/changelog b/debian/changelog index 7f8f38e..b06cbd4 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +bt-firmware-43xx (0.1.2) unstable; urgency=low + + * Fix set bd bug as TAPI IMEI API deprecated + + -- Jaekyun Lee <jkyun.lee@samsung.com> Mon, 26 Mar 2012 15:13:31 +0900 + +bt-firmware-43xx (0.1.1) unstable; urgency=low + + * common script moved to bluetooth-tools + + -- Jaekyun Lee <jkyun.lee@samsung.com> Fri, 23 Mar 2012 11:29:47 +0900 + bt-firmware-43xx (0.1.0) unstable; urgency=low * Initail Release diff --git a/debian/control b/debian/control index 32b94e0..ec8cb24 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: bt-firmware-43xx 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> +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 @@ -10,12 +10,16 @@ Homepage: N/A Package: bt-firmware-43xx Architecture: any Section: utils -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Tools and scripts for Bluetooth stack +Depends: ${shlibs:Depends}, ${misc:Depends}, bluetooth-tools +Description: firmware and tools + firmware and tools Package: bt-firmware-43xx-dbg Section: debug Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, bt-firmware-43xx (= ${Source-Version}) -Description: Tools and scripts for Bluetooth stack (unstripped) +Description: Tools for bluetooth-firmware-bcm (unstripped) The package contains detached debugging symbols for the binary packages + produced by the bt-firmware-43xx soruce. + + diff --git a/debian/rules b/debian/rules index bc4025a..116771c 100755 --- a/debian/rules +++ b/debian/rules @@ -4,11 +4,13 @@ #export DH_VERBOSE=1 CFLAGS ?= -Wall -g -LDFLAGS ?= +LDFLAGS ?= PREFIX ?= /usr DATADIR ?= /opt PLUGIN_PREFIX ?= /usr +CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp + ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else @@ -21,18 +23,20 @@ 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) + cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX) -DPLUGIN_INSTALL_PREFIX=$(PLUGIN_PREFIX) touch configure-stamp build: build-stamp -build-stamp: configure-stamp +build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. - $(MAKE) + cd $(CMAKE_BUILD_DIR) && $(MAKE) for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ cat $$f > $${f%.in}; \ @@ -49,51 +53,25 @@ clean: rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. - -$(MAKE) clean - - - for f in `find $(CURDIR)/ -name "CMakeCache.txt"`; do \ - rm -f $${f}; \ - done - for f in `find $(CURDIR)/ -name "CMakeFiles"`; do \ - rm -rf $${f}; \ - done - for f in `find $(CURDIR)/ -name "cmake_install.cmake"`; do \ - rm -f $${f}; \ - done - for f in `find $(CURDIR)/ -name "Makefile"`; do \ - rm -f $${f}; \ - done - for f in `find $(CURDIR)/ -name "install_manifest.txt"`; do \ - rm -f $${f}; \ - done - + -rm -rf $(CMAKE_BUILD_DIR) for f in `find $(CURDIR)/debian/ -name "*.in"`; do \ rm -f $${f%.in}; \ done - rm -f scripts/BCM_FIRMWARE*.hcd - rm -f scripts/bt-dev-end.sh - rm -f scripts/bt-dev-start.sh - rm -f scripts/bt-set-addr.sh - - dh_clean + dh_clean install: build dh_testdir dh_testroot - dh_clean -k + dh_clean -k dh_installdirs # Add here commands to install the package into debian/wavplayer. - $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + + # Booting script - $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install - 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 @@ -103,12 +81,12 @@ binary-indep: build install binary-arch: build install dh_testdir dh_testroot - dh_installchangelogs + dh_installchangelogs dh_installdocs dh_installexamples dh_install --sourcedir=debian/tmp # dh_installmenu -# dh_installdebconf +# dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam diff --git a/scripts/broadcom/BCM4330B1_002.001.003.0221.0265.hcd b/firmware/BCM4330B1_002.001.003.0221.0265.hcd Binary files differindex a8c7f30..a8c7f30 100644 --- a/scripts/broadcom/BCM4330B1_002.001.003.0221.0265.hcd +++ b/firmware/BCM4330B1_002.001.003.0221.0265.hcd diff --git a/firmware/CMakeLists.txt b/firmware/CMakeLists.txt new file mode 100755 index 0000000..a795312 --- /dev/null +++ b/firmware/CMakeLists.txt @@ -0,0 +1,2 @@ +# install firmware +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/BCM4330B1_002.001.003.0221.0265.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) diff --git a/packaging/bt-firmware-43xx.spec b/packaging/bt-firmware-43xx.spec index e759818..67c8dbb 100644 --- a/packaging/bt-firmware-43xx.spec +++ b/packaging/bt-firmware-43xx.spec @@ -1,28 +1,26 @@ - Name: bt-firmware-43xx -Summary: Tools and scripts for Bluetooth stack -Version: 0.1.0 +Summary: firmware and tools for bluetooth +Version: 0.1.2 Release: 1 -Group: TO_BE/FILLED_IN -License: GPL -Source0: %{name}-%{version}.tar.gz +Group: TO_BE_FILLED +License: TO_BE_FILLED +Source0: bluetooth-firmware-bcm-%{version}.tar.gz BuildRequires: pkgconfig(dbus-glib-1) -BuildRequires: pkgconfig(glib-2.0) +BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(vconf) BuildRequires: cmake %description -Tools and scripts for Bluetooth stack + firmware and tools for bluetooth + %prep %setup -q %build -export CFLAGS+=" $CFLAGS -fpie" -export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie" -cmake . -DCMAKE_INSTALL_PREFIX=/usr -DPLUGIN_INSTALL_PREFIX=/usr - +cmake ./ -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPLUGIN_INSTALL_PREFIX=%{_prefix} +make %{?jobs:-j%jobs} %install rm -rf %{buildroot} @@ -30,7 +28,10 @@ rm -rf %{buildroot} %files -/etc/rc.d/init.d/* -/lib/firmware/* -/usr/bin/* -/usr/etc/bluetooth/* +%defattr(-,root,root,-) +%{_bindir}/bcmtool_4330b1 +%{_bindir}/setbd +%{_prefix}/etc/bluetooth/BCM4330B1_002.001.003.0221.0265.hcd +%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh +%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start.sh +%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index e12875e..863498d 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -1,48 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(bcmtool C) - -SET(SRCS_4330B1 broadcom/bcmtool_4330b1.c) - -SET(BCMTOOL_4330B1 ${PROJECT_NAME}_4330b1) - -SET(PREFIX ${CMAKE_INSTALL_PREFIX}) - -INCLUDE(FindPkgConfig) -pkg_check_modules(package REQUIRED glib-2.0 dbus-glib-1) - -FOREACH(flag ${package_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -FIND_PROGRAM(UNAME NAMES uname) -EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") -IF("${ARCH}" STREQUAL "arm") - ADD_DEFINITIONS("-DTARGET") - MESSAGE("add -DTARGET") -ENDIF("${ARCH}" STREQUAL "arm") - -ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") -ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") - -ADD_EXECUTABLE(${BCMTOOL_4330B1} ${SRCS_4330B1}) - -TARGET_LINK_LIBRARIES(${BCMTOOL_4330B1} ${package_LDFLAGS}) - # install firmware -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/broadcom/BCM4330B1_002.001.003.0221.0265.hcd DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) - -# install binary file -INSTALL(TARGETS ${BCMTOOL_4330B1} DESTINATION ${PLUGIN_INSTALL_PREFIX}/bin) - -# install script files -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/broadcom/bt-dev-start.sh.broadcom DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/broadcom/bt-dev-end.sh.broadcom DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/broadcom/bt-set-addr.sh.broadcom DESTINATION etc/bluetooth) -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) - -# install booting script -INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-address DESTINATION /etc/rc.d/init.d) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-end.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-dev-start.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) +INSTALL(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/bt-set-addr.sh DESTINATION ${PLUGIN_INSTALL_PREFIX}/etc/bluetooth) diff --git a/scripts/bluetooth-address b/scripts/bluetooth-address deleted file mode 100755 index 3a3a4b0..0000000 --- a/scripts/bluetooth-address +++ /dev/null @@ -1,9 +0,0 @@ -#!/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/broadcom/bt-dev-end.sh.broadcom b/scripts/bt-dev-end.sh index ef4731e..ef4731e 100755 --- a/scripts/broadcom/bt-dev-end.sh.broadcom +++ b/scripts/bt-dev-end.sh diff --git a/scripts/broadcom/bt-dev-start.sh.broadcom b/scripts/bt-dev-start.sh index df893da..842cc14 100755 --- a/scripts/broadcom/bt-dev-start.sh.broadcom +++ b/scripts/bt-dev-start.sh @@ -9,7 +9,7 @@ BT_CHIP_TYPE=bcm2035 BCM_TOOL=$PLUGIN_DIR/usr/bin/bcmtool_4330b1 BCM_FIRMWARE=BCM4330B1_002.001.003.0221.0265.hcd -BT_PLATFORM_DEFAULT_HCI_NAME="SLP2.0_BT" +BT_PLATFORM_DEFAULT_HCI_NAME="TIZEN_BT" UART_SPEED=921600 REVISION_NUM=`grep Revision /proc/cpuinfo | awk "{print \\$3}"` @@ -54,4 +54,3 @@ else rfkill block bluetooth fi fi - diff --git a/scripts/bt-reset-env.sh b/scripts/bt-reset-env.sh deleted file mode 100755 index 2f492a3..0000000 --- a/scripts/bt-reset-env.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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/* - -KDB=`mount | grep libsqlfs_mount | awk '{print $3}'` -if [ -d $KDB/bluetooth ] -then - rm -rf $KDB/bluetooth/* -fi -if [ -d $KDB/user/bluetooth ] -then - rm -rf $KDB/user/bluetooth/* -fi - -# 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/broadcom/bt-set-addr.sh.broadcom b/scripts/bt-set-addr.sh index 57b2d02..57b2d02 100755 --- a/scripts/broadcom/bt-set-addr.sh.broadcom +++ b/scripts/bt-set-addr.sh diff --git a/scripts/bt-stack-down.sh b/scripts/bt-stack-down.sh deleted file mode 100755 index 872aedf..0000000 --- a/scripts/bt-stack-down.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# -# Script for stopping Bluetooth stack -# - -# Remove BT device -/usr/etc/bluetooth/bt-dev-end.sh - -# Kill BlueZ bluetooth stack -killall bluetoothd -killall obexd obex-client -killall bt-syspopup -killall bluetooth-share - -# result -exit 0 - diff --git a/scripts/bt-stack-up.sh b/scripts/bt-stack-up.sh deleted file mode 100755 index c929e5b..0000000 --- a/scripts/bt-stack-up.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# -# Script for executing Bluetooth stack -# - -# Register BT Device -/usr/etc/bluetooth/bt-dev-start.sh - -if !(/usr/sbin/hciconfig | grep hci); then - echo "Registering BT device is failed." - exit 1 -fi - -# Execute BlueZ BT stack -echo "Run bluetoothd" -/usr/sbin/bluetoothd -d -/usr/lib/obex/obexd -d --noplugin=syncevolution,pcsuite --symlinks -r /opt/share/bt-ftp -/usr/bin/bluetooth-share & -sleep 2 - -exit 0 - -# Check result -#if (dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.DefaultAdapter | grep hci); then -# exit 0 -#else -# echo "Running BT stack is failed." -# exit 1 -#fi - diff --git a/set-address/CMakeLists.txt b/set-address/CMakeLists.txt index da25e14..2ff386b 100644 --- a/set-address/CMakeLists.txt +++ b/set-address/CMakeLists.txt @@ -5,15 +5,6 @@ SET(SRCS setbd.c) SET(PREFIX ${CMAKE_INSTALL_PREFIX}) -INCLUDE(FindPkgConfig) -pkg_check_modules(package REQUIRED glib-2.0 dbus-glib-1 vconf) - -FOREACH(flag ${package_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - FIND_PROGRAM(UNAME NAMES uname) EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") IF("${ARCH}" STREQUAL "arm") @@ -23,6 +14,7 @@ ENDIF("${ARCH}" STREQUAL "arm") ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") +ADD_DEFINITIONS("-D__BROADCOM_PATCH__") ADD_DEFINITIONS("-DDEBUG_EN") ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS}) diff --git a/set-address/setbd.c b/set-address/setbd.c index 7c4919c..092da16 100644 --- a/set-address/setbd.c +++ b/set-address/setbd.c @@ -1,5 +1,5 @@ /* - * bluetooth-dev-tool + * setbd.c * * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved * @@ -31,6 +31,16 @@ #include <vconf.h> #include <glib.h> +#ifdef __TI_PATCH__ +#define BT_CHIP_TI +#else +#ifdef __BROADCOM_PATCH__ +#define BT_CHIP_BROADCOM +#else +#define BT_CHIP_CSR +#endif +#endif + #ifdef DEBUG_EN #define APP_DBG(format, args...) printf("%s(), line[%d]: " format, __FUNCTION__, __LINE__, ##args) #define APP_DEBUG(format, args...) printf(format, ##args) @@ -56,6 +66,7 @@ static GMainLoop * loop; const char *DEFAULT_IMEI="004999010640000"; static gboolean is_default_imei=FALSE; +#if defined(BT_CHIP_CSR) || defined(BT_CHIP_BROADCOM) int addremoveBD(char* path, char* pskey){ FILE *fd, *new; int ret; @@ -96,7 +107,7 @@ int addremoveBD(char* path, char* pskey){ ret = fputs(cmp,new); } - + return 0; } void makeRandomBD(unsigned char* buf){ @@ -123,7 +134,68 @@ void makeRandomBD(unsigned char* buf){ } APP_DEBUG("\r\n"); } +#endif + +#ifdef BT_CHIP_TI +int readBDaddrTI(void){ + int i, cnt_lap=0, cnt_uap=0, cnt_nap=0; + int dev_id, fd, filedesc; + BD_ADDR_T bdaddr; + char address[18]; + char nap[4], uap[2], lap[6]; + int ret = 0; + dev_id=hci_get_route(NULL); + if(dev_id<0){ + APP_DBG("Bluetooth device not available!!!\r\n"); + return -1; + } + fd=hci_open_dev(dev_id); + if(fd<0){ + APP_DBG("HCI open fail!!!\r\n"); + return -2; + } + + if(0>hci_read_bd_addr(fd, &bdaddr, 1000)){ + APP_DBG("Read BD ADDR failed!!!\r\n"); + return -3; + } + hci_close_dev(fd); + + ba2str(&bdaddr, address); + for(i=0;i<17;i++){ + if(':' == address[i]) + continue; + + if(5>i) + nap[cnt_nap++] = address[i]; + else if(8>i) + uap[cnt_uap++] = address[i]; + else + lap[cnt_lap++] = address[i]; + } + + APP_DBG("BT address [%s], nap[%c%c%c%c], uap[%c%c], lap[%c%c%c%c%c%c]\r\n",\ + address, nap[0], nap[1], nap[2], nap[3]\ + , uap[0],uap[1]\ + ,lap[0], lap[1],lap[2],lap[3],lap[4],lap[5]); + + + filedesc=open(BD_ADDR_FILE, O_RDWR | O_CREAT | O_TRUNC | O_SYNC, 0644); + if(0>filedesc){ + APP_DBG("File creation fail!!!\r\n"); + return -4; + } + ret = write(filedesc, nap, 4); + ret = write(filedesc, "\n", 1); + ret = write(filedesc, uap, 2); + ret = write(filedesc, "\n", 1); + ret = write(filedesc, lap, 6); + ret = write(filedesc, "\n", 1); + close(filedesc); + return 0; +} +#endif int make_bt_address_from_tapi_imei(unsigned char * bt_address) { char * temp=NULL; @@ -139,11 +211,18 @@ int make_bt_address_from_tapi_imei(unsigned char * bt_address) temp=vconf_get_str(VCONFKEY_TELEPHONY_IMEI); APP_DEBUG("TAPI_IMEI: %s\n",temp); +#ifdef IMEI_BASED_RAND_FEATURE if(strcmp(temp,DEFAULT_IMEI)==0){ APP_DEBUG("TAPI_IMEI is defulat IMEI\n"); is_default_imei=TRUE; return -ENODATA; } +#else + APP_DEBUG("Temporarily we skip reading TAPI_IMEI\n"); + APP_DEBUG(" due to TAPI IMEI API is deprecated\n"); + is_default_imei=TRUE; + return -ENODATA; +#endif if(strcmp(temp,"")==0) return -ENODATA; @@ -179,6 +258,8 @@ int make_bt_address_from_tapi_imei(unsigned char * bt_address) int make_bt_address(gboolean overwrite_bt_address) { +#if defined(BT_CHIP_CSR) || defined(BT_CHIP_BROADCOM) + int fd; int i; unsigned char txt[BD_ADDR_LEN]; @@ -217,13 +298,60 @@ int make_bt_address(gboolean overwrite_bt_address) APP_DEBUG("%s is already existed\n",BD_ADDR_FILE); success_make_bt_address_from_imei=0; } - + ret = read(fd, nap, 5); ret = read(fd, uap, 3); ret = read(fd, lap, 7); close(fd); +#if defined(BT_CHIP_CSR) + APP_DEBUG("nap["); + for(i=0;i<4;i++) + APP_DEBUG("%c",nap[i]); + APP_DEBUG("]\r\n"); + + APP_DEBUG("uap["); + for(i=0;i<2;i++) + APP_DEBUG("%c",uap[i]); + APP_DEBUG("]\r\n"); + + APP_DEBUG("lap["); + for(i=0;i<6;i++) + APP_DEBUG("%c",lap[i]); + APP_DEBUG("]\r\n"); + + sprintf(pskey, "&0001 = 0012 %c%c%c%c %c%c%c%c %c%c%c%c\r\n",\ + lap[0], lap[1], lap[2], lap[3], lap[4], lap[5],\ + uap[0], uap[1],\ + nap[0], nap[1], nap[2], nap[3]); + + APP_DEBUG("BD PSKEY ["); + for(i=0;i<PSKEY_LEN;i++) + APP_DEBUG("%c", pskey[i]); + APP_DEBUG("]\r\n"); + + ret = addremoveBD(PSR_FILE, pskey); +#endif + return ret; +#elif defined(BT_CHIP_TI) + int fd; + int ret; + + fd=open(BD_ADDR_FILE, O_RDONLY, 0644); + if(0>fd){ + APP_DBG("File not exists\r\n"); + ret=readBDaddrTI(); + }else{ + APP_DBG("File exists\r\n"); + close(fd); + ret=0; + } + return ret; +#else + printf("error BT CHIP not defined!!!\n"); + return 0; +#endif } void vconf_cb(keynode_t *key, void * data) @@ -272,12 +400,14 @@ int main() if(success_make_bt_address_from_imei==0 || is_default_imei==TRUE) exit(0); +#ifdef IMEI_BASED_RAND_FEATURE vconf_notify_key_changed(VCONFKEY_TELEPHONY_IMEI,vconf_cb,NULL); g_timeout_add_seconds(10,exit_cb,NULL); g_main_loop_run(loop); vconf_ignore_key_changed(VCONFKEY_TELEPHONY_IMEI,vconf_cb); +#endif return 0; } diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 0000000..85e215b --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,25 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(bcmtool C) + +SET(SRCS_4330B1 bcmtool_4330b1.c) + +SET(BCMTOOL_4330B1 ${PROJECT_NAME}_4330b1) + +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) + +FIND_PROGRAM(UNAME NAMES uname) +EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH") +IF("${ARCH}" STREQUAL "arm") + ADD_DEFINITIONS("-DTARGET") + MESSAGE("add -DTARGET") +ENDIF("${ARCH}" STREQUAL "arm") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DFACTORYFS=\"$ENV{FACTORYFS}\"") + +ADD_EXECUTABLE(${BCMTOOL_4330B1} ${SRCS_4330B1}) + +TARGET_LINK_LIBRARIES(${BCMTOOL_4330B1} ${package_LDFLAGS}) + +# install binary file +INSTALL(TARGETS ${BCMTOOL_4330B1} DESTINATION ${PLUGIN_INSTALL_PREFIX}/bin) diff --git a/scripts/broadcom/bcmtool_4330b1.c b/tools/bcmtool_4330b1.c index 6350a06..6350a06 100644 --- a/scripts/broadcom/bcmtool_4330b1.c +++ b/tools/bcmtool_4330b1.c |