Merge commit '4bf68bf020c7fd1aabcdc4b5d8f5fbb8bacdec9d' into merge_work
Change-Id: Ibc6d6e691b7f97611d16f96220346dfd6ffbbf52
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,202 @@
+
+ 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/bta/Android.mk b/bta/Android.mk
index e5e853f..d41ae75 100644
--- a/bta/Android.mk
+++ b/bta/Android.mk
@@ -7,8 +7,8 @@
-DBOARD_HAVE_BLUETOOTH_BCM
endif
LOCAL_CFLAGS += -DBUILDCFG $(bdroid_CFLAGS) -std=c99
+LOCAL_CLANG_CFLAGS += -Wno-error=gnu-variable-sized-type-not-at-end
-LOCAL_PRELINK_MODULE:=false
LOCAL_SRC_FILES:= \
./dm/bta_dm_ci.c \
./dm/bta_dm_act.c \
diff --git a/bta/av/bta_av_aact.c b/bta/av/bta_av_aact.c
index dd2feec..c394d66 100644
--- a/bta/av/bta_av_aact.c
+++ b/bta/av/bta_av_aact.c
@@ -1118,7 +1118,6 @@
tAVDT_CFG *p_evt_cfg = &p_data->str_msg.cfg;
UINT8 psc_mask = (p_evt_cfg->psc_mask | p_scb->cfg.psc_mask);
UINT8 local_sep; /* sep type of local handle on which connection was received */
- UINT8 count = 0;
tBTA_AV_STR_MSG *p_msg = (tBTA_AV_STR_MSG *)p_data;
UNUSED(p_data);
diff --git a/bta/av/bta_av_api.c b/bta/av/bta_av_api.c
index 7151ae7..ecc05e1 100644
--- a/bta/av/bta_av_api.c
+++ b/bta/av/bta_av_api.c
@@ -255,9 +255,8 @@
*******************************************************************************/
void BTA_AvEnable_Sink(int enable)
{
- BT_HDR *p_buf;
-
#if (BTA_AV_SINK_INCLUDED == TRUE)
+ BT_HDR *p_buf;
if ((p_buf = (BT_HDR *) GKI_getbuf(sizeof(BT_HDR))) != NULL)
{
p_buf->event = BTA_AV_API_SINK_ENABLE_EVT;
diff --git a/bta/av/bta_av_cfg.c b/bta/av/bta_av_cfg.c
index e2978c1..d3776f4 100644
--- a/bta/av/bta_av_cfg.c
+++ b/bta/av/bta_av_cfg.c
@@ -23,6 +23,8 @@
*
******************************************************************************/
+#include <stddef.h>
+
#include "bt_target.h"
#include "gki.h"
#include "bta_api.h"
diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c
index 14b6093..2feb2cc 100644
--- a/bta/dm/bta_dm_act.c
+++ b/bta/dm/bta_dm_act.c
@@ -102,7 +102,10 @@
#endif
static void bta_dm_observe_results_cb (tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_observe_cmpl_cb (void * p_result);
+
+#if BLE_VND_INCLUDED == TRUE
static void bta_dm_ctrl_features_rd_cmpl_cback(tBTM_STATUS result);
+#endif
#ifndef BTA_DM_BLE_ADV_CHNL_MAP
#define BTA_DM_BLE_ADV_CHNL_MAP (BTM_BLE_ADV_CHNL_37|BTM_BLE_ADV_CHNL_38|BTM_BLE_ADV_CHNL_39)
@@ -4233,7 +4236,6 @@
;
tBTA_DM_SEARCH result;
tBTM_INQ_INFO *p_inq_info;
- UINT16 service_class;
APPL_TRACE_DEBUG("bta_dm_observe_results_cb")
bdcpy(result.inq_res.bd_addr, p_inq->remote_bd_addr);
@@ -4763,7 +4765,6 @@
void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data)
{
tBTM_STATUS btm_status = 0;
- void *p_ref = NULL;
bta_dm_cb.p_multi_adv_cback = p_data->ble_multi_adv_enb.p_cback;
if(BTM_BleMaxMultiAdvInstanceCount() > 0 && NULL != p_data->ble_multi_adv_enb.p_ref)
@@ -5085,27 +5086,6 @@
/*******************************************************************************
**
-** Function bta_ble_status_cmpl
-**
-** Description ADV payload filtering enable / disable complete callback
-**
-**
-** Returns None
-**
-*******************************************************************************/
-static void bta_ble_status_cmpl(tBTM_BLE_PF_ACTION action, tBTM_BLE_REF_VALUE ref_value,
- tBTM_STATUS status)
-{
- tBTA_STATUS st = (status == BTM_SUCCESS) ? BTA_SUCCESS: BTA_FAILURE;
-
- APPL_TRACE_DEBUG("bta_ble_status_cmpl: %d, %d", action, status);
-
- if(bta_dm_cb.p_scan_filt_status_cback)
- bta_dm_cb.p_scan_filt_status_cback(action, ref_value, st);
-}
-
-/*******************************************************************************
-**
** Function bta_dm_cfg_filter_cond
**
** Description This function configure adv payload filtering condition
@@ -5599,6 +5579,7 @@
#endif /* BTA_GATT_INCLUDED */
+#if BLE_VND_INCLUDED == TRUE
/*******************************************************************************
**
** Function bta_dm_ctrl_features_rd_cmpl_cback
@@ -5622,6 +5603,6 @@
}
}
-
+#endif /* BLE_VND_INCLUDED */
#endif /* BLE_INCLUDED */
diff --git a/bta/gatt/bta_gattc_utils.c b/bta/gatt/bta_gattc_utils.c
index 946d8bf..bffbc4c 100644
--- a/bta/gatt/bta_gattc_utils.c
+++ b/bta/gatt/bta_gattc_utils.c
@@ -947,7 +947,6 @@
tBTA_GATTC_CLCB * bta_gattc_find_int_disconn_clcb(tBTA_GATTC_DATA *p_msg)
{
tBTA_GATTC_CLCB *p_clcb = NULL;
- tGATT_DISCONN_REASON reason = p_msg->int_conn.reason;
bta_gattc_conn_dealloc(p_msg->int_conn.remote_bda);
if ((p_clcb = bta_gattc_find_clcb_by_conn_id(p_msg->int_conn.hdr.layer_specific)) == NULL)
diff --git a/bta/gatt/bta_gatts_act.c b/bta/gatt/bta_gatts_act.c
index 43befe5..bdd7f29 100644
--- a/bta/gatt/bta_gatts_act.c
+++ b/bta/gatt/bta_gatts_act.c
@@ -152,7 +152,6 @@
void bta_gatts_api_disable(tBTA_GATTS_CB *p_cb)
{
UINT8 i;
- tBTA_GATT_STATUS status = BTA_GATT_OK;
if (p_cb->enabled)
{
diff --git a/bta/hf_client/bta_hf_client_act.c b/bta/hf_client/bta_hf_client_act.c
index 4cf99c7..30b5237 100644
--- a/bta/hf_client/bta_hf_client_act.c
+++ b/bta/hf_client/bta_hf_client_act.c
@@ -264,7 +264,6 @@
void bta_hf_client_rfc_acp_open(tBTA_HF_CLIENT_DATA *p_data)
{
UINT16 lcid;
- int i;
BD_ADDR dev_addr;
int status;
@@ -392,7 +391,6 @@
*******************************************************************************/
void bta_hf_client_rfc_close(tBTA_HF_CLIENT_DATA *p_data)
{
- int i, num_active_conn = 0;
UNUSED(p_data);
/* reinitialize stuff */
diff --git a/bta/hf_client/bta_hf_client_api.c b/bta/hf_client/bta_hf_client_api.c
index bb65f3e..62d8335 100644
--- a/bta/hf_client/bta_hf_client_api.c
+++ b/bta/hf_client/bta_hf_client_api.c
@@ -59,7 +59,6 @@
tBTA_STATUS BTA_HfClientEnable(tBTA_HF_CLIENT_CBACK *p_cback)
{
tBTA_HF_CLIENT_API_ENABLE *p_buf;
- UINT8 idx;
if (bta_sys_is_register (BTA_ID_HS))
{
diff --git a/bta/hf_client/bta_hf_client_rfc.c b/bta/hf_client/bta_hf_client_rfc.c
index aaa8d21..829c3a5 100644
--- a/bta/hf_client/bta_hf_client_rfc.c
+++ b/bta/hf_client/bta_hf_client_rfc.c
@@ -144,7 +144,6 @@
*******************************************************************************/
void bta_hf_client_start_server(void)
{
- int i;
int port_status;
if (bta_hf_client_cb.scb.serv_handle > 0)
diff --git a/bta/hf_client/bta_hf_client_sdp.c b/bta/hf_client/bta_hf_client_sdp.c
index a19912c..fd55a6c 100644
--- a/bta/hf_client/bta_hf_client_sdp.c
+++ b/bta/hf_client/bta_hf_client_sdp.c
@@ -94,7 +94,6 @@
UINT16 version;
UINT16 profile_uuid;
BOOLEAN result = TRUE;
- BOOLEAN codec_supported = FALSE;
UINT8 buf[2];
UINT16 sdp_features = 0;
diff --git a/bta/hh/bta_hh_le.c b/bta/hh/bta_hh_le.c
index dd4be4f..fee2cda 100644
--- a/bta/hh/bta_hh_le.c
+++ b/bta/hh/bta_hh_le.c
@@ -2409,7 +2409,6 @@
void bta_hh_le_open_fail(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data)
{
tBTA_HH_CONN conn_dat ;
- tBTA_HH_LE_HID_SRVC *p_hid_srvc = &p_cb->hid_srvc[0];
/* open failure in the middle of service discovery, clear all services */
if (p_cb->disc_active & BTA_HH_LE_DISC_HIDS)
diff --git a/bta/hl/bta_hl_ci.c b/bta/hl/bta_hl_ci.c
index 652a5c5..17e1e67 100644
--- a/bta/hl/bta_hl_ci.c
+++ b/bta/hl/bta_hl_ci.c
@@ -22,6 +22,7 @@
* subsystem call-in functions.
*
******************************************************************************/
+
#include <stddef.h>
#include "bta_api.h"
#include "btm_api.h"
diff --git a/bta/hl/bta_hl_utils.c b/bta/hl/bta_hl_utils.c
index 628f423..0a0f326 100644
--- a/bta/hl/bta_hl_utils.c
+++ b/bta/hl/bta_hl_utils.c
@@ -1601,7 +1601,6 @@
*******************************************************************************/
void bta_hl_compact_mdl_cfg_time(UINT8 app_idx, UINT8 mdep_id)
{
- tBTA_HL_APP_CB *p_acb = BTA_HL_GET_APP_CB_PTR(app_idx);
tBTA_HL_MDL_CFG *p_mdl;
UINT8 i, time_min, cnt=0;
UINT8 s_arr[BTA_HL_NUM_MDL_CFGS];
@@ -1700,8 +1699,6 @@
tBTA_HL_MDL_CFG *p_mdl;
BOOLEAN success = FALSE;
UINT8 i;
- tBTA_HL_APP_CB *p_acb= BTA_HL_GET_APP_CB_PTR(app_idx);
- UINT8 app_id = p_acb->app_id;
for (i = 0; i< BTA_HL_NUM_MDL_CFGS; i++)
{
diff --git a/bta/include/bta_api.h b/bta/include/bta_api.h
index c7aab83..31d8729 100644
--- a/bta/include/bta_api.h
+++ b/bta/include/bta_api.h
@@ -74,7 +74,7 @@
#define BTA_NAP_SERVICE_ID 15 /* PAN Network access point */
#define BTA_GN_SERVICE_ID 16 /* PAN Group Ad-hoc networks */
#define BTA_SAP_SERVICE_ID 17 /* SIM Access profile */
-#define BTA_A2DP_SERVICE_ID 18 /* A2DP Sink */
+#define BTA_A2DP_SINK_SERVICE_ID 18 /* A2DP Sink */
#define BTA_AVRCP_SERVICE_ID 19 /* A/V remote control */
#define BTA_HID_SERVICE_ID 20 /* HID */
#define BTA_VDP_SERVICE_ID 21 /* Video distribution */
@@ -943,20 +943,10 @@
#define BTA_DM_BLE_PF_CONFIG_EVT BTM_BLE_PF_CONFIG
typedef UINT8 tBTA_DM_BLE_PF_EVT;
-typedef UINT8 tBTA_DM_BLE_PF_COND_TYPE;
-
-#define BTA_DM_BLE_PF_LOGIC_OR 0
-#define BTA_DM_BLE_PF_LOGIC_AND 1
-typedef UINT8 tBTA_DM_BLE_PF_LOGIC_TYPE;
-
#define BTA_DM_BLE_PF_ENABLE 1
#define BTA_DM_BLE_PF_CONFIG 2
typedef UINT8 tBTA_DM_BLE_PF_ACTION;
-typedef UINT8 tBTA_DM_BLE_PF_FILT_INDEX;
-
-typedef UINT8 tBTA_DM_BLE_PF_AVBL_SPACE;
-
/* Config callback */
typedef void (tBTA_DM_BLE_PF_CFG_CBACK) (tBTA_DM_BLE_PF_ACTION action,
tBTA_DM_BLE_PF_COND_TYPE cfg_cond,
diff --git a/bta/jv/bta_jv_act.c b/bta/jv/bta_jv_act.c
index 224450a..c9299e8 100644
--- a/bta/jv/bta_jv_act.c
+++ b/bta/jv/bta_jv_act.c
@@ -976,8 +976,6 @@
tBTA_JV evt_data;
BD_ADDR rem_bda;
UINT16 lcid;
- UINT8 num;
- UINT32 si;
APPL_TRACE_DEBUG("bta_jv_port_mgmt_sr_cback, code:%d, port_handle:%d", code, port_handle);
if(NULL == p_cb || NULL == p_cb->p_cback)
{
diff --git a/btcore/src/module.c b/btcore/src/module.c
index 5f3902e..03ba91f 100644
--- a/btcore/src/module.c
+++ b/btcore/src/module.c
@@ -21,6 +21,7 @@
#include <assert.h>
#include <dlfcn.h>
#include <pthread.h>
+#include <string.h>
#include "osi/include/allocator.h"
#include "osi/include/hash_map.h"
@@ -66,8 +67,32 @@
pthread_mutex_destroy(&metadata_lock);
}
+/* TODO: remove these externs and explicit checks once dlsym is fixed */
+extern module_t bt_utils_module;
+extern module_t btif_config_module;
+extern module_t controller_module;
+extern module_t gki_module;
+extern module_t counter_module;
+extern module_t stack_config_module;
+extern module_t btsnoop_module;
+extern module_t hci_module;
+extern module_t bte_logmsg_module;
+
const module_t *get_module(const char *name) {
- return (module_t *)dlsym(RTLD_DEFAULT, name);
+ module_t* module = (module_t *)dlsym(RTLD_DEFAULT, name);
+ if (module) return module;
+
+ if (!strcmp(name, "bt_utils_module")) return &bt_utils_module;
+ if (!strcmp(name, "btif_config_module")) return &btif_config_module;
+ if (!strcmp(name, "controller_module")) return &controller_module;
+ if (!strcmp(name, "gki_module")) return &gki_module;
+ if (!strcmp(name, "counter_module")) return &counter_module;
+ if (!strcmp(name, "stack_config_module")) return &stack_config_module;
+ if (!strcmp(name, "btsnoop_module")) return &btsnoop_module;
+ if (!strcmp(name, "hci_module")) return &hci_module;
+ if (!strcmp(name, "bte_logmsg_module")) return &bte_logmsg_module;
+
+ return NULL;
}
bool module_init(const module_t *module) {
diff --git a/btif/co/bta_av_co.c b/btif/co/bta_av_co.c
index a477664..1460fca 100644
--- a/btif/co/bta_av_co.c
+++ b/btif/co/bta_av_co.c
@@ -463,7 +463,6 @@
BOOLEAN supported;
tBTA_AV_CO_PEER *p_peer;
tBTA_AV_CO_SINK *p_src;
- UINT8 codec_cfg[AVDT_CODEC_SIZE];
UINT8 pref_cfg[AVDT_CODEC_SIZE];
UINT8 index;
diff --git a/btif/co/bta_hh_co.c b/btif/co/bta_hh_co.c
index 3ab2255..b0ab2e0 100644
--- a/btif/co/bta_hh_co.c
+++ b/btif/co/bta_hh_co.c
@@ -28,6 +28,7 @@
#include <errno.h>
#include <unistd.h>
#include <linux/uhid.h>
+#include <unistd.h>
#include "btif_hh.h"
#include "bta_api.h"
#include "bta_hh_api.h"
diff --git a/btif/co/bta_pan_co.c b/btif/co/bta_pan_co.c
index 7070f1a..50e0d8c 100644
--- a/btif/co/bta_pan_co.c
+++ b/btif/co/bta_pan_co.c
@@ -158,7 +158,6 @@
void bta_pan_co_tx_path(UINT16 handle, UINT8 app_id)
{
BT_HDR *p_buf;
- UINT8 i;
BD_ADDR src;
BD_ADDR dst;
UINT16 protocol;
diff --git a/btif/src/btif_av.c b/btif/src/btif_av.c
index 28d0d9a..2994104 100644
--- a/btif/src/btif_av.c
+++ b/btif/src/btif_av.c
@@ -27,6 +27,7 @@
#include <hardware/bluetooth.h>
#include <system/audio.h>
+#include <string.h>
#include "hardware/bt_av.h"
#define LOG_TAG "bt_btif_av"
@@ -892,9 +893,13 @@
return BT_STATUS_FAIL;
btif_enable_service(BTA_A2DP_SOURCE_SERVICE_ID);
+#if (BTA_AV_SINK_INCLUDED == TRUE)
+ btif_enable_service(BTA_A2DP_SINK_SERVICE_ID);
+#endif
/* Also initialize the AV state machine */
- btif_av_cb.sm_handle = btif_sm_init((const btif_sm_handler_t*)btif_av_state_handlers, BTIF_AV_STATE_IDLE);
+ btif_av_cb.sm_handle =
+ btif_sm_init((const btif_sm_handler_t*)btif_av_state_handlers, BTIF_AV_STATE_IDLE);
btif_a2dp_on_init();
@@ -959,7 +964,6 @@
if (status == BT_STATUS_SUCCESS) {
bt_av_sink_callbacks = callbacks;
- BTA_AvEnable_Sink(TRUE);
}
return status;
@@ -1038,7 +1042,10 @@
btif_a2dp_stop_media_task();
- btif_disable_service(BTA_A2DP_SERVICE_ID);
+ btif_disable_service(BTA_A2DP_SOURCE_SERVICE_ID);
+#if (BTA_AV_SINK_INCLUDED == TRUE)
+ btif_disable_service(BTA_A2DP_SINK_SERVICE_ID);
+#endif
/* Also shut down the AV state machine */
btif_sm_shutdown(btif_av_cb.sm_handle);
@@ -1215,6 +1222,23 @@
/*******************************************************************************
**
+** Function btif_av_sink_execute_service
+**
+** Description Initializes/Shuts down the service
+**
+** Returns BT_STATUS_SUCCESS on success, BT_STATUS_FAIL otherwise
+**
+*******************************************************************************/
+bt_status_t btif_av_sink_execute_service(BOOLEAN b_enable)
+{
+#if (BTA_AV_SINK_INCLUDED == TRUE)
+ BTA_AvEnable_Sink(b_enable);
+#endif
+ return BT_STATUS_SUCCESS;
+}
+
+/*******************************************************************************
+**
** Function btif_av_get_src_interface
**
** Description Get the AV callback interface for A2DP source profile
diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c
index 9462bce..2209659 100644
--- a/btif/src/btif_core.c
+++ b/btif/src/btif_core.c
@@ -805,8 +805,6 @@
static void execute_storage_request(UINT16 event, char *p_param)
{
- uint8_t is_local;
- int num_entries = 0;
bt_status_t status = BT_STATUS_SUCCESS;
BTIF_TRACE_EVENT("execute storage request event : %d", event);
@@ -1116,7 +1114,6 @@
if (storage_req_id != BTIF_CORE_STORAGE_NO_ACTION)
{
- int btif_status;
/* pass on to storage for updating local database */
memset(&(req.write_req.bd_addr), 0, sizeof(bt_bdaddr_t));
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index 073fc7d..9e81af6 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -240,6 +240,7 @@
extern UINT16 bta_service_id_to_uuid_lkup_tbl [BTA_MAX_SERVICE_ID];
extern bt_status_t btif_hf_execute_service(BOOLEAN b_enable);
extern bt_status_t btif_av_execute_service(BOOLEAN b_enable);
+extern bt_status_t btif_av_sink_execute_service(BOOLEAN b_enable);
extern bt_status_t btif_hh_execute_service(BOOLEAN b_enable);
extern bt_status_t btif_hf_client_execute_service(BOOLEAN b_enable);
extern bt_status_t btif_mce_execute_service(BOOLEAN b_enable);
@@ -266,6 +267,10 @@
{
btif_av_execute_service(b_enable);
}break;
+ case BTA_A2DP_SINK_SERVICE_ID:
+ {
+ btif_av_sink_execute_service(b_enable);
+ }break;
case BTA_HID_SERVICE_ID:
{
btif_hh_execute_service(b_enable);
@@ -438,13 +443,11 @@
*******************************************************************************/
BOOLEAN check_sdp_bl(const bt_bdaddr_t *remote_bdaddr)
{
- UINT8 i = 0;
UINT16 manufacturer = 0;
UINT8 lmp_ver = 0;
UINT16 lmp_subver = 0;
bt_property_t prop_name;
bt_remote_version_t info;
- bt_status_t status;
if (remote_bdaddr == NULL)
@@ -694,7 +697,6 @@
*******************************************************************************/
void btif_dm_cb_remove_bond(bt_bdaddr_t *bd_addr)
{
- bdstr_t bdstr;
/*special handling for HID devices */
/* VUP needs to be sent if its a HID Device. The HID HOST module will check if there
is a valid hid connection with this bd_addr. If yes VUP will be issued.*/
@@ -1230,11 +1232,9 @@
{
/* inquiry result */
UINT32 cod;
- UINT8 *p_eir_remote_name = NULL;
bt_bdname_t bdname;
bt_bdaddr_t bdaddr;
UINT8 remote_name_len;
- UINT8 *p_cached_name = NULL;
tBTA_SERVICE_MASK services = 0;
bdstr_t bdstr;
@@ -1388,9 +1388,8 @@
{
case BTA_DM_DISC_RES_EVT:
{
- bt_uuid_t uuid_arr[BT_MAX_NUM_UUIDS]; /* Max 32 services */
bt_property_t prop;
- uint32_t i = 0, j = 0;
+ uint32_t i = 0;
bt_bdaddr_t bd_addr;
bt_status_t ret;
@@ -1524,7 +1523,6 @@
{
bt_service_record_t rec;
bt_property_t prop;
- uint32_t i = 0;
bt_bdaddr_t bd_addr;
memset(&rec, 0, sizeof(bt_service_record_t));
@@ -1567,7 +1565,6 @@
*******************************************************************************/
static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
{
- tBTA_DM_SEC_EVT dm_event = (tBTA_DM_SEC_EVT)event;
tBTA_DM_SEC *p_data = (tBTA_DM_SEC*)p_param;
tBTA_SERVICE_MASK service_mask;
uint32_t i;
@@ -2505,8 +2502,6 @@
*******************************************************************************/
bt_status_t btif_dm_get_adapter_property(bt_property_t *prop)
{
- bt_status_t status;
-
BTIF_TRACE_EVENT("%s: type=0x%x", __FUNCTION__, prop->type);
switch (prop->type)
{
@@ -2887,8 +2882,6 @@
void btif_dm_load_ble_local_keys(void)
{
- bt_status_t bt_status;
-
memset(&ble_local_key_cb, 0, sizeof(btif_dm_local_key_cb_t));
if (btif_storage_get_ble_local_key(BTIF_DM_LE_LOCAL_KEY_ER,(char*)&ble_local_key_cb.er[0],
diff --git a/btif/src/btif_gatt_client.c b/btif/src/btif_gatt_client.c
index 3674edc..df766c1 100644
--- a/btif/src/btif_gatt_client.c
+++ b/btif/src/btif_gatt_client.c
@@ -336,7 +336,6 @@
static void btif_gattc_add_remote_bdaddr (BD_ADDR p_bda, uint8_t addr_type)
{
- BOOLEAN found=FALSE;
uint8_t i;
for (i = 0; i < BTIF_GATT_MAX_OBSERVED_DEV; i++)
{
diff --git a/btif/src/btif_gatt_multi_adv_util.c b/btif/src/btif_gatt_multi_adv_util.c
index ed564ff..4837474 100644
--- a/btif/src/btif_gatt_multi_adv_util.c
+++ b/btif/src/btif_gatt_multi_adv_util.c
@@ -254,7 +254,6 @@
BOOLEAN btif_gattc_copy_datacb(int cbindex, btif_adv_data_t *p_adv_data, BOOLEAN bInstData)
{
- int i=0;
btgatt_multi_adv_common_data *p_multi_adv_data_cb = btif_obtain_multi_adv_data_cb();
if (NULL == p_multi_adv_data_cb || cbindex < 0)
return false;
diff --git a/btif/src/btif_gatt_util.c b/btif/src/btif_gatt_util.c
index 932592c..da3d712 100644
--- a/btif/src/btif_gatt_util.c
+++ b/btif/src/btif_gatt_util.c
@@ -237,7 +237,6 @@
uint16_t set_read_value(btgatt_read_params_t *p_dest, tBTA_GATTC_READ *p_src)
{
- int i = 0;
uint16_t descr_type = 0;
uint16_t len = 0;
diff --git a/btif/src/btif_hf.c b/btif/src/btif_hf.c
index dc1703d..f8c118b 100644
--- a/btif/src/btif_hf.c
+++ b/btif/src/btif_hf.c
@@ -353,7 +353,7 @@
int i;
for (i = 0; i < btif_max_hf_clients; i++)
{
- if ((btif_hf_cb[i].state == BTHF_CONNECTION_STATE_SLC_CONNECTED))
+ if (btif_hf_cb[i].state == BTHF_CONNECTION_STATE_SLC_CONNECTED)
{
BTIF_TRACE_EVENT("BTHF: %s: slc connected for idx = %d",
__FUNCTION__, i);
@@ -389,7 +389,6 @@
{
tBTA_AG *p_data = (tBTA_AG *)p_param;
bdstr_t bdstr;
- bt_bdaddr_t addr;
int idx = p_data->hdr.handle - 1;
BTIF_TRACE_DEBUG("%s: event=%s", __FUNCTION__, dump_hf_event(event));
diff --git a/btif/src/btif_hf_client.c b/btif/src/btif_hf_client.c
index e0a0b8d..ee78a8a 100644
--- a/btif/src/btif_hf_client.c
+++ b/btif/src/btif_hf_client.c
@@ -138,7 +138,7 @@
switch (event) {
case BTIF_HF_CLIENT_CB_AUDIO_CONNECTING:
{
- HAL_CBACK(bt_hf_client_callbacks, audio_state_cb, BTHF_AUDIO_STATE_CONNECTING,
+ HAL_CBACK(bt_hf_client_callbacks, audio_state_cb, (bthf_client_audio_state_t)BTHF_AUDIO_STATE_CONNECTING,
&btif_hf_client_cb.connected_bda);
} break;
default:
@@ -368,8 +368,6 @@
*******************************************************************************/
static bt_status_t volume_control(bthf_client_volume_type_t type, int volume)
{
- BOOLEAN speaker;
-
CHECK_BTHF_CLIENT_SLC_CONNECTED();
switch (type)
diff --git a/btif/src/btif_hh.c b/btif/src/btif_hh.c
index 20c8e3c..997f523 100644
--- a/btif/src/btif_hh.c
+++ b/btif/src/btif_hh.c
@@ -67,7 +67,6 @@
extern const int BT_UID;
extern const int BT_GID;
-static int btif_hh_prev_keyevents=0; //The previous key events
static int btif_hh_keylockstates=0; //The current key state of each key
#define BTIF_HH_ID_1 0
@@ -623,7 +622,6 @@
char bda_str[20];
int i;
BD_ADDR *bda = (BD_ADDR*)bd_addr;
- tBTA_HH_CONN conn;
CHECK_BTHH_INIT();
dev = btif_hh_find_dev_by_bda(bd_addr);
BTIF_TRACE_DEBUG("Connect _hh");
@@ -687,7 +685,6 @@
void btif_hh_disconnect(bt_bdaddr_t *bd_addr)
{
- BD_ADDR *bda = (BD_ADDR*)bd_addr;
btif_hh_device_t *p_dev;
p_dev = btif_hh_find_connected_dev_by_bda(bd_addr);
if (p_dev != NULL)
@@ -741,7 +738,6 @@
static void btif_hh_upstreams_evt(UINT16 event, char* p_param)
{
tBTA_HH *p_data = (tBTA_HH *)p_param;
- bdstr_t bdstr;
btif_hh_device_t *p_dev = NULL;
int i;
int len, tmplen;
@@ -1182,7 +1178,7 @@
void btif_hh_tmr_hdlr(TIMER_LIST_ENT *tle)
{
btif_hh_device_t *p_dev;
- UINT8 i,j;
+ UINT8 i;
tBTA_HH_EVT event;
tBTA_HH p_data;
int param_len = 0;
diff --git a/btif/src/btif_hl.c b/btif/src/btif_hl.c
index d11ba25..9d0c0d7 100644
--- a/btif/src/btif_hl.c
+++ b/btif/src/btif_hl.c
@@ -916,7 +916,7 @@
btif_hl_app_cb_t *p_acb;
btif_hl_mcl_cb_t *p_mcb;
btif_hl_pending_chan_cb_t *p_pcb;
- UINT8 app_idx, mcl_idx, chan_idx;
+ UINT8 app_idx, mcl_idx;
BOOLEAN status = TRUE;
BTIF_TRACE_DEBUG("%s app_id=%d ctrl_psm=%d mdep_cfg_idx=%d op=%d",
@@ -1295,7 +1295,6 @@
BOOLEAN btif_hl_find_mcl_idx(UINT8 app_idx, BD_ADDR p_bd_addr, UINT8 *p_mcl_idx){
BOOLEAN found=FALSE;
UINT8 i;
- btif_hl_app_cb_t *p_acb =BTIF_HL_GET_APP_CB_PTR(app_idx);
btif_hl_mcl_cb_t *p_mcb;
*p_mcl_idx = 0;
@@ -1867,7 +1866,6 @@
*******************************************************************************/
static void btif_hl_stop_timer_using_handle( tBTA_HL_MCL_HANDLE mcl_handle){
btif_hl_app_cb_t *p_acb;
- BOOLEAN found=FALSE;
UINT8 i,j;
for (i=0; i<BTA_HL_NUM_APPS; i++)
@@ -1897,7 +1895,7 @@
UINT8 p_app_idx, UINT8 *p_mcl_idx){
btif_hl_app_cb_t *p_acb;
BOOLEAN found=FALSE;
- UINT8 i,j;
+ UINT8 j;
p_acb =BTIF_HL_GET_APP_CB_PTR(p_app_idx);
for (j=0; j < BTA_HL_NUM_MCLS ; j++)
@@ -1928,7 +1926,7 @@
btif_hl_app_cb_t *p_acb;
btif_hl_mcl_cb_t *p_mcb;
btif_hl_mdl_cb_t *p_dcb;
- UINT8 i,j,x,y;
+ UINT8 j,x,y;
bt_bdaddr_t bd_addr;
p_acb =BTIF_HL_GET_APP_CB_PTR(app_idx);
@@ -2121,7 +2119,6 @@
UINT8 app_idx;
int app_id = 0;
bthl_app_reg_state_t state = BTHL_APP_REG_STATE_DEREG_SUCCESS;
- bt_status_t status = BT_STATUS_SUCCESS;
BTIF_TRACE_DEBUG("%s de-reg status=%d app_handle=%d", __FUNCTION__,
p_data->dereg_cfm.status, p_data->dereg_cfm.app_handle);
@@ -2161,7 +2158,6 @@
btif_hl_app_cb_t *p_acb;
UINT8 app_idx;
bthl_app_reg_state_t state = BTHL_APP_REG_STATE_REG_SUCCESS;
- bt_status_t bt_status;
BTIF_TRACE_DEBUG("%s reg status=%d app_handle=%d", __FUNCTION__, p_data->reg_cfm.status, p_data->reg_cfm.app_handle);
@@ -2465,7 +2461,7 @@
{
btif_hl_mcl_cb_t *p_mcb;
- UINT8 app_idx, mcl_idx;
+ UINT8 mcl_idx;
int i;
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
@@ -2588,7 +2584,6 @@
btif_hl_mcl_cb_t *p_mcb;
UINT8 app_idx, mcl_idx;
BOOLEAN status = FALSE;
- tBTA_HL_DCH_OPEN_PARAM dch_open;
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
@@ -2657,7 +2652,6 @@
static void btif_hl_proc_cch_close_ind(tBTA_HL *p_data)
{
- UINT8 app_idx, mcl_idx;
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
btif_hl_clean_mcb_using_handle(p_data->cch_close_ind.mcl_handle);
@@ -2675,7 +2669,6 @@
*******************************************************************************/
static void btif_hl_proc_cch_close_cfm(tBTA_HL *p_data)
{
- UINT8 app_idx, mcl_idx;
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
btif_hl_clean_mcb_using_handle(p_data->cch_close_ind.mcl_handle);
@@ -2694,7 +2687,7 @@
btif_hl_app_cb_t *p_acb;
btif_hl_mcl_cb_t *p_mcb;
tBTA_HL_MDEP *p_mdep;
- UINT8 app_idx, orig_app_idx, mcl_idx, mdep_cfg_idx;
+ UINT8 orig_app_idx, mcl_idx, mdep_cfg_idx;
BOOLEAN first_reliable_exist;
BOOLEAN success = TRUE;
tBTA_HL_DCH_CFG rsp_cfg = BTA_HL_DCH_CFG_UNKNOWN;
@@ -2777,7 +2770,6 @@
{
btif_hl_mdl_cb_t *p_dcb;
UINT8 orig_app_idx, mcl_idx, mdl_idx, mdep_cfg_idx;
- UINT8 dc_cfg;
BOOLEAN close_dch = FALSE;
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
@@ -3006,7 +2998,7 @@
{
btif_hl_app_cb_t *p_acb;
btif_hl_mdl_cb_t *p_dcb;
- UINT8 app_idx, mcl_idx, mdl_idx, mdep_cfg_idx, dc_cfg;
+ UINT8 app_idx, mcl_idx, mdl_idx, mdep_cfg_idx;
BOOLEAN close_dch = FALSE;
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
@@ -3139,7 +3131,6 @@
*******************************************************************************/
static void btif_hl_proc_abort_ind(tBTA_HL_MCL_HANDLE mcl_handle){
- UINT8 app_idx,mcl_idx;
BTIF_TRACE_DEBUG("%s", __FUNCTION__ );
btif_hl_app_cb_t *p_acb;
UINT8 i,j;
@@ -3172,8 +3163,6 @@
**
*******************************************************************************/
static void btif_hl_proc_abort_cfm(tBTA_HL_MCL_HANDLE mcl_handle){
- UINT8 app_idx,mcl_idx;
-
BTIF_TRACE_DEBUG("%s", __FUNCTION__ );
btif_hl_app_cb_t *p_acb;
UINT8 i,j;
@@ -3260,9 +3249,6 @@
static void btif_hl_proc_reg_request(UINT8 app_idx, UINT8 app_id,
tBTA_HL_REG_PARAM *p_reg_param,
tBTA_HL_CBACK *p_cback){
- bt_status_t status= BT_STATUS_SUCCESS;
- UINT8 i;
- btif_hl_app_data_t *p_data;
UNUSED(p_cback);
BTIF_TRACE_DEBUG("%s app_idx=%d app_id=%d", __FUNCTION__, app_idx, app_id);
@@ -3383,7 +3369,6 @@
UINT8 app_idx, mcl_idx;
btif_hl_app_cb_t *p_acb;
btif_hl_mcl_cb_t *p_mcb = NULL;
- BD_ADDR bd_addr;
btif_hl_pend_dch_op_t pending_op;
BOOLEAN status;
@@ -4076,11 +4061,10 @@
**
*******************************************************************************/
static bt_status_t destroy_channel(int channel_id){
- UINT8 app_idx, mcl_idx, mdl_idx, mdl_cfg_idx, app_id, mdep_cfg_idx = 0;
+ UINT8 app_idx, mcl_idx, mdl_cfg_idx, mdep_cfg_idx = 0;
bt_status_t status = BT_STATUS_SUCCESS;
btif_hl_mdl_cfg_t *p_mdl;
btif_hl_mcl_cb_t *p_mcb;
- btif_hl_mdl_cb_t *p_dcb;
btif_hl_app_cb_t *p_acb;
CHECK_BTHL_INIT();
@@ -4208,7 +4192,7 @@
tBTA_HL_SUP_FEATURE *p_sup;
tBTA_HL_MDEP_CFG *p_cfg;
tBTA_HL_MDEP_DATA_TYPE_CFG *p_data;
- UINT8 app_idx=0, i=0, pending_reg_idx=0;
+ UINT8 app_idx=0, i=0;
bthl_mdep_cfg_t *p_mdep_cfg;
bt_status_t status = BT_STATUS_SUCCESS;
btif_hl_evt_cb_t evt_param;
@@ -4338,7 +4322,7 @@
BOOLEAN success = FALSE;
btif_hl_app_cb_t *p_acb;
btif_hl_mcl_cb_t *p_mcb;
- UINT8 app_idx, mcl_idx, mdl_idx, len;
+ UINT8 app_idx, mcl_idx, len;
bt_status_t bt_status;
btif_hl_evt_cb_t evt_param;
int *p_channel_id;
@@ -4561,7 +4545,6 @@
**
*******************************************************************************/
void btif_hl_release_mcl_sockets(UINT8 app_idx, UINT8 mcl_idx){
- btif_hl_soc_cb_t *p_scb = NULL;
UINT8 i;
btif_hl_mdl_cb_t *p_dcb;
BOOLEAN found= FALSE;
@@ -4617,7 +4600,6 @@
btif_hl_mcl_cb_t *p_mcb = BTIF_HL_GET_MCL_CB_PTR(app_idx, mcl_idx);
btif_hl_mdl_cb_t *p_dcb = BTIF_HL_GET_MDL_CB_PTR(app_idx, mcl_idx, mdl_idx);
btif_hl_soc_cb_t *p_scb = NULL;
- UINT8 soc_idx;
BOOLEAN status = FALSE;
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
diff --git a/btif/src/btif_media_task.c b/btif/src/btif_media_task.c
index d1dac72..89ecddc 100644
--- a/btif/src/btif_media_task.c
+++ b/btif/src/btif_media_task.c
@@ -924,7 +924,6 @@
BOOLEAN btif_a2dp_on_started(tBTA_AV_START *p_av, BOOLEAN pending_start)
{
- tBTIF_STATUS status;
BOOLEAN ack = FALSE;
APPL_TRACE_EVENT("## ON A2DP STARTED ##");
@@ -978,8 +977,6 @@
void btif_a2dp_ack_fail(void)
{
- tBTIF_STATUS status;
-
APPL_TRACE_EVENT("## A2DP_CTRL_ACK_FAILURE ##");
a2dp_cmd_acknowledge(A2DP_CTRL_ACK_FAILURE);
}
@@ -1089,7 +1086,7 @@
int num_sbc_frames;
int num_frames_to_process;
- count = btif_media_cb.RxSbcQ.count;
+ count = btif_media_cb.RxSbcQ._count;
if (0 == count)
{
APPL_TRACE_DEBUG(" QUE EMPTY ");
@@ -1113,7 +1110,7 @@
num_sbc_frames = p_msg->num_frames_to_be_processed; /* num of frames in Que Packets */
APPL_TRACE_DEBUG(" Frames left in topmost packet %d", num_sbc_frames);
APPL_TRACE_DEBUG(" Remaining frames to process in tick %d", num_frames_to_process);
- APPL_TRACE_DEBUG(" Num of Packets in Que %d", btif_media_cb.RxSbcQ.count);
+ APPL_TRACE_DEBUG(" Num of Packets in Que %d", btif_media_cb.RxSbcQ._count);
if ( num_sbc_frames > num_frames_to_process) /* Que Packet has more frames*/
{
diff --git a/btif/src/btif_pan.c b/btif/src/btif_pan.c
index 79b1fc7..8019636 100644
--- a/btif/src/btif_pan.c
+++ b/btif/src/btif_pan.c
@@ -27,6 +27,7 @@
#include <hardware/bluetooth.h>
#include <hardware/bt_pan.h>
#include <assert.h>
+#include <string.h>
#include <signal.h>
#include <ctype.h>
#include <sys/select.h>
@@ -220,10 +221,9 @@
static bt_status_t btpan_enable(int local_role)
{
- int bta_pan_role;
- BTIF_TRACE_DEBUG("local_role:%d", local_role);
- bta_pan_role = btpan_role_to_bta(local_role);
#if BTA_PAN_INCLUDED == TRUE
+ BTIF_TRACE_DEBUG("%s - local_role: %d", __func__, local_role);
+ int bta_pan_role = btpan_role_to_bta(local_role);
BTA_PanSetRole(bta_pan_role, &bta_panu_info, NULL, &bta_pan_nap_info);
btpan_dev_local_role = local_role;
return BT_STATUS_SUCCESS;
diff --git a/btif/src/btif_profile_queue.c b/btif/src/btif_profile_queue.c
index 9fbd71a..86025ef 100644
--- a/btif/src/btif_profile_queue.c
+++ b/btif/src/btif_profile_queue.c
@@ -27,6 +27,7 @@
#include <assert.h>
#include <string.h>
#include <hardware/bluetooth.h>
+#include <string.h>
#define LOG_TAG "bt_btif_queue"
#include "btif_common.h"
diff --git a/btif/src/btif_rc.c b/btif/src/btif_rc.c
index 781de35..645bb81 100644
--- a/btif/src/btif_rc.c
+++ b/btif/src/btif_rc.c
@@ -173,11 +173,6 @@
* For now, only the rc_white_addr_prefix is used in the code while
* rc_black_addr_prefix is kept here for future long term solution.
*/
-static const UINT8 rc_black_addr_prefix[][3] = {
- {0x0, 0x18, 0x6B}, // LG HBS-730
- {0x0, 0x26, 0x7E} // VW Passat
-};
-
static const UINT8 rc_white_addr_prefix[][3] = {
{0x94, 0xCE, 0x2C}, // Sony SBH50
{0x30, 0x17, 0xC8} // Sony wm600
@@ -274,7 +269,7 @@
int uinput_create(char *name)
{
struct uinput_dev dev;
- int fd, err, x = 0;
+ int fd, x = 0;
for(x=0; x < MAX_UINPUT_PATHS; x++)
{
@@ -422,8 +417,6 @@
{
BTIF_TRACE_DEBUG("%s: rc_handle: %d", __FUNCTION__, p_rc_open->rc_handle);
bt_status_t result = BT_STATUS_SUCCESS;
- int i;
- char bd_str[18];
#if (AVRC_CTLR_INCLUDED == TRUE)
bt_bdaddr_t rc_addr;
#endif
@@ -915,7 +908,6 @@
tAVRC_RESPONSE *pmetamsg_resp)
{
UINT8 ctype;
- tAVRC_STS status;
if (!pmetamsg_resp)
{
@@ -1089,9 +1081,33 @@
}
else
{
- num_attr = pavrc_cmd->get_elem_attrs.num_attr;
- memcpy(element_attrs, pavrc_cmd->get_elem_attrs.attrs, sizeof(UINT32)
- *pavrc_cmd->get_elem_attrs.num_attr);
+ int attr_cnt, filled_attr_count;
+
+ num_attr = 0;
+ /* Attribute IDs from 1 to AVRC_MAX_NUM_MEDIA_ATTR_ID are only valid,
+ * hence HAL definition limits the attributes to AVRC_MAX_NUM_MEDIA_ATTR_ID.
+ * Fill only valid entries.
+ */
+ for (attr_cnt = 0; (attr_cnt < pavrc_cmd->get_elem_attrs.num_attr) &&
+ (num_attr < AVRC_MAX_NUM_MEDIA_ATTR_ID); attr_cnt++)
+ {
+ if ((pavrc_cmd->get_elem_attrs.attrs[attr_cnt] > 0) &&
+ (pavrc_cmd->get_elem_attrs.attrs[attr_cnt] <= AVRC_MAX_NUM_MEDIA_ATTR_ID))
+ {
+ /* Skip the duplicate entries : PTS sends duplicate entries for Fragment cases
+ */
+ for (filled_attr_count = 0; filled_attr_count < num_attr; filled_attr_count++)
+ {
+ if (element_attrs[filled_attr_count] == pavrc_cmd->get_elem_attrs.attrs[attr_cnt])
+ break;
+ }
+ if (filled_attr_count == num_attr)
+ {
+ element_attrs[num_attr] = pavrc_cmd->get_elem_attrs.attrs[attr_cnt];
+ num_attr++;
+ }
+ }
+ }
}
FILL_PDU_QUEUE(IDX_GET_ELEMENT_ATTR_RSP, ctype, label, TRUE);
HAL_CBACK(bt_rc_callbacks, get_element_attr_cb, num_attr, element_attrs);
@@ -1251,7 +1267,6 @@
uint32_t song_pos)
{
tAVRC_RESPONSE avrc_rsp;
- UINT32 i;
CHECK_RC_CONNECTED
memset(&(avrc_rsp.get_play_status), 0, sizeof(tAVRC_GET_PLAY_STATUS_RSP));
avrc_rsp.get_play_status.song_len = song_len;
@@ -1280,7 +1295,6 @@
{
tAVRC_RESPONSE avrc_rsp;
UINT32 i;
- uint8_t j;
tAVRC_ATTR_ENTRY element_attrs[BTRC_MAX_ELEM_ATTR_SIZE];
CHECK_RC_CONNECTED
memset(element_attrs, 0, sizeof(tAVRC_ATTR_ENTRY) * num_attr);
@@ -1449,8 +1463,6 @@
tAVRC_COMMAND avrc_cmd = {0};
BT_HDR *p_msg = NULL;
tAVRC_STS BldResp=AVRC_STS_BAD_CMD;
- UINT16 rv = 0;
- bt_status_t tran_status;
rc_transaction_t *p_transaction=NULL;
BTIF_TRACE_DEBUG("%s called with label:%d",__FUNCTION__,lbl);
@@ -1590,7 +1602,6 @@
key_code, key_state);
if (btif_rc_cb.rc_features & BTA_AV_FEAT_RCTG)
{
- tAVRC_MSG_PASS avrc_cmd;
bt_status_t tran_status = get_transaction(&p_transaction);
if(BT_STATUS_SUCCESS == tran_status && NULL != p_transaction)
{
diff --git a/btif/src/btif_sock_rfc.c b/btif/src/btif_sock_rfc.c
index 0ece691..43dfc56 100644
--- a/btif/src/btif_sock_rfc.c
+++ b/btif/src/btif_sock_rfc.c
@@ -83,11 +83,7 @@
static rfc_slot_t rfc_slots[MAX_RFC_CHANNEL];
static uint32_t rfc_slot_id;
static volatile int pth = -1; // poll thread handle
-#if __GLIBC__
static pthread_mutex_t slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
-#endif
static rfc_slot_t *find_free_slot(void);
static void cleanup_rfc_slot(rfc_slot_t *rs);
diff --git a/btif/src/btif_sock_sdp.c b/btif/src/btif_sock_sdp.c
index 1fcae8f..5e833a6 100644
--- a/btif/src/btif_sock_sdp.c
+++ b/btif/src/btif_sock_sdp.c
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <errno.h>
diff --git a/btif/src/btif_sock_thread.c b/btif/src/btif_sock_thread.c
index 8106013..0216f53 100644
--- a/btif/src/btif_sock_thread.c
+++ b/btif/src/btif_sock_thread.c
@@ -109,11 +109,7 @@
static inline void add_poll(int h, int fd, int type, int flags, uint32_t user_id);
-#if __GLIBC__
static pthread_mutex_t thread_slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t thread_slot_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER;
-#endif
static inline void set_socket_blocking(int s, int blocking)
{
@@ -227,7 +223,6 @@
}
int btsock_thread_create(btsock_signaled_cb callback, btsock_cmd_cb cmd_callback)
{
- int ret = FALSE;
asrt(callback || cmd_callback);
pthread_mutex_lock(&thread_slot_lock);
int h = alloc_thread_slot();
diff --git a/btif/src/btif_storage.c b/btif/src/btif_storage.c
index 56b8f5a..cd5d008 100644
--- a/btif/src/btif_storage.c
+++ b/btif/src/btif_storage.c
@@ -435,7 +435,6 @@
static bt_status_t btif_in_fetch_bonded_device(const char *bdstr)
{
BOOLEAN bt_linkkey_file_found=FALSE;
- int device_type;
LINK_KEY link_key;
size_t size = sizeof(link_key);
@@ -575,7 +574,6 @@
/* Special handling for adapter BD_ADDR and BONDED_DEVICES */
if (property->type == BT_PROPERTY_BDADDR)
{
- BD_ADDR addr;
bt_bdaddr_t *bd_addr = (bt_bdaddr_t*)property->val;
/* This has been cached in btif. Just fetch it from there */
memcpy(bd_addr, &btif_local_bd_addr, sizeof(bt_bdaddr_t));
@@ -819,7 +817,6 @@
*******************************************************************************/
bt_status_t btif_storage_load_bonded_devices(void)
{
- char *fname;
btif_bonded_devices_t bonded_devices;
uint32_t i = 0;
bt_property_t adapter_props[6];
@@ -1403,7 +1400,6 @@
{
bt_bdaddr_t bd_addr;
tBTA_HH_DEV_DSCP_INFO dscp_info;
- uint32_t i;
uint16_t attr_mask;
uint8_t sub_class;
uint8_t app_id;
@@ -1489,8 +1485,6 @@
*******************************************************************************/
bt_status_t btif_storage_remove_hid_info(bt_bdaddr_t *remote_bd_addr)
{
- char *fname;
- int ret;
bdstr_t bdstr;
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
@@ -1614,10 +1608,8 @@
BOOLEAN btif_storage_is_device_autopair_blacklisted(bt_bdaddr_t *remote_bd_addr)
{
char *token;
- int ret;
bdstr_t bdstr;
char *dev_name_str;
- uint8_t i = 0;
char value[BTIF_STORAGE_MAX_LINE_SZ];
int value_size = sizeof(value);
@@ -1719,10 +1711,7 @@
*******************************************************************************/
BOOLEAN btif_storage_is_fixed_pin_zeros_keyboard(bt_bdaddr_t *remote_bd_addr)
{
- int ret;
bdstr_t bdstr;
- char *dev_name_str;
- uint8_t i = 0;
char linebuf[BTIF_STORAGE_MAX_LINE_SZ];
bdaddr_to_string(remote_bd_addr, bdstr, sizeof(bdstr));
diff --git a/gki/Android.mk b/gki/Android.mk
index 3268540..76f5790 100644
--- a/gki/Android.mk
+++ b/gki/Android.mk
@@ -20,7 +20,6 @@
-DBOARD_HAVE_BLUETOOTH_BCM
endif
-LOCAL_PRELINK_MODULE := false
LOCAL_SRC_FILES := \
./common/gki_buffer.c \
./ulinux/gki_ulinux.c
diff --git a/hci/src/btsnoop.c b/hci/src/btsnoop.c
index d09dfcb..538fc95 100644
--- a/hci/src/btsnoop.c
+++ b/hci/src/btsnoop.c
@@ -18,6 +18,7 @@
#define LOG_TAG "bt_snoop"
+#include <arpa/inet.h>
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/hci/src/hci_layer.c b/hci/src/hci_layer.c
index d73c42d..89d5cc9 100644
--- a/hci/src/hci_layer.c
+++ b/hci/src/hci_layer.c
@@ -20,6 +20,7 @@
#include <assert.h>
#include <cutils/properties.h>
+#include <string.h>
#include <signal.h>
#include <string.h>
#include <sys/types.h>
diff --git a/hci/src/hci_packet_parser.c b/hci/src/hci_packet_parser.c
index 0af9b70..257681d 100644
--- a/hci/src/hci_packet_parser.c
+++ b/hci/src/hci_packet_parser.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#define LOG_TAG "bt_hci"
+
#include <assert.h>
#include "buffer_allocator.h"
@@ -23,6 +25,7 @@
#include "hcimsgs.h"
#include "hci_layer.h"
#include "hci_packet_parser.h"
+#include "osi/include/log.h"
static const command_opcode_t NO_OPCODE_CHECKING = 0;
@@ -45,6 +48,7 @@
uint16_t *acl_buffer_count_ptr) {
uint8_t *stream = read_command_complete_header(response, HCI_READ_BUFFER_SIZE, 5 /* bytes after */);
+ assert(stream != NULL);
STREAM_TO_UINT16(*data_size_ptr, stream);
STREAM_SKIP_UINT8(stream); // skip the sco packet length
STREAM_TO_UINT16(*acl_buffer_count_ptr, stream);
@@ -57,6 +61,7 @@
bt_version_t *bt_version) {
uint8_t *stream = read_command_complete_header(response, HCI_READ_LOCAL_VERSION_INFO, 8 /* bytes after */);
+ assert(stream != NULL);
STREAM_TO_UINT8(bt_version->hci_version, stream);
STREAM_TO_UINT16(bt_version->hci_revision, stream);
STREAM_TO_UINT8(bt_version->lmp_version, stream);
@@ -71,6 +76,7 @@
bt_bdaddr_t *address_ptr) {
uint8_t *stream = read_command_complete_header(response, HCI_READ_BD_ADDR, sizeof(bt_bdaddr_t) /* bytes after */);
+ assert(stream != NULL);
STREAM_TO_BDADDR(address_ptr->address, stream);
buffer_allocator->free(response);
@@ -82,6 +88,7 @@
size_t supported_commands_length) {
uint8_t *stream = read_command_complete_header(response, HCI_READ_LOCAL_SUPPORTED_CMDS, supported_commands_length /* bytes after */);
+ assert(stream != NULL);
STREAM_TO_ARRAY(supported_commands_ptr, stream, (int)supported_commands_length);
buffer_allocator->free(response);
@@ -95,11 +102,16 @@
size_t feature_pages_count) {
uint8_t *stream = read_command_complete_header(response, HCI_READ_LOCAL_EXT_FEATURES, 2 + sizeof(bt_device_features_t) /* bytes after */);
- STREAM_TO_UINT8(*page_number_ptr, stream);
- STREAM_TO_UINT8(*max_page_number_ptr, stream);
+ if (stream != NULL) {
+ STREAM_TO_UINT8(*page_number_ptr, stream);
+ STREAM_TO_UINT8(*max_page_number_ptr, stream);
- assert(*page_number_ptr < feature_pages_count);
- STREAM_TO_ARRAY(feature_pages[*page_number_ptr].as_array, stream, (int)sizeof(bt_device_features_t));
+ assert(*page_number_ptr < feature_pages_count);
+ STREAM_TO_ARRAY(feature_pages[*page_number_ptr].as_array, stream, (int)sizeof(bt_device_features_t));
+ } else {
+ LOG_ERROR("%s() - WARNING: READING EXTENDED FEATURES FAILED. "
+ "THIS MAY INDICATE A FIRMWARE/CONTROLLER ISSUE.", __func__);
+ }
buffer_allocator->free(response);
}
@@ -109,6 +121,7 @@
uint8_t *white_list_size_ptr) {
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_WHITE_LIST_SIZE, 1 /* byte after */);
+ assert(stream != NULL);
STREAM_TO_UINT8(*white_list_size_ptr, stream);
buffer_allocator->free(response);
@@ -120,6 +133,7 @@
uint8_t *acl_buffer_count_ptr) {
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_BUFFER_SIZE, 3 /* bytes after */);
+ assert(stream != NULL);
STREAM_TO_UINT16(*data_size_ptr, stream);
STREAM_TO_UINT8(*acl_buffer_count_ptr, stream);
@@ -132,6 +146,7 @@
size_t supported_states_size) {
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_SUPPORTED_STATES, supported_states_size /* bytes after */);
+ assert(stream != NULL);
STREAM_TO_ARRAY(supported_states, stream, (int)supported_states_size);
buffer_allocator->free(response);
@@ -142,6 +157,7 @@
bt_device_features_t *supported_features) {
uint8_t *stream = read_command_complete_header(response, HCI_BLE_READ_LOCAL_SPT_FEAT, sizeof(bt_device_features_t) /* bytes after */);
+ assert(stream != NULL);
STREAM_TO_ARRAY(supported_features->as_array, stream, (int)sizeof(bt_device_features_t));
buffer_allocator->free(response);
@@ -181,8 +197,9 @@
// Assume the next field is the status field
STREAM_TO_UINT8(status, stream);
- // Make sure it was successful
- assert(status == HCI_SUCCESS);
+
+ if (status != HCI_SUCCESS)
+ return NULL;
return stream;
}
diff --git a/main/Android.mk b/main/Android.mk
index ffb2fef..631204b 100644
--- a/main/Android.mk
+++ b/main/Android.mk
@@ -151,4 +151,7 @@
LOCAL_MULTILIB := 32
+LOCAL_CLANG_CFLAGS := -Wno-error=gnu-variable-sized-type-not-at-end
+LOCAL_CLANG_CFLAGS += -Wno-typedef-redefinition
+
include $(BUILD_SHARED_LIBRARY)
diff --git a/osi/src/alarm.c b/osi/src/alarm.c
index 225948d..1ce58bc 100644
--- a/osi/src/alarm.c
+++ b/osi/src/alarm.c
@@ -22,8 +22,9 @@
#include <errno.h>
#include <hardware/bluetooth.h>
#include <inttypes.h>
-#include <signal.h>
+#include <malloc.h>
#include <string.h>
+#include <signal.h>
#include <time.h>
#include "osi/include/alarm.h"
diff --git a/osi/src/list.c b/osi/src/list.c
index a9701aa..f5f5889 100644
--- a/osi/src/list.c
+++ b/osi/src/list.c
@@ -4,10 +4,10 @@
#include "osi/include/list.h"
#include "osi/include/osi.h"
-typedef struct list_node_t {
+struct list_node_t {
struct list_node_t *next;
void *data;
-} list_node_t;
+};
typedef struct list_t {
list_node_t *head;
diff --git a/osi/src/semaphore.c b/osi/src/semaphore.c
index b8dddcf..5ee9926 100644
--- a/osi/src/semaphore.c
+++ b/osi/src/semaphore.c
@@ -21,6 +21,7 @@
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
+#include <malloc.h>
#include <string.h>
#include <sys/eventfd.h>
diff --git a/osi/src/thread.c b/osi/src/thread.c
index 524b28d..c6c8979 100644
--- a/osi/src/thread.c
+++ b/osi/src/thread.c
@@ -20,6 +20,7 @@
#include <assert.h>
#include <errno.h>
+#include <malloc.h>
#include <pthread.h>
#include <string.h>
#include <sys/prctl.h>
diff --git a/stack/Android.mk b/stack/Android.mk
index 9a48f62..518188e 100644
--- a/stack/Android.mk
+++ b/stack/Android.mk
@@ -43,7 +43,6 @@
-DBOARD_HAVE_BLUETOOTH_BCM
endif
-LOCAL_PRELINK_MODULE:=false
LOCAL_SRC_FILES:= \
./a2dp/a2d_api.c \
./a2dp/a2d_sbc.c \
@@ -161,5 +160,9 @@
LOCAL_STATIC_LIBRARIES := libbt-hci
LOCAL_SHARED_LIBRARIES := libcutils libc
LOCAL_MULTILIB := 32
+# gnu-variable-sized-type-not-at-end is needed for a variable-size header in
+# a struct.
+# const-logical-operand is needed for code in l2c_utils.c that looks intentional.
+LOCAL_CLANG_CFLAGS += -Wno-error=gnu-variable-sized-type-not-at-end -Wno-error=constant-logical-operand
include $(BUILD_STATIC_LIBRARY)
diff --git a/stack/avct/avct_lcb_act.c b/stack/avct/avct_lcb_act.c
index 3b28146..589af0b 100644
--- a/stack/avct/avct_lcb_act.c
+++ b/stack/avct/avct_lcb_act.c
@@ -89,17 +89,35 @@
GKI_freebuf(p_lcb->p_rx_msg);
AVCT_TRACE_WARNING("Got start during reassembly");
}
- p_lcb->p_rx_msg = p_buf;
+ /* Allocate bigger buffer for reassembly. As lower layers are
+ * not aware of possible packet size after reassembly they
+ * would have allocated smaller buffer.
+ */
+ p_lcb->p_rx_msg = (BT_HDR*)GKI_getbuf(GKI_MAX_BUF_SIZE);
+ if (p_lcb->p_rx_msg == NULL)
+ {
+ AVCT_TRACE_ERROR ("Cannot alloc buffer for reassembly !!");
+ GKI_freebuf(p_buf);
+ }
+ else
+ {
+ memcpy (p_lcb->p_rx_msg, p_buf,
+ sizeof(BT_HDR) + p_buf->offset + p_buf->len);
+ /* Free original buffer */
+ GKI_freebuf(p_buf);
- /* copy first header byte over nosp */
- *(p + 1) = *p;
+ /* update p to point to new buffer */
+ p = (UINT8 *)(p_lcb->p_rx_msg + 1) + p_lcb->p_rx_msg->offset;
- /* set offset to point to where to copy next */
- p_lcb->p_rx_msg->offset += p_lcb->p_rx_msg->len;
+ /* copy first header byte over nosp */
+ *(p + 1) = *p;
- /* adjust length for packet header */
- p_lcb->p_rx_msg->len -= 1;
+ /* set offset to point to where to copy next */
+ p_lcb->p_rx_msg->offset += p_lcb->p_rx_msg->len;
+ /* adjust length for packet header */
+ p_lcb->p_rx_msg->len -= 1;
+ }
p_ret = NULL;
}
/* continue or end */
diff --git a/stack/avrc/avrc_pars_ct.c b/stack/avrc/avrc_pars_ct.c
index 143ce81..f268800 100644
--- a/stack/avrc/avrc_pars_ct.c
+++ b/stack/avrc/avrc_pars_ct.c
@@ -45,14 +45,6 @@
tAVRC_STS status = AVRC_STS_NO_ERROR;
UINT8 *p = p_msg->p_vendor_data;
UINT16 len;
- UINT8 xx, yy;
- tAVRC_NOTIF_RSP_PARAM *p_param;
- tAVRC_APP_SETTING *p_app_set;
- tAVRC_APP_SETTING_TEXT *p_app_txt;
- tAVRC_ATTR_ENTRY *p_entry;
- UINT32 *p_u32;
- UINT8 *p_u8;
- UINT16 size_needed;
UINT8 eventid=0;
BE_STREAM_TO_UINT8 (p_result->pdu, p);
diff --git a/stack/btm/btm_acl.c b/stack/btm/btm_acl.c
index 0b7204b..ba3e94b 100644
--- a/stack/btm/btm_acl.c
+++ b/stack/btm/btm_acl.c
@@ -204,7 +204,6 @@
UINT16 hci_handle, UINT8 link_role, tBT_TRANSPORT transport)
{
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
- UINT8 yy;
tACL_CONN *p;
UINT8 xx;
@@ -1631,8 +1630,6 @@
BOOLEAN BTM_TryAllocateSCN(UINT8 scn)
{
- UINT8 x;
-
/* Make sure we don't exceed max port range.
* Stack reserves scn 1 for HFP, HSP we still do the correct way.
*/
diff --git a/stack/btm/btm_ble.c b/stack/btm/btm_ble.c
index ec09a99..7c52a7c 100644
--- a/stack/btm/btm_ble.c
+++ b/stack/btm/btm_ble.c
@@ -694,7 +694,6 @@
void btm_ble_test_command_complete(UINT8 *p)
{
tBTM_CMPL_CB *p_cb = btm_cb.devcb.p_le_test_cmd_cmpl_cb;
- UINT8 status;
btm_cb.devcb.p_le_test_cmd_cmpl_cb = NULL;
diff --git a/stack/btm/btm_ble_batchscan.c b/stack/btm/btm_ble_batchscan.c
index 24d1df5..d8add82 100644
--- a/stack/btm/btm_ble_batchscan.c
+++ b/stack/btm/btm_ble_batchscan.c
@@ -359,7 +359,6 @@
UINT8 *p = p_params->p_param_buf;
UINT16 len = p_params->param_len;
tBTM_BLE_REF_VALUE ref_value = 0;
- int index = 0;
UINT8 status = 0, subcode = 0, opcode = 0;
UINT8 report_format = 0, num_records = 0, cb_evt = 0;
@@ -842,7 +841,7 @@
tBTM_STATUS status = BTM_NO_RESOURCES;
tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
UINT8 read_scan_mode = 0;
- UINT8 *p_data = NULL, report_format = 0, num_records = 0;
+ UINT8 *p_data = NULL, num_records = 0;
UINT16 data_len = 0;
BTM_TRACE_EVENT (" BTM_BleReadScanReports; %d, %d", scan_mode, ref_value);
diff --git a/stack/btm/btm_ble_gap.c b/stack/btm/btm_ble_gap.c
index fa1d201..bf4765a 100644
--- a/stack/btm/btm_ble_gap.c
+++ b/stack/btm/btm_ble_gap.c
@@ -56,8 +56,9 @@
#define MIN_ADV_LENGTH 2
#define BTM_NEW_VSC_CHIP_CAPBLTY_RSP_LEN 13
-static tBTM_BLE_VSC_CB cmn_ble_vsc_cb;
+#if BLE_VND_INCLUDED == TRUE
static tBTM_BLE_CTRL_FEATURES_CBACK *p_ctrl_le_feature_rd_cmpl_cback = NULL;
+#endif
/*******************************************************************************
** Local functions
@@ -424,6 +425,7 @@
return status;
}
+#if BLE_VND_INCLUDED == TRUE
/*******************************************************************************
**
** Function btm_vsc_brcm_features_complete
@@ -435,7 +437,6 @@
*******************************************************************************/
static void btm_ble_vendor_capability_vsc_cmpl_cback (tBTM_VSC_CMPL *p_vcs_cplt_params)
{
-#if BLE_VND_INCLUDED == TRUE
UINT8 status = 0xFF, *p;
BTM_TRACE_DEBUG("btm_ble_vendor_capability_vsc_cmpl_cback");
@@ -487,11 +488,8 @@
if (p_ctrl_le_feature_rd_cmpl_cback != NULL)
p_ctrl_le_feature_rd_cmpl_cback(status);
-
-#else
- UNUSED(p_vcs_cplt_params);
-#endif
}
+#endif
/*******************************************************************************
**
@@ -3140,8 +3138,6 @@
BOOLEAN btm_ble_topology_check(tBTM_BLE_STATE_MASK request_state_mask)
{
BOOLEAN rt = FALSE;
- UINT32 llt_mask = 0;
- UINT8 *p;
UINT8 state_offset = 0;
UINT16 cur_states = btm_cb.ble_ctr_cb.cur_states;
diff --git a/stack/btm/btm_ble_multi_adv.c b/stack/btm/btm_ble_multi_adv.c
index e980086..74bef42 100644
--- a/stack/btm/btm_ble_multi_adv.c
+++ b/stack/btm/btm_ble_multi_adv.c
@@ -380,7 +380,6 @@
void btm_ble_multi_adv_gen_rpa_cmpl(tBTM_RAND_ENC *p)
{
#if (SMP_INCLUDED == TRUE)
- tBTM_LE_RANDOM_CB *p_cb = &btm_cb.ble_ctr_cb.addr_mgnt_cb;
tSMP_ENC output;
UINT8 index = 0;
tBTM_BLE_MULTI_ADV_INST *p_inst = NULL;
diff --git a/stack/btm/btm_inq.c b/stack/btm/btm_inq.c
index 2307051..5311436 100644
--- a/stack/btm/btm_inq.c
+++ b/stack/btm/btm_inq.c
@@ -2357,7 +2357,7 @@
/* Note: If part of the inquiry, the name is not stored, and the */
/* inquiry complete callback is called. */
- if ((hci_status == HCI_SUCCESS))
+ if (hci_status == HCI_SUCCESS)
{
/* Copy the name from the data stream into the return structure */
/* Note that even if it is not being returned, it is used as a */
diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c
index af76151..68eecc5 100644
--- a/stack/btm/btm_sec.c
+++ b/stack/btm/btm_sec.c
@@ -5369,7 +5369,7 @@
return("???");
#else
- sprintf(btm_cb.state_temp_buffer,"%hu",state);
+ sprintf(btm_cb.state_temp_buffer,"%hhu",state);
return(btm_cb.state_temp_buffer);
#endif
diff --git a/stack/btu/btu_hcif.c b/stack/btu/btu_hcif.c
index c8a45d3..e0b0b6a 100644
--- a/stack/btu/btu_hcif.c
+++ b/stack/btu/btu_hcif.c
@@ -371,7 +371,9 @@
btu_hcif_command_status_evt,
vsc_callback);
+#if (defined(HCILP_INCLUDED) && HCILP_INCLUDED == TRUE)
btu_check_bt_sleep ();
+#endif
}
diff --git a/stack/gatt/gatt_sr.c b/stack/gatt/gatt_sr.c
index 5f9ddf0..ecf2427 100755
--- a/stack/gatt/gatt_sr.c
+++ b/stack/gatt/gatt_sr.c
@@ -123,7 +123,7 @@
static BOOLEAN process_read_multi_rsp (tGATT_SR_CMD *p_cmd, tGATT_STATUS status,
tGATTS_RSP *p_msg, UINT16 mtu)
{
- tGATTS_RSP *p_rsp;
+ tGATTS_RSP *p_rsp = NULL;
UINT16 ii, total_len, len;
BT_HDR *p_buf = (BT_HDR *)GKI_getbuf((UINT16)sizeof(tGATTS_RSP));
UINT8 *p;
@@ -332,7 +332,6 @@
{
UINT8 *p = p_data, flag, i = 0;
UINT32 trans_id = 0;
- BT_HDR *p_buf;
tGATT_IF gatt_if;
UINT16 conn_id;
diff --git a/stack/l2cap/l2c_api.c b/stack/l2cap/l2c_api.c
index f717b1e..667f717 100644
--- a/stack/l2cap/l2c_api.c
+++ b/stack/l2cap/l2c_api.c
@@ -1380,7 +1380,6 @@
{
tL2C_LCB *p_lcb;
tBT_TRANSPORT transport = BT_TRANSPORT_BR_EDR;
- UINT16 reason;
L2CAP_TRACE_API ("L2CA_ConnectFixedChnl() CID: 0x%04x BDA: %08x%04x", fixed_cid,
(rem_bda[0]<<24)+(rem_bda[1]<<16)+(rem_bda[2]<<8)+rem_bda[3], (rem_bda[4]<<8)+rem_bda[5]);
diff --git a/stack/l2cap/l2c_main.c b/stack/l2cap/l2c_main.c
index 02f12a7..8da881c 100755
--- a/stack/l2cap/l2c_main.c
+++ b/stack/l2cap/l2c_main.c
@@ -322,7 +322,7 @@
tL2CAP_CFG_INFO cfg_info;
UINT16 rej_reason, rej_mtu, lcid, rcid, info_type;
tL2C_CCB *p_ccb;
- tL2C_RCB *p_rcb, *p_rcb2;
+ tL2C_RCB *p_rcb;
BOOLEAN cfg_rej, pkt_size_rej = FALSE;
UINT16 cfg_rej_len, cmd_len;
UINT16 result;
diff --git a/stack/mcap/mca_dact.c b/stack/mcap/mca_dact.c
index d30db79..6700dd7 100644
--- a/stack/mcap/mca_dact.c
+++ b/stack/mcap/mca_dact.c
@@ -22,6 +22,7 @@
* Functions.
*
******************************************************************************/
+
#include <stddef.h>
#include "bt_target.h"
#include "bt_utils.h"
diff --git a/stack/pan/pan_utils.c b/stack/pan/pan_utils.c
index 7a550fa..3c1f8b3 100644
--- a/stack/pan/pan_utils.c
+++ b/stack/pan/pan_utils.c
@@ -63,7 +63,6 @@
UINT32 sdp_handle;
UINT16 browse_list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
UINT16 security = 0;
- UINT8 availability;
UINT32 proto_len = (UINT32)pan_proto_elem_data[1];
/* Create a record */
diff --git a/stack/rfcomm/port_api.c b/stack/rfcomm/port_api.c
index f1225c0..3f38a71 100644
--- a/stack/rfcomm/port_api.c
+++ b/stack/rfcomm/port_api.c
@@ -1523,7 +1523,6 @@
UINT16 length;
RFCOMM_TRACE_API ("PORT_WriteDataCO() handle:%d", handle);
- int written;
*p_len = 0;
/* Check if handle is valid to avoid crashing */
diff --git a/stack/rfcomm/rfc_ts_frames.c b/stack/rfcomm/rfc_ts_frames.c
index f546e16..8120893 100644
--- a/stack/rfcomm/rfc_ts_frames.c
+++ b/stack/rfcomm/rfc_ts_frames.c
@@ -21,6 +21,7 @@
* This file contains functions to send TS 07.10 frames
*
******************************************************************************/
+
#include <stddef.h>
#include "bt_target.h"
#include "btcore/include/counter.h"
diff --git a/stack/sdp/sdp_api.c b/stack/sdp/sdp_api.c
index 890f808..6e84ded 100644
--- a/stack/sdp/sdp_api.c
+++ b/stack/sdp/sdp_api.c
@@ -425,7 +425,7 @@
BOOLEAN SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC *p_rec, tBT_UUID * p_uuid)
{
#if SDP_CLIENT_ENABLED == TRUE
- tSDP_DISC_ATTR *p_attr, *p_sattr, *p_extra_sattr;
+ tSDP_DISC_ATTR *p_attr, *p_sattr;
p_attr = p_rec->p_first_attr;
@@ -590,7 +590,7 @@
{
#if SDP_CLIENT_ENABLED == TRUE
tSDP_DISC_REC *p_rec;
- tSDP_DISC_ATTR *p_attr, *p_sattr, *p_extra_sattr;
+ tSDP_DISC_ATTR *p_attr, *p_sattr;
/* Must have a valid database */
if (p_db == NULL)
diff --git a/stack/sdp/sdp_discovery.c b/stack/sdp/sdp_discovery.c
index c56459d..646a62d 100644
--- a/stack/sdp/sdp_discovery.c
+++ b/stack/sdp/sdp_discovery.c
@@ -352,7 +352,6 @@
UINT32 list_len;
UINT8 *p;
UINT8 type;
- UINT32 delta_len = 0;
#if (SDP_DEBUG_RAW == TRUE)
UINT8 num_array[SDP_MAX_LIST_BYTE_COUNT];
diff --git a/stack/sdp/sdp_server.c b/stack/sdp/sdp_server.c
index de128a6..e11e602 100644
--- a/stack/sdp/sdp_server.c
+++ b/stack/sdp/sdp_server.c
@@ -241,6 +241,7 @@
{
rem_handles = num_rsp_handles;
cont_offset = 0;
+ p_ccb->cont_offset = 0;
}
/* Calculate how many handles will fit in one PDU */
diff --git a/stack/smp/smp_keys.c b/stack/smp/smp_keys.c
index 31313c9..ec7d129 100644
--- a/stack/smp/smp_keys.c
+++ b/stack/smp/smp_keys.c
@@ -53,21 +53,6 @@
static void smp_process_compare(tSMP_CB *p_cb, tSMP_ENC *p);
static void smp_process_ediv(tSMP_CB *p_cb, tSMP_ENC *p);
-static const tSMP_ACT smp_encrypt_action[] =
-{
- smp_generate_compare, /* SMP_GEN_COMPARE */
- smp_genenrate_confirm, /* SMP_GEN_CONFIRM*/
- smp_generate_stk, /* SMP_GEN_STK*/
- smp_genenrate_ltk_cont, /* SMP_GEN_LTK */
- smp_generate_ltk, /* SMP_GEN_DIV_LTK */
- smp_generate_rand_vector, /* SMP_GEN_RAND_V */
- smp_generate_y, /* SMP_GEN_EDIV */
- smp_generate_passkey, /* SMP_GEN_TK */
- smp_generate_confirm, /* SMP_GEN_SRAND_MRAND */
- smp_genenrate_rand_cont /* SMP_GEN_SRAND_MRAND_CONT */
-};
-
-
#define SMP_PASSKEY_MASK 0xfff00000
#if SMP_DEBUG == TRUE
diff --git a/test/bluedroidtest/Android.mk b/test/bluedroidtest/Android.mk
index 8196546..2aa3bb2 100644
--- a/test/bluedroidtest/Android.mk
+++ b/test/bluedroidtest/Android.mk
@@ -33,7 +33,6 @@
LOCAL_MODULE:= bdt
LOCAL_SHARED_LIBRARIES += libcutils \
- libutils \
libhardware \
libhardware_legacy
diff --git a/test/suite/base.h b/test/suite/base.h
index 0aa7979..935ff17 100644
--- a/test/suite/base.h
+++ b/test/suite/base.h
@@ -18,6 +18,7 @@
#pragma once
+#include <malloc.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
diff --git a/tools/bdtool/Android.mk b/tools/bdtool/Android.mk
index afeb071..7ed5c4a 100644
--- a/tools/bdtool/Android.mk
+++ b/tools/bdtool/Android.mk
@@ -25,6 +25,7 @@
adapter.c \
bdtool.c \
../../test/suite/support/callbacks.c \
+ ../../test/suite/support/gatt.c \
../../test/suite/support/hal.c \
../../test/suite/support/pan.c
diff --git a/udrv/ulinux/uipc.c b/udrv/ulinux/uipc.c
index 36e37fc..c3f8527 100644
--- a/udrv/ulinux/uipc.c
+++ b/udrv/ulinux/uipc.c
@@ -706,7 +706,6 @@
BOOLEAN UIPC_Send(tUIPC_CH_ID ch_id, UINT16 msg_evt, UINT8 *p_buf,
UINT16 msglen)
{
- int n;
UNUSED(msg_evt);
BTIF_TRACE_DEBUG("UIPC_Send : ch_id:%d %d bytes", ch_id, msglen);
diff --git a/utils/Android.mk b/utils/Android.mk
index 6425802..8e3fe39 100644
--- a/utils/Android.mk
+++ b/utils/Android.mk
@@ -12,7 +12,6 @@
LOCAL_CFLAGS += $(bdroid_CFLAGS) -std=c99
-LOCAL_PRELINK_MODULE :=false
LOCAL_SRC_FILES := \
./src/bt_utils.c
diff --git a/vnd/ble/vendor_ble.c b/vnd/ble/vendor_ble.c
index 72c50b3..c23d0bc 100644
--- a/vnd/ble/vendor_ble.c
+++ b/vnd/ble/vendor_ble.c
@@ -40,8 +40,6 @@
tBTM_BLE_VENDOR_CB btm_ble_vendor_cb;
#endif
-static const BD_ADDR na_bda= {0};
-
/*******************************************************************************
** Resolve Address Using IRK List functions
*******************************************************************************/
@@ -664,7 +662,6 @@
#if BLE_PRIVACY_SPT == TRUE
UINT8 param[20], *p;
tBTM_STATUS st = BTM_WRONG_MODE;
- tBTM_BLE_PF_COUNT *p_bda_filter;
if (btm_cb.cmn_ble_vsc_cb.max_irk_list_sz == 0)
return BTM_MODE_UNSUPPORTED;