diff options
author | DoHyun Pyun <dh79.pyun@samsung.com> | 2013-03-22 08:48:29 +0900 |
---|---|---|
committer | DoHyun Pyun <dh79.pyun@samsung.com> | 2013-03-22 08:48:29 +0900 |
commit | ee672ece1a5fbe6a70ab31eb1bcdfe1ede22a770 (patch) | |
tree | b9c2f8aa10ebd7dc342bbcb320837fc04b58f603 | |
parent | 4ac3bb83dbc47c947cf7890d9d2323c6f6186ad5 (diff) | |
download | bluetooth-firmware-bcm-ee672ece1a5fbe6a70ab31eb1bcdfe1ede22a770.tar.gz bluetooth-firmware-bcm-ee672ece1a5fbe6a70ab31eb1bcdfe1ede22a770.tar.bz2 bluetooth-firmware-bcm-ee672ece1a5fbe6a70ab31eb1bcdfe1ede22a770.zip |
Merge branch 'master' into tizen_2.1
Change-Id: I68ecb9f9f58954c847085c996e53cbe094fcf8db
-rw-r--r-- | AUTHORS | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | LICENSE.APLv2 | 203 | ||||
-rw-r--r-- | LICENSE.Broadcom | 66 | ||||
-rw-r--r-- | NOTICE | 10 | ||||
-rw-r--r-- | NOTICE.APLv2.0 | 3 | ||||
-rw-r--r-- | packaging/bluetooth-firmware-bcm-e4412.spec | 4 | ||||
-rw-r--r-- | packaging/bluetooth-firmware-bcm.spec | 49 | ||||
-rwxr-xr-x | scripts/bt-dev-end.sh | 4 | ||||
-rwxr-xr-x | scripts/bt-dev-start-c210.sh | 4 | ||||
-rwxr-xr-x | scripts/bt-dev-start-e4412.sh | 2 | ||||
-rwxr-xr-x | scripts/bt-set-addr.sh | 2 | ||||
-rw-r--r-- | set-address/setbd.c | 300 | ||||
-rw-r--r-- | tools/bcmtool_4330b1.c | 30 |
14 files changed, 492 insertions, 189 deletions
@@ -0,0 +1,2 @@ +Jinmin Jung <jinmin@samsung.com> +DoHyun Pyun <dh79.pyun@samsung.com> diff --git a/CMakeLists.txt b/CMakeLists.txt index c0285fa..cabe6eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) INCLUDE(FindPkgConfig) -pkg_check_modules(package REQUIRED glib-2.0 vconf) +pkg_check_modules(package REQUIRED glib-2.0 tapi) FOREACH(flag ${package_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") diff --git a/LICENSE.APLv2 b/LICENSE.APLv2 new file mode 100644 index 0000000..6b0b127 --- /dev/null +++ b/LICENSE.APLv2 @@ -0,0 +1,203 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/LICENSE.Broadcom b/LICENSE.Broadcom new file mode 100644 index 0000000..b39ee62 --- /dev/null +++ b/LICENSE.Broadcom @@ -0,0 +1,66 @@ +SOFTWARE LICENSE AGREEMENT
+
+The accompanying software in binary code form ("Software"), is licensed to you,
+or, if you are accepting on behalf of an entity, the entity and its affiliates
+exercising rights hereunder ("Licensee") subject to the terms of this software
+license agreement ("Agreement"), unless Licensee and Broadcom Corporation
+("Broadcom") execute a separate written software license agreement governing
+use of the Software. ANY USE, REPRODUCTION, OR DISTRIBUTION OF THE SOFTWARE
+CONSTITUTES LICENSEE'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. License. Subject to the terms and conditions of this Agreement,
+Broadcom hereby grants to Licensee a limited, non-exclusive, non-transferable,
+royalty-free license: (i) to use and integrate the Software with any other
+software; and (ii) to reproduce and distribute the Software complete,
+unmodified, and as provided by Broadcom, solely for use with Broadcom
+proprietary integrated circuit product(s) sold by Broadcom with which the
+Software was designed to be used, or their successors.
+
+2. Restrictions. Licensee shall distribute Software with a copy of this
+Agreement. Licensee shall not remove, efface or obscure any copyright or
+trademark notices from the Software. Reproductions of the Broadcom copyright
+notice shall be included with each copy of the Software, except where such
+Software is embedded in a manner not readily accessible to the end user.
+Licensee shall not: (i) use, license, sell or otherwise distribute the Software
+except as provided in this Agreement; (ii) attempt to modify in any way,
+reverse engineer, decompile or disassemble any portion of the Software; or
+(iii) use the Software or other material in violation of any applicable law or
+regulation, including but not limited to any regulatory agency. This Agreement
+shall automatically terminate upon Licensee’s failure to comply with any of the
+terms of this Agreement. In such event, Licensee will destroy all copies of the
+Software and its component parts.
+
+3. Ownership. The Software is licensed and not sold. Title to and
+ownership of the Software, including all intellectual property rights thereto,
+and any portion thereof remain with Broadcom or its licensors. Licensee hereby
+covenants that it will not assert any claim that the Software created by or for
+Broadcom infringe any intellectual property right owned or controlled by
+Licensee.
+
+4. Disclaimer. THE SOFTWARE IS OFFERED "AS IS," AND BROADCOM PROVIDES AND
+GRANTS AND LICENSEE RECEIVES NO SUPPORT AND NO WARRANTIES OF ANY KIND, EXPRESS
+OR IMPLIED, BY STATUTE, COMMUNICATION OR CONDUCT WITH LICENSEE, OR OTHERWISE.
+BROADCOM SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A SPECIFIC PURPOSE, OR NONINFRINGEMENT CONCERNING THE SOFTWARE OR
+ANY UPGRADES TO OR DOCUMENTATION FOR THE SOFTWARE. WITHOUT LIMITATION OF THE
+ABOVE, BROADCOM GRANTS NO WARRANTY THAT THE SOFTWARE IS ERROR-FREE OR WILL
+OPERATE WITHOUT INTERRUPTION, AND GRANTS NO WARRANTY REGARDING ITS USE OR THE
+RESULTS THEREFROM INCLUDING, WITHOUT LIMITATION, ITS CORRECTNESS, ACCURACY, OR
+RELIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM
+OR ANY OF ITS LICENSORS HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES, HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER FOR BREACH OF CONTRACT, TORT (INCLUDING NEGLIGENCE) OR
+OTHERWISE, ARISING OUT OF THIS AGREEMENT OR USE, REPRODUCTION, OR DISTRIBUTION
+OF THE SOFTWARE, INCLUDING BUT NOT LIMITED TO LOSS OF DATA AND LOSS OF PROFITS,
+EVEN IF SUCH PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE
+LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY
+LIMITED REMEDY.
+
+5. Export Laws. LICENSEE UNDERSTANDS AND AGREES THAT THE SOFTWARE IS
+SUBJECT TO UNITED STATES AND OTHER APPLICABLE EXPORT-RELATED LAWS AND
+REGULATIONS AND THAT LICENSEE MAY NOT EXPORT, RE-EXPORT OR TRANSFER THE
+SOFTWARE OR ANY DIRECT PRODUCT OF THE SOFTWARE EXCEPT AS PERMITTED UNDER THOSE
+LAWS. WITHOUT LIMITING THE FOREGOING, EXPORT, RE-EXPORT, OR TRANSFER OF THE
+SOFTWARE TO CUBA, IRAN, NORTH KOREA, SUDAN, AND SYRIA IS PROHIBITED.
+
+
@@ -0,0 +1,10 @@ +Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE.APLv2 file for Apache License terms and conditions. + +The following files are copyrighted by Broadcom and licensed under +a separate license. Please, see the LICENSE.Broadcom file for +license terms and conditions. + +Copyright (c) 2012 Broadcom Co., Ltd. All rights reserved. +- firmware/*.hcd diff --git a/NOTICE.APLv2.0 b/NOTICE.APLv2.0 new file mode 100644 index 0000000..ccdad52 --- /dev/null +++ b/NOTICE.APLv2.0 @@ -0,0 +1,3 @@ +Copyright (c) Samsung Electronics Co., Ltd. All rights reserved. +Except as noted, this software is licensed under Apache License, Version 2. +Please, see the LICENSE file for Apache License terms and conditions. diff --git a/packaging/bluetooth-firmware-bcm-e4412.spec b/packaging/bluetooth-firmware-bcm-e4412.spec index 345d4cf..beb1fbd 100644 --- a/packaging/bluetooth-firmware-bcm-e4412.spec +++ b/packaging/bluetooth-firmware-bcm-e4412.spec @@ -2,8 +2,8 @@ Name: bluetooth-firmware-bcm-e4412 Summary: firmware and tools for bluetooth Version: 0.2.28 Release: 1 -Group: TO_BE_FILLED -License: TO_BE_FILLED +Group: Hardware Support/Handset +License: Apache License, Version 2.0 Source0: bluetooth-firmware-bcm-%{version}.tar.gz BuildRequires: pkgconfig(vconf) diff --git a/packaging/bluetooth-firmware-bcm.spec b/packaging/bluetooth-firmware-bcm.spec index 792051b..bfa91fa 100644 --- a/packaging/bluetooth-firmware-bcm.spec +++ b/packaging/bluetooth-firmware-bcm.spec @@ -6,19 +6,35 @@ Group: Hardware Support/Handset License: Apache # NOTE: Source name does not match package name. This should be # resolved in the future, by I don't have that power. - Ryan Ware -Source0: %{name}-%{version}.tar.gz +Source0: bluetooth-firmware-bcm-%{version}.tar.gz -BuildRequires: pkgconfig(vconf) BuildRequires: cmake +BuildRequires: pkgconfig(tapi) %description - firmware and tools for bluetooth +firmware and tools for bluetooth +%package c210 +Summary: c210 firmware and tools for bluetooth +Group: TO_BE/FILLED + +%description c210 +c210 firmware and tools for bluetooth + +%package e4412 +Summary: e4412 firmware and tools for bluetooth +Group: TO_BE/FILLED + +%description e4412 +e4412 firmware and tools for bluetooth %prep -%setup -q +%setup -q -n bluetooth-firmware-bcm-%{version} %build +export CFLAGS+=" -fpie -fvisibility=hidden" +export LDFLAGS+=" -Wl,--rpath=/usr/lib -Wl,--as-needed -Wl,--unresolved-symbols=ignore-in-shared-libs -pie" + cmake ./ -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPLUGIN_INSTALL_PREFIX=%{_prefix} make %{?jobs:-j%jobs} @@ -26,17 +42,30 @@ make %{?jobs:-j%jobs} rm -rf %{buildroot} %make_install -cp -rf %{buildroot}%{_prefix}/etc/bluetooth/bt-dev-start-c210.sh %{buildroot}%{_prefix}/etc/bluetooth/bt-dev-start.sh +%post c210 +rm -rf %{_prefix}/etc/bluetooth/bt-dev-start.sh +ln -s %{_prefix}/etc/bluetooth/bt-dev-start-c210.sh %{_prefix}/etc/bluetooth/bt-dev-start.sh + +%post e4412 +rm -rf %{_prefix}/etc/bluetooth/bt-dev-start.sh +ln -s %{_prefix}/etc/bluetooth/bt-dev-start-e4412.sh %{_prefix}/etc/bluetooth/bt-dev-start.sh -%files +%files c210 %manifest bluetooth-firmware-bcm.manifest %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-dev-start-c210.sh %attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh -%exclude %{_prefix}/etc/bluetooth/BCM4334B0_002.001.013.0079.0081.hcd -%exclude %{_prefix}/etc/bluetooth/bt-dev-start-c210.sh -%exclude %{_prefix}/etc/bluetooth/bt-dev-start-e4412.sh + +%files e4412 +%manifest bluetooth-firmware-bcm.manifest +%defattr(-,root,root,-) +%{_bindir}/bcmtool_4330b1 +%{_bindir}/setbd +%{_prefix}/etc/bluetooth/BCM4334B0_002.001.013.0079.0081.hcd +%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-end.sh +%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-dev-start-e4412.sh +%attr(755,-,-) %{_prefix}/etc/bluetooth/bt-set-addr.sh
\ No newline at end of file diff --git a/scripts/bt-dev-end.sh b/scripts/bt-dev-end.sh index ef4731e..cb57537 100755 --- a/scripts/bt-dev-end.sh +++ b/scripts/bt-dev-end.sh @@ -17,11 +17,11 @@ if [ $REVISION_NUM == "0006" ]; then exit 0 fi -killall hciattach - # Turn off Bluetooth Chip rfkill block bluetooth +killall hciattach + #if [ -e /sys/class/gpio/gpio17/value ] #then # # Reset BT chip diff --git a/scripts/bt-dev-start-c210.sh b/scripts/bt-dev-start-c210.sh index d87f35d..386fd24 100755 --- a/scripts/bt-dev-start-c210.sh +++ b/scripts/bt-dev-start-c210.sh @@ -22,7 +22,7 @@ then mknod $BT_UART_DEVICE c 204 64 fi -if [ ! -e /opt/etc/.bd_addr ] +if [ ! -e /csa/bluetooth/.bd_addr ] then # Set BT address /usr/bin/setbd @@ -39,7 +39,7 @@ else echo "Bluetooth device is DOWN" echo "Registering Bluetooth device" - $BCM_TOOL $BT_UART_DEVICE -FILE=/usr/etc/bluetooth/$BCM_FIRMWARE -BAUD=$UART_SPEED -ADDR=/opt/etc/.bd_addr -SETSCO=0,0,0,0,0,0,0,3,3,0 -LP > /dev/null 2>&1 + $BCM_TOOL $BT_UART_DEVICE -FILE=/usr/etc/bluetooth/$BCM_FIRMWARE -BAUD=$UART_SPEED -ADDR=/csa/bluetooth/.bd_addr -SETSCO=0,0,0,0,0,0,0,3,3,0 -LP > /dev/null 2>&1 # Attaching Broadcom device if (/usr/sbin/hciattach $BT_UART_DEVICE -s $UART_SPEED $BT_CHIP_TYPE $UART_SPEED flow); then diff --git a/scripts/bt-dev-start-e4412.sh b/scripts/bt-dev-start-e4412.sh index 96023e5..5c58e8c 100755 --- a/scripts/bt-dev-start-e4412.sh +++ b/scripts/bt-dev-start-e4412.sh @@ -25,7 +25,7 @@ then mknod $BT_UART_DEVICE c 204 64 fi -if [ ! -e /opt/etc/.bd_addr ] +if [ ! -e /csa/bluetooth/.bd_addr ] then # Set BT address /usr/bin/setbd diff --git a/scripts/bt-set-addr.sh b/scripts/bt-set-addr.sh index 57b2d02..8fcb3f2 100755 --- a/scripts/bt-set-addr.sh +++ b/scripts/bt-set-addr.sh @@ -4,7 +4,7 @@ # Script for setting Bluetooth Address # -if [ -e /opt/etc/.bd_addr ] +if [ -e /csa/bluetooth/.bd_addr ] then echo "Already .bd_addr exists" exit 0 diff --git a/set-address/setbd.c b/set-address/setbd.c index 092da16..f9543e4 100644 --- a/set-address/setbd.c +++ b/set-address/setbd.c @@ -1,11 +1,7 @@ /* * setbd.c * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved - * - * Contact: Hocheol Seo <hocheol.seo@samsung.com> - * GirishAshok Joshi <girish.joshi@samsung.com> - * DoHyun Pyun <dh79.pyun@samsung.com> + * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,8 +24,10 @@ #include <fcntl.h> #include <unistd.h> #include <time.h> -#include <vconf.h> #include <glib.h> +#include <dirent.h> +#include <tapi_common.h> +#include <ITapiModem.h> #ifdef __TI_PATCH__ #define BT_CHIP_TI @@ -49,9 +47,10 @@ #define APP_DEBUG(format, args...) #endif -#define BD_ADDR_FILE "/opt/etc/.bd_addr" -#define PSKEY_TEMP_FILE "/opt/etc/.bluetooth.psr" -#define PSR_FILE "/opt/etc/bluetooth/bluetooth.psr" +#define BD_ADDR_PATH "/csa/bluetooth" +#define BD_ADDR_FILE "/csa/bluetooth/.bd_addr" +#define PSKEY_TEMP_FILE "/csa/bluetooth/.bluetooth.psr" +#define PSR_FILE "/csa/bluetooth/bluetooth.psr" #define BD_ADDR_LEN 14 #define BD_PREFIX "0002\n" @@ -61,127 +60,129 @@ #define READ_BD_FILE_MAX 300 -static int success_make_bt_address_from_imei=-1; -static GMainLoop * loop; -const char *DEFAULT_IMEI="004999010640000"; -static gboolean is_default_imei=FALSE; +static int success_make_bt_address_from_imei = -1; +static GMainLoop *loop; +const char *DEFAULT_IMEI = "004999010640000"; #if defined(BT_CHIP_CSR) || defined(BT_CHIP_BROADCOM) -int addremoveBD(char* path, char* pskey){ +int addremoveBD(char *path, char *pskey) +{ FILE *fd, *new; int ret; char cmp[READ_BD_FILE_MAX]; char *result; fd = fopen(path, "r"); - if(NULL == fd){ + if (NULL == fd) { APP_DBG("Error open psr file\r\n"); return -21; } new = fopen(PSKEY_TEMP_FILE, "w"); - if(NULL == new){ + if (NULL == new) { APP_DBG("Error creat temp file\r\n"); fclose(fd); return -22; } - ret = fputs(pskey,new); + ret = fputs(pskey, new); - while(1){ + while (1) { result = fgets(cmp, READ_BD_FILE_MAX, fd); APP_DBG("PSR : [%s]\r\n", cmp); - if((NULL != result) && (0 == strncmp(cmp, "&0001", 5))){ + if ((NULL != result) && (0 == strncmp(cmp, "&0001", 5))) { APP_DBG("Find BD address set script\r\n"); continue; } - if(NULL == result){ + if (NULL == result) { APP_DBG("EOF reaches\r\n"); fclose(fd); fclose(new); return 1; } - ret = fputs(cmp,new); + ret = fputs(cmp, new); } return 0; } -void makeRandomBD(unsigned char* buf){ + +void makeRandomBD(unsigned char *buf) +{ int ran; int i; unsigned int seed; memcpy(buf, BD_PREFIX, 5); seed = time(NULL); - for(i=5;i<14;i++){ - if(7==i){ - buf[i]='\n'; + for (i = 5; i < BD_ADDR_LEN; i++) { + if (7 == i) { + buf[i] = '\n'; continue; } - ran = rand_r(&seed)%16; - if(10>ran) - ran+=0x30; + ran = rand_r(&seed) % 16; + if (10 > ran) + ran += 0x30; else - ran+=0x57; - buf[i]=ran; + ran += 0x57; + buf[i] = ran; } APP_DEBUG("Random number is\r\n"); - for(i=0;i<BD_ADDR_LEN;i++){ - APP_DEBUG("%c",buf[i]); + for (i = 0; i < BD_ADDR_LEN; i++) { + APP_DEBUG("%c", buf[i]); } APP_DEBUG("\r\n"); } #endif #ifdef BT_CHIP_TI -int readBDaddrTI(void){ - int i, cnt_lap=0, cnt_uap=0, cnt_nap=0; +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){ + 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){ + 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)){ + 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]) + for (i = 0; i < 17; i++) { + if (':' == address[i]) continue; - if(5>i) + if (5 > i) nap[cnt_nap++] = address[i]; - else if(8>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]); + 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){ + 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; } @@ -196,59 +197,58 @@ int readBDaddrTI(void){ return 0; } #endif -int make_bt_address_from_tapi_imei(unsigned char * bt_address) +int make_bt_address_from_tapi_imei(unsigned char *bt_address) { - char * temp=NULL; - int tapi_state=0; - int ret=-1; - int i=0; + int i = 0; + TapiHandle *handler; + char *imei_no; - if(bt_address==NULL) + if (bt_address == NULL) return -EBADR; - ret=vconf_get_int(VCONFKEY_TELEPHONY_TAPI_STATE,&tapi_state); - if(tapi_state==VCONFKEY_TELEPHONY_TAPI_STATE_READY && ret==0){ - temp=vconf_get_str(VCONFKEY_TELEPHONY_IMEI); - APP_DEBUG("TAPI_IMEI: %s\n",temp); + handler = tel_init(NULL); + if (!handler) { + APP_DEBUG("Telephony initilization failed\n"); + return -ENODATA; + } -#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; + imei_no = tel_get_misc_me_imei_sync(handler); + tel_deinit(handler); + if (!imei_no) { + APP_DEBUG("Telephony IMEI getting failed \n"); return -ENODATA; -#endif + } - if(strcmp(temp,"")==0) - return -ENODATA; + if (strlen(imei_no) < BD_ADDR_LEN) { + free(imei_no); + APP_DEBUG("TAPI_IMEI Reading Error\n"); + return -ENODATA; + } - if(strlen(temp)<14) - return -ENODATA; + APP_DEBUG("TAPI_IMEI: %s\n", imei_no); - memcpy(bt_address, BD_PREFIX, 5); + if (strcmp(imei_no, DEFAULT_IMEI) == 0) { + APP_DEBUG("TAPI_IMEI is defulat IMEI\n"); + free(imei_no); + return -ENODATA; + } - for(i=5 ;i<14;i++){ - if(i==7){ - bt_address[i]='\n'; - continue; - } + memcpy(bt_address, BD_PREFIX, 5); - bt_address[i]=temp[i]; + for (i = 5; i < BD_ADDR_LEN; i++) { + if (i == 7) { + bt_address[i] = '\n'; + continue; } - }else{ - APP_DEBUG("TAPI_IMEI Reading Error\n"); - return -ENODATA; + bt_address[i] = imei_no[i]; } + free(imei_no); + APP_DEBUG("Bluetooth Address\n"); - for(i=0;i<BD_ADDR_LEN;i++) - APP_DEBUG("%c",bt_address[i]); + for (i = 0; i < BD_ADDR_LEN; i++) + APP_DEBUG("%c", bt_address[i]); APP_DEBUG("\n"); @@ -256,6 +256,23 @@ int make_bt_address_from_tapi_imei(unsigned char * bt_address) } +void make_bt_address_folder(void) +{ + DIR *dp; + int err; + + dp = opendir(BD_ADDR_PATH); + if (dp == NULL) { + if (mkdir(BD_ADDR_PATH, 0755) < 0) { + err = -errno; + APP_DEBUG("mkdir: %s(%d)", strerror(-err), -err); + } + return; + } + + closedir(dp); +} + int make_bt_address(gboolean overwrite_bt_address) { #if defined(BT_CHIP_CSR) || defined(BT_CHIP_BROADCOM) @@ -263,40 +280,42 @@ int make_bt_address(gboolean overwrite_bt_address) int fd; int i; unsigned char txt[BD_ADDR_LEN]; - unsigned char nap[4+1], uap[2+1], lap[6+1]; - char pskey[PSKEY_LEN+3]; + unsigned char nap[4 + 1], uap[2 + 1], lap[6 + 1]; + char pskey[PSKEY_LEN + 3]; int ret; - fd=open(BD_ADDR_FILE, O_RDONLY | O_SYNC); + make_bt_address_folder(); - if(fd<0 || overwrite_bt_address==TRUE){ - if(fd<0) + fd = open(BD_ADDR_FILE, O_RDONLY | O_SYNC); + + if (fd < 0 || overwrite_bt_address == TRUE) { + if (fd < 0) APP_DEBUG("File not exist\n"); else close(fd); - if(overwrite_bt_address) - { + if (overwrite_bt_address) { APP_DEBUG("Overwrite BT address because TAPI write correct IMEI.\n"); } - fd=open(BD_ADDR_FILE, O_RDWR | O_CREAT | O_TRUNC | O_SYNC, 0644); + fd = open(BD_ADDR_FILE, O_RDWR | O_CREAT | O_TRUNC | O_SYNC, + 0644); - if (fd <0) - { + if (fd < 0) { APP_DEBUG("Can't open address file\n"); return 0; } - success_make_bt_address_from_imei=make_bt_address_from_tapi_imei(txt); + success_make_bt_address_from_imei = + make_bt_address_from_tapi_imei(txt); - if(success_make_bt_address_from_imei<0) + if (success_make_bt_address_from_imei < 0) makeRandomBD(txt); ret = write(fd, txt, BD_ADDR_LEN); lseek(fd, 0, SEEK_SET); - }else{ - APP_DEBUG("%s is already existed\n",BD_ADDR_FILE); - success_make_bt_address_from_imei=0; + } else { + APP_DEBUG("%s is already existed\n", BD_ADDR_FILE); + success_make_bt_address_from_imei = 0; } ret = read(fd, nap, 5); @@ -306,27 +325,26 @@ int make_bt_address(gboolean overwrite_bt_address) #if defined(BT_CHIP_CSR) APP_DEBUG("nap["); - for(i=0;i<4;i++) - APP_DEBUG("%c",nap[i]); + 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]); + 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]); + 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]); + 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++) + for (i = 0; i < PSKEY_LEN; i++) APP_DEBUG("%c", pskey[i]); APP_DEBUG("]\r\n"); @@ -337,14 +355,14 @@ int make_bt_address(gboolean overwrite_bt_address) int fd; int ret; - fd=open(BD_ADDR_FILE, O_RDONLY, 0644); - if(0>fd){ + fd = open(BD_ADDR_FILE, O_RDONLY, 0644); + if (0 > fd) { APP_DBG("File not exists\r\n"); - ret=readBDaddrTI(); - }else{ + ret = readBDaddrTI(); + } else { APP_DBG("File exists\r\n"); close(fd); - ret=0; + ret = 0; } return ret; @@ -354,32 +372,6 @@ int make_bt_address(gboolean overwrite_bt_address) #endif } -void vconf_cb(keynode_t *key, void * data) -{ - char * key_string=NULL; - - switch(vconf_keynode_get_type(key)) - { - case VCONF_TYPE_STRING: - key_string=vconf_keynode_get_str(key); - if(strcmp(key_string,"")!=0) - { - APP_DEBUG("Vconf Call back trial\n"); - /* This case means TAPI writes IMEI correctly */ - /* Because we write BT address which comes from IMEI again */ - make_bt_address(TRUE); - g_main_loop_quit(loop); - } - - break; - - - default: - break; - } - return; -} - gboolean exit_cb(gpointer data) { @@ -388,26 +380,12 @@ gboolean exit_cb(gpointer data) return FALSE; } + int main() { - loop=g_main_loop_new(NULL,FALSE); + loop = g_main_loop_new(NULL, FALSE); APP_DEBUG("Bluetooth Address Setting\n"); make_bt_address(FALSE); - /* When we get proper BT address by IMEI or - * randome BT address due to default IMEI - * We don't need to wait for telephony activation, timeout */ - 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/bcmtool_4330b1.c b/tools/bcmtool_4330b1.c index 6350a06..7fac3f7 100644 --- a/tools/bcmtool_4330b1.c +++ b/tools/bcmtool_4330b1.c @@ -1,11 +1,23 @@ -/***************************************************************************** -** -** Name: bcmtool.c -** -** Description: Download a patchram files for the HCD format -** -** Copyright (c) 2000-2009, Broadcom Corp., All Rights Reserved. -******************************************************************************/ +/* + * Name: bcmtool_4330b1.c + * + * Description: Download a patchram files for the HCD format + * + * Copyright (c) 2012-2013, Broadcom Corp., All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ #include <stdio.h> #include <errno.h> @@ -360,7 +372,7 @@ UINT8 DownloadPatchram( char *patchram1 ) alarm(0); #if ( HIGH_SPEED_PATCHRAM_DOWNLOAD == TRUE ) - ChangeBaudRate(921600); + ChangeBaudRate(3000000); #endif strcpy(prm, patchram1); |