summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk4
-rw-r--r--audio_a2dp_hw/Android.mk4
-rw-r--r--audio_a2dp_hw/audio_a2dp_hw.c11
-rw-r--r--audio_a2dp_hw/audio_a2dp_hw.h7
-rw-r--r--bta/ag/bta_ag_sco.c10
-rw-r--r--bta/ag/bta_ag_sdp.c18
-rw-r--r--bta/av/bta_av_aact.c2
-rw-r--r--bta/dm/bta_dm_act.c21
-rw-r--r--bta/dm/bta_dm_api.c6
-rw-r--r--bta/dm/bta_dm_main.c1
-rw-r--r--bta/dm/bta_dm_pm.c1
-rw-r--r--bta/hf_client/bta_hf_client_main.c6
-rw-r--r--bta/hh/bta_hh_le.c3
-rw-r--r--btif/co/bta_av_co.c5
-rw-r--r--btif/co/bta_hh_co.c3
-rw-r--r--btif/include/btif_gatt_multi_adv_util.h2
-rw-r--r--btif/include/btif_storage.h12
-rw-r--r--btif/src/bluetooth.c5
-rw-r--r--btif/src/btif_config.c1
-rw-r--r--btif/src/btif_core.c27
-rw-r--r--btif/src/btif_dm.c47
-rw-r--r--btif/src/btif_gap.c3
-rw-r--r--btif/src/btif_gatt_qual.c26
-rw-r--r--btif/src/btif_hf.c2
-rw-r--r--btif/src/btif_media_task.c14
-rw-r--r--btif/src/btif_rc.c6
-rw-r--r--btif/src/btif_smp.c2
-rw-r--r--btif/src/btif_storage.c33
-rw-r--r--device/include/interop.h4
-rw-r--r--device/include/interop_database.h32
-rw-r--r--device/src/interop.c1
-rw-r--r--hci/Android.mk6
-rw-r--r--hci/include/hci_internals.h6
-rw-r--r--hci/include/low_power_manager.h3
-rw-r--r--hci/src/hci_layer.c8
-rw-r--r--hci/src/low_power_manager.c20
-rw-r--r--hci/src/packet_fragmenter.c2
-rw-r--r--include/bt_target.h14
-rw-r--r--include/bt_testapp.h2
-rw-r--r--main/Android.mk4
-rw-r--r--osi/src/alarm.c11
-rw-r--r--stack/btm/btm_acl.c5
-rw-r--r--stack/btm/btm_dev.c4
-rw-r--r--stack/btm/btm_int.h5
-rw-r--r--stack/btm/btm_sec.c46
-rw-r--r--stack/l2cap/l2c_link.c6
-rw-r--r--stack/rfcomm/rfc_mx_fsm.c1
-rw-r--r--stack/smp/smp_act.c3
-rw-r--r--test/blegatt_test/gatt_test.c23
49 files changed, 363 insertions, 125 deletions
diff --git a/Android.mk b/Android.mk
index 7b6c036df..b39813227 100644
--- a/Android.mk
+++ b/Android.mk
@@ -10,7 +10,7 @@ else
endif
ifeq ($(TARGET_BUILD_VARIANT),userdebug)
-ifneq ($(BOARD_HAS_QCA_BT_ROME),true))
+ifneq ($(BOARD_HAS_QCA_BT_ROME),true)
bdroid_CFLAGS += -DQLOGKIT_USERDEBUG
endif
endif
@@ -19,7 +19,7 @@ ifneq ($(BOARD_BLUETOOTH_BDROID_HCILP_INCLUDED),)
bdroid_CFLAGS += -DHCILP_INCLUDED=$(BOARD_BLUETOOTH_BDROID_HCILP_INCLUDED)
endif
-ifneq ($(TARGET_BUILD_VARIANT),user)
+ifeq ($(TARGET_BUILD_VARIANT),eng)
bdroid_CFLAGS += -DBLUEDROID_DEBUG
bdroid_CFLAGS += -DUSE_AUDIO_TRACK
endif
diff --git a/audio_a2dp_hw/Android.mk b/audio_a2dp_hw/Android.mk
index 959c255d2..39253bca8 100644
--- a/audio_a2dp_hw/Android.mk
+++ b/audio_a2dp_hw/Android.mk
@@ -2,6 +2,10 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+ifeq ($(BOARD_USES_LEGACY_ALSA_AUDIO),true)
+ LOCAL_CFLAGS += -DSAMPLE_RATE_48K
+endif
+
LOCAL_SRC_FILES := \
audio_a2dp_hw.c
diff --git a/audio_a2dp_hw/audio_a2dp_hw.c b/audio_a2dp_hw/audio_a2dp_hw.c
index 19f7dfd04..1933d5a75 100644
--- a/audio_a2dp_hw/audio_a2dp_hw.c
+++ b/audio_a2dp_hw/audio_a2dp_hw.c
@@ -196,7 +196,7 @@ static void ts_error_log(char *tag, int val, int buff_size, struct a2dp_config c
prev = now;
if(diff_us > (calc_audiotime (cfg, buff_size) + 10000L))
{
- ERROR("[%s] ts %08lld, diff %08lld, val %d %d", tag, now_us, diff_us, val, buff_size);
+ DEBUG("[%s] ts %08lld, diff %08lld, val %d %d", tag, now_us, diff_us, val, buff_size);
}
}
@@ -714,8 +714,7 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
}
#endif
- if (sent == -1)
- {
+ if (sent == -1) {
skt_disconnect(out->common.audio_fd);
out->common.audio_fd = AUDIO_SKT_DISCONNECTED;
if (out->common.state != AUDIO_A2DP_STATE_SUSPENDED)
@@ -764,7 +763,7 @@ static size_t out_get_buffer_size(const struct audio_stream *stream)
{
struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream;
- INFO("buffer_size : %zu", out->common.buffer_sz);
+ DEBUG("buffer_size : %zu", out->common.buffer_sz);
return out->common.buffer_sz;
}
@@ -773,7 +772,7 @@ static uint32_t out_get_channels(const struct audio_stream *stream)
{
struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream;
- INFO("channels 0x%" PRIx32, out->common.cfg.channel_flags);
+ DEBUG("channels 0x%" PRIx32, out->common.cfg.channel_flags);
return out->common.cfg.channel_flags;
}
@@ -781,7 +780,7 @@ static uint32_t out_get_channels(const struct audio_stream *stream)
static audio_format_t out_get_format(const struct audio_stream *stream)
{
struct a2dp_stream_out *out = (struct a2dp_stream_out *)stream;
- INFO("format 0x%x", out->common.cfg.format);
+ DEBUG("format 0x%x", out->common.cfg.format);
return out->common.cfg.format;
}
diff --git a/audio_a2dp_hw/audio_a2dp_hw.h b/audio_a2dp_hw/audio_a2dp_hw.h
index a97b4c855..eaade32b3 100644
--- a/audio_a2dp_hw/audio_a2dp_hw.h
+++ b/audio_a2dp_hw/audio_a2dp_hw.h
@@ -1,6 +1,7 @@
/******************************************************************************
*
* Copyright (C) 2009-2012 Broadcom Corporation
+ * Copyright (c) 2013, Linux Foundation. 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.
@@ -35,10 +36,10 @@
#define A2DP_CTRL_PATH "/data/misc/bluedroid/.a2dp_ctrl"
#define A2DP_DATA_PATH "/data/misc/bluedroid/.a2dp_data"
-#ifndef BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ
-#define AUDIO_STREAM_DEFAULT_RATE 44100
-#else
+#if defined(SAMPLE_RATE_48K) || defined(BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ)
#define AUDIO_STREAM_DEFAULT_RATE 48000
+#else
+#define AUDIO_STREAM_DEFAULT_RATE 44100
#endif
#define AUDIO_STREAM_DEFAULT_FORMAT AUDIO_FORMAT_PCM_16_BIT
#define AUDIO_STREAM_DEFAULT_CHANNEL_FLAG AUDIO_CHANNEL_OUT_STEREO
diff --git a/bta/ag/bta_ag_sco.c b/bta/ag/bta_ag_sco.c
index abafbe3e1..602999698 100644
--- a/bta/ag/bta_ag_sco.c
+++ b/bta/ag/bta_ag_sco.c
@@ -288,12 +288,11 @@ static void bta_ag_sco_disc_cback(UINT16 sco_idx)
bta_ag_cb.sco.p_curr_scb->codec_msbc_settings = BTA_AG_SCO_MSBC_SETTINGS_T1;
}
else
-#else
+#endif
{
APPL_TRACE_DEBUG("Fallback to CVSD settings");
bta_ag_cb.sco.p_curr_scb->codec_fallback = TRUE;
}
-#endif
}
}
@@ -632,6 +631,13 @@ static void bta_ag_create_sco(tBTA_AG_SCB *p_scb, BOOLEAN is_orig)
#endif
+#if (I2SPCM_SLAVE_BRCM == TRUE )
+ /* Configure I2SPCM slave path */
+ UINT8 cmd_buf[4] = { 0, 0, 0, 1 };
+ BTM_VendorSpecificCommand(109, 4, (UINT8 *)&cmd_buf, 0);
+ BTM_WriteVoiceSettings (BTM_VOICE_SETTING_CVSD);
+#endif
+
#if (BTM_SCO_HCI_INCLUDED == TRUE )
/* initialize SCO setup, no voice setting for AG, data rate <==> sample rate */
BTM_ConfigScoPath(sco_route, bta_ag_sco_read_cback, NULL, TRUE);
diff --git a/bta/ag/bta_ag_sdp.c b/bta/ag/bta_ag_sdp.c
index 0269258a2..cfddb7439 100644
--- a/bta/ag/bta_ag_sdp.c
+++ b/bta/ag/bta_ag_sdp.c
@@ -367,11 +367,29 @@ BOOLEAN bta_ag_sdp_find_attr(tBTA_AG_SCB *p_scb, tBTA_SERVICE_MASK service)
{
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SUPPORTED_FEATURES)) != NULL)
{
+ /* Do not use the value as peer_features.
+ ** Reason is, that the service connection negotiation depends on the
+ ** BTA_AG_FEAT_3WAY feature (see the calling of bta_ag_svc_conn_open()
+ ** for BTA_AG_HF_CMD_CMER). A race condition could result in erratic
+ ** behavior.
+ **
+ ** Background: Using the attr_value for peer_feature was a change introduced
+ ** in android 4.2. That version triggered a number of bug-reports about
+ ** bluetooth being broken.
+ **
+ ** This problem was observed first hand on a BMW 2005/E46 car kit which does
+ ** not send AT+BRSF and behaves as if it would not support 3WAY. With the newly
+ ** introduced code for using attr_value as peer_feature the result was that
+ ** bluetooth connections to the car kit always terminated after 5 seconds
+ ** (via BTA_AG_SVC_TOUT_EVT).
+ */
+#if 0
/* Found attribute. Get value. */
/* There might be race condition between SDP and BRSF. */
/* Do not update if we already received BRSF. */
if (p_scb->peer_features == 0)
p_scb->peer_features = p_attr->attr_value.v.u16;
+#endif
}
}
else /* HSP */
diff --git a/bta/av/bta_av_aact.c b/bta/av/bta_av_aact.c
index 94ca7d981..6c87309b4 100644
--- a/bta/av/bta_av_aact.c
+++ b/bta/av/bta_av_aact.c
@@ -581,7 +581,7 @@ static void bta_av_proc_stream_evt(UINT8 handle, BD_ADDR bd_addr, UINT8 event, t
}
else
{
- APPL_TRACE_ERROR("%s: p_data is null", __func__);
+ APPL_TRACE_DEBUG("%s: p_data is null", __func__);
}
}
diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c
index 7fc46abaa..f3500c554 100644
--- a/bta/dm/bta_dm_act.c
+++ b/bta/dm/bta_dm_act.c
@@ -547,17 +547,23 @@ void bta_dm_set_dev_name (tBTA_DM_MSG *p_data)
void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
{
UINT16 window, interval;
+#if BLE_INCLUDED == TRUE
UINT16 le_disc_mode = BTM_BleReadDiscoverability();
+#endif
UINT16 disc_mode = BTM_ReadDiscoverability(&window, &interval);
+#if BLE_INCLUDED == TRUE
UINT16 le_conn_mode = BTM_BleReadConnectability();
+#endif
UINT16 conn_mode = BTM_ReadConnectability(&window, &interval);
/* set modes for Discoverability and connectability if not ignore */
if (p_data->set_visibility.disc_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE))
{
+#if BLE_INCLUDED == TRUE
if ((p_data->set_visibility.disc_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
p_data->set_visibility.disc_mode =
((p_data->set_visibility.disc_mode & ~BTA_DM_LE_IGNORE) | le_disc_mode);
+#endif
if ((p_data->set_visibility.disc_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
p_data->set_visibility.disc_mode =
@@ -570,9 +576,11 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
if (p_data->set_visibility.conn_mode != (BTA_DM_IGNORE | BTA_DM_LE_IGNORE))
{
+#if BLE_INCLUDED == TRUE
if ((p_data->set_visibility.conn_mode & BTA_DM_LE_IGNORE) == BTA_DM_LE_IGNORE)
p_data->set_visibility.conn_mode =
((p_data->set_visibility.conn_mode & ~BTA_DM_LE_IGNORE) | le_conn_mode);
+#endif
if ((p_data->set_visibility.conn_mode & BTA_DM_IGNORE) == BTA_DM_IGNORE)
p_data->set_visibility.conn_mode =
@@ -608,7 +616,6 @@ void bta_dm_set_visibility(tBTA_DM_MSG *p_data)
/* Change mode if either mode is not ignore */
if (p_data->set_visibility.pair_mode != BTA_DM_IGNORE || p_data->set_visibility.conn_paired_only != BTA_DM_IGNORE)
BTM_SetPairableMode((BOOLEAN)(!(bta_dm_cb.disable_pair_mode)),bta_dm_cb.conn_paired_only);
-
}
/*******************************************************************************
@@ -715,16 +722,17 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
if (!bdcmp(bta_dm_cb.device_list.peer_device[i].peer_bdaddr, p_dev->bd_addr))
{
bta_dm_cb.device_list.peer_device[i].conn_state = BTA_DM_UNPAIRING;
+#if BTA_GATT_INCLUDED == TRUE
btm_remove_acl( p_dev->bd_addr, bta_dm_cb.device_list.peer_device[i].transport);
APPL_TRACE_DEBUG("%s:transport = %d", __func__,
bta_dm_cb.device_list.peer_device[i].transport);
-
/* save the other transport to check if device is connected on other_transport */
if(bta_dm_cb.device_list.peer_device[i].transport == BT_TRANSPORT_LE)
other_transport = BT_TRANSPORT_BR_EDR;
else
other_transport = BT_TRANSPORT_LE;
break;
+#endif
}
}
}
@@ -736,6 +744,7 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
// If it is DUMO device and device is paired as different address, unpair that device
// if different address
BOOLEAN continue_delete_other_dev = FALSE;
+#if BTA_GATT_INCLUDED == TRUE
if ((other_transport && (BTM_ReadConnectedTransportAddress(other_address, other_transport))) ||
(!other_transport && (BTM_ReadConnectedTransportAddress(other_address, BT_TRANSPORT_INVALID))))
{
@@ -746,7 +755,9 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
if (!bdcmp(bta_dm_cb.device_list.peer_device[i].peer_bdaddr, other_address))
{
bta_dm_cb.device_list.peer_device[i].conn_state = BTA_DM_UNPAIRING;
+#if BTA_GATT_INCLUDED == TRUE
btm_remove_acl(other_address,bta_dm_cb.device_list.peer_device[i].transport);
+#endif
break;
}
}
@@ -756,7 +767,7 @@ void bta_dm_remove_device(tBTA_DM_MSG *p_data)
APPL_TRACE_DEBUG("%s: continue to delete the other dev ", __func__);
continue_delete_other_dev = TRUE;
}
-
+#endif
/* Delete the device mentioned in the msg */
if (continue_delete_dev)
bta_dm_process_remove_device(p_dev->bd_addr);
@@ -2361,7 +2372,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
APPL_TRACE_DEBUG("%s appl_knows_rem_name %d", __func__,
bta_dm_search_cb.p_btm_inq_info->appl_knows_rem_name);
}
-
+#if BTA_GATT_INCLUDED == TRUE
if((bta_dm_search_cb.p_btm_inq_info)
&& (bta_dm_search_cb.p_btm_inq_info->results.device_type == BT_DEVICE_TYPE_BLE)
&& (bta_dm_search_cb.state == BTA_DM_SEARCH_ACTIVE))
@@ -2369,7 +2380,7 @@ static void bta_dm_discover_device(BD_ADDR remote_bd_addr)
/* Do not perform RNR for LE devices at inquiry complete*/
bta_dm_search_cb.name_discover_done = TRUE;
}
-
+#endif
/* if name discovery is not done and application needs remote name */
if ((!bta_dm_search_cb.name_discover_done)
&& (( bta_dm_search_cb.p_btm_inq_info == NULL )
diff --git a/bta/dm/bta_dm_api.c b/bta/dm/bta_dm_api.c
index 674cd21ef..b669a5864 100644
--- a/bta/dm/bta_dm_api.c
+++ b/bta/dm/bta_dm_api.c
@@ -1008,6 +1008,7 @@ void BTA_DmSetBlePrefConnParams(BD_ADDR bd_addr,
*******************************************************************************/
void BTA_DmSetBleConnScanParams(UINT32 scan_interval, UINT32 scan_window)
{
+#if BTA_GATT_INCLUDED == TRUE
tBTA_DM_API_BLE_SCAN_PARAMS *p_msg;
if ((p_msg = (tBTA_DM_API_BLE_SCAN_PARAMS *)GKI_getbuf(sizeof(tBTA_DM_API_BLE_SCAN_PARAMS))) != NULL)
{
@@ -1017,8 +1018,9 @@ void BTA_DmSetBleConnScanParams(UINT32 scan_interval, UINT32 scan_window)
p_msg->scan_window = scan_window;
bta_sys_sendmsg(p_msg);
}
+#endif
}
-
+#if BTA_GATT_INCLUDED == TRUE
/*******************************************************************************
**
** Function BTA_DmSetBleScanParams
@@ -1053,7 +1055,7 @@ void BTA_DmSetBleScanParams(tGATT_IF client_if, UINT32 scan_interval,
bta_sys_sendmsg(p_msg);
}
}
-
+#endif
/*******************************************************************************
**
** Function BTA_DmSetBleAdvParams
diff --git a/bta/dm/bta_dm_main.c b/bta/dm/bta_dm_main.c
index 93cd90fe8..fb3123e6e 100644
--- a/bta/dm/bta_dm_main.c
+++ b/bta/dm/bta_dm_main.c
@@ -351,7 +351,6 @@ BOOLEAN bta_dm_search_sm_execute(BT_HDR *p_msg)
APPL_TRACE_EVENT("bta_dm_search_sm_execute state:%d, event:0x%x",
bta_dm_search_cb.state, p_msg->event);
-
/* look up the state table for the current state */
state_table = bta_dm_search_st_tbl[bta_dm_search_cb.state];
diff --git a/bta/dm/bta_dm_pm.c b/bta/dm/bta_dm_pm.c
index a73e04e43..83d72b3bc 100644
--- a/bta/dm/bta_dm_pm.c
+++ b/bta/dm/bta_dm_pm.c
@@ -317,6 +317,7 @@ static void bta_dm_pm_stop_timer_by_index(tBTA_PM_TIMER *p_timer,
assert(p_timer->in_use && (p_timer->active > 0));
+ APPL_TRACE_DEBUG("%s: id: %d", __func__, timer_idx);
bta_sys_stop_timer(&p_timer->timer[timer_idx]);
p_timer->srvc_id[timer_idx] = BTA_ID_MAX;
/* NOTE: pm_action[timer_idx] intentionally not reset */
diff --git a/bta/hf_client/bta_hf_client_main.c b/bta/hf_client/bta_hf_client_main.c
index f5244b78c..4c01e47cf 100644
--- a/bta/hf_client/bta_hf_client_main.c
+++ b/bta/hf_client/bta_hf_client_main.c
@@ -573,7 +573,8 @@ void bta_hf_client_slc_seq(BOOLEAN error)
break;
case BTA_HF_CLIENT_AT_BRSF:
- if (bta_hf_client_cb.scb.peer_features & BTA_HF_CLIENT_PEER_CODEC)
+ if ((bta_hf_client_cb.scb.features & BTA_HF_CLIENT_FEAT_CODEC)
+ && (bta_hf_client_cb.scb.peer_features & BTA_HF_CLIENT_PEER_CODEC))
{
bta_hf_client_send_at_bac();
break;
@@ -595,7 +596,8 @@ void bta_hf_client_slc_seq(BOOLEAN error)
break;
case BTA_HF_CLIENT_AT_CMER:
- if (bta_hf_client_cb.scb.peer_features & BTA_HF_CLIENT_PEER_FEAT_3WAY)
+ if (bta_hf_client_cb.scb.peer_features & BTA_HF_CLIENT_PEER_FEAT_3WAY
+ && bta_hf_client_cb.scb.features & BTA_HF_CLIENT_FEAT_3WAY)
{
bta_hf_client_send_at_chld('?', 0);
}
diff --git a/bta/hh/bta_hh_le.c b/bta/hh/bta_hh_le.c
index 22e68a042..2cb85c114 100644
--- a/bta/hh/bta_hh_le.c
+++ b/bta/hh/bta_hh_le.c
@@ -3239,6 +3239,3 @@ static void bta_hh_process_cache_rpt (tBTA_HH_DEV_CB *p_cb,
#endif
-
-
-
diff --git a/btif/co/bta_av_co.c b/btif/co/bta_av_co.c
index 7d73db0c7..0e9b66a03 100644
--- a/btif/co/bta_av_co.c
+++ b/btif/co/bta_av_co.c
@@ -1,6 +1,7 @@
/******************************************************************************
*
* Copyright (C) 2004-2012 Broadcom Corporation
+ * Copyright (c) 2013, Linux Foundation. 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.
@@ -74,7 +75,7 @@ const UINT8 bta_av_co_cp_scmst[BTA_AV_CP_INFO_LEN] = "\x02\x02\x00";
/* SBC SRC codec capabilities */
const tA2D_SBC_CIE bta_av_co_sbc_caps =
{
-#ifdef BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ
+#if defined(SAMPLE_RATE_48K) || defined (BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ)
(A2D_SBC_IE_SAMP_FREQ_48), /* samp_freq */
#else
(A2D_SBC_IE_SAMP_FREQ_44), /* samp_freq */
@@ -100,7 +101,7 @@ const tA2D_SBC_CIE bta_av_co_sbc_sink_caps =
};
#if !defined(BTIF_AV_SBC_DEFAULT_SAMP_FREQ)
-#ifdef BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ
+#if defined(SAMPLE_RATE_48K) || defined (BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ)
#define BTIF_AV_SBC_DEFAULT_SAMP_FREQ A2D_SBC_IE_SAMP_FREQ_48
#else
#define BTIF_AV_SBC_DEFAULT_SAMP_FREQ A2D_SBC_IE_SAMP_FREQ_44
diff --git a/btif/co/bta_hh_co.c b/btif/co/bta_hh_co.c
index 278312a2e..465708b6f 100644
--- a/btif/co/bta_hh_co.c
+++ b/btif/co/bta_hh_co.c
@@ -168,6 +168,7 @@ static void remove_digitizer_descriptor(UINT8 **data, UINT16 *length)
}
}
}
+
void uhid_set_non_blocking(int fd)
{
int opts = fcntl(fd, F_GETFL);
@@ -628,7 +629,7 @@ void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, char *dev_name, UINT16 ven
if (check_if_dig_desc_to_be_removed(vendor_id, product_id, dev_name))
remove_digitizer_descriptor(&p_dscp, (UINT16 *)&dscp_len);
-//Create and send hid descriptor to kernel
+ //Create and send hid descriptor to kernel
memset(&ev, 0, sizeof(ev));
ev.type = UHID_CREATE;
strncpy((char*)ev.u.create.name, dev_name, sizeof(ev.u.create.name) - 1);
diff --git a/btif/include/btif_gatt_multi_adv_util.h b/btif/include/btif_gatt_multi_adv_util.h
index f9d4a8db3..5abeda761 100644
--- a/btif/include/btif_gatt_multi_adv_util.h
+++ b/btif/include/btif_gatt_multi_adv_util.h
@@ -55,9 +55,11 @@ typedef struct
BOOLEAN is_scan_rsp;
UINT8 client_if;
UINT16 service_uuid_len;
+#if BLE_INCLUDED == TRUE
tBTA_BLE_AD_MASK mask;
tBTA_BLE_ADV_DATA data;
tBTA_BLE_ADV_PARAMS param;
+#endif
TIMER_LIST_ENT tle_limited_timer;
int timeout_s;
}btgatt_multi_adv_inst_cb;
diff --git a/btif/include/btif_storage.h b/btif/include/btif_storage.h
index 1711d41d0..159f1aa04 100644
--- a/btif/include/btif_storage.h
+++ b/btif/include/btif_storage.h
@@ -323,6 +323,18 @@ bt_status_t btif_storage_add_device_to_autopair_blacklist(bt_bdaddr_t *remote_bd
*******************************************************************************/
BOOLEAN btif_storage_is_fixed_pin_zeros_keyboard(bt_bdaddr_t *remote_bd_addr);
+/*******************************************************************************
+**
+** Function btif_storage_is_wiimote
+**
+** Description BTIF storage API - checks if this device is a wiimote
+**
+** Returns TRUE if the device is found in wiimote device list
+** FALSE otherwise
+**
+*******************************************************************************/
+BOOLEAN btif_storage_is_wiimote(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *remote_bd_name);
+
#if (BLE_INCLUDED == TRUE)
bt_status_t btif_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr,
char *key,
diff --git a/btif/src/bluetooth.c b/btif/src/bluetooth.c
index fb9dde061..5563b8075 100644
--- a/btif/src/bluetooth.c
+++ b/btif/src/bluetooth.c
@@ -127,7 +127,9 @@ extern const btl2cap_interface_t *btif_l2cap_get_interface(void);
extern const btrfcomm_interface_t *btif_rfcomm_get_interface(void);
extern const btmcap_interface_t *btif_mcap_get_interface(void);
extern const btgatt_test_interface_t *btif_gatt_test_get_interface(void);
+#if SMP_INCLUDED == TRUE
extern const btsmp_interface_t *btif_smp_get_interface(void);
+#endif
extern const btgap_interface_t *btif_gap_get_interface(void);
#endif
extern const btstacklog_interface_t *btif_stack_log_interface(void);
@@ -428,7 +430,9 @@ static const void* get_testapp_interface(int test_app_profile)
case TEST_APP_GATT:
return btif_gatt_test_get_interface();
case TEST_APP_SMP:
+#if SMP_INCLUDED == TRUE
return btif_smp_get_interface();
+#endif
case TEST_APP_GAP:
return btif_gap_get_interface();
default:
@@ -486,7 +490,6 @@ int le_test_mode(uint16_t opcode, uint8_t* buf, uint8_t len)
return btif_le_test_mode(opcode, buf, len);
}
#endif
-
int config_hci_snoop_log(uint8_t enable)
{
LOG_INFO("config_hci_snoop_log");
diff --git a/btif/src/btif_config.c b/btif/src/btif_config.c
index c41314d1b..5fa6fbb40 100644
--- a/btif/src/btif_config.c
+++ b/btif/src/btif_config.c
@@ -27,6 +27,7 @@
#include "osi/include/alarm.h"
#include "osi/include/allocator.h"
#include "btcore/include/bdaddr.h"
+#include "btif_common.h"
#include "btif_config.h"
#include "btif_config_transcode.h"
#include "btif_util.h"
diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c
index d9f36a2af..6db10762c 100644
--- a/btif/src/btif_core.c
+++ b/btif/src/btif_core.c
@@ -70,7 +70,8 @@
#define BTE_DID_CONF_FILE "/etc/bluetooth/bt_did.conf"
#endif
-#define VENDOR_PERSISTENCE_PATH "/persist"
+#define VENDOR_PERSISTENCE_PATH "/persist/bluetooth"
+#define VENDOR_PERSISTENCE_PATH_LEGACY "/persist"
#define VENDOR_BT_NV_FILE_NAME ".bt_nv.bin"
#define VENDOR_PAYLOAD_MAXLENGTH (260)
#define VENDOR_MAX_CMD_HDR_SIZE (3)
@@ -337,6 +338,9 @@ static bool fetch_vendor_addr (bt_bdaddr_t *local_addr)
char filename[NAME_MAX];
snprintf(filename, NAME_MAX, "%s/%s",VENDOR_PERSISTENCE_PATH,VENDOR_BT_NV_FILE_NAME);
+ if (access(filename, R_OK) != 0) {
+ snprintf(filename, NAME_MAX, "%s/%s",VENDOR_PERSISTENCE_PATH_LEGACY,VENDOR_BT_NV_FILE_NAME);
+ }
BTIF_TRACE_VERBOSE("Opening file '%s' for reading\n",filename);
/* Open the Vendor BD Addr file */
@@ -381,6 +385,7 @@ static bool fetch_vendor_addr (bt_bdaddr_t *local_addr)
close(addr_fd);
return status;
}
+
static bool btif_fetch_property(const char *key, bt_bdaddr_t *addr) {
char val[PROPERTY_VALUE_MAX] = {0};
@@ -464,6 +469,26 @@ static void btif_fetch_local_bdaddr(bt_bdaddr_t *local_addr)
local_addr->address[3], local_addr->address[4], local_addr->address[5]);
}
+ /* No factory BDADDR found. Look for BDA in ro.boot.btmacaddr */
+ if ((!valid_bda) && \
+ (property_get("ro.boot.btmacaddr", val, NULL)))
+ {
+ valid_bda = string_to_bdaddr(val, local_addr);
+ if (valid_bda) {
+ BTIF_TRACE_DEBUG("Got vendor BDA %02X:%02X:%02X:%02X:%02X:%02X",
+ local_addr->address[0], local_addr->address[1], local_addr->address[2],
+ local_addr->address[3], local_addr->address[4], local_addr->address[5]);
+ }
+ }
+
+ if (!valid_bda && fetch_vendor_addr(local_addr))
+ {
+ valid_bda = TRUE;
+ BTIF_TRACE_DEBUG("Got Vendor BDA %02X:%02X:%02X:%02X:%02X:%02X",
+ local_addr->address[0], local_addr->address[1], local_addr->address[2],
+ local_addr->address[3], local_addr->address[4], local_addr->address[5]);
+ }
+
/* Generate new BDA if necessary */
if (!valid_bda)
{
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index a1fd4b73c..2991fee64 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -64,6 +64,7 @@
******************************************************************************/
#define COD_UNCLASSIFIED ((0x1F) << 8)
+#define COD_HID_JOYSTICK 0x0504
#define COD_HID_KEYBOARD 0x0540
#define COD_HID_POINTING 0x0580
#define COD_HID_COMBO 0x05C0
@@ -1037,6 +1038,33 @@ static void btif_dm_pin_req_evt(tBTA_DM_PIN_REQ *p_pin_req)
return;
}
}
+ else if (check_cod(&bd_addr, COD_HID_JOYSTICK))
+ {
+ if(( btif_storage_is_wiimote (&bd_addr, &bd_name) == TRUE) &&
+ (pairing_cb.autopair_attempts == 0))
+ {
+ bt_bdaddr_t ad_addr;
+ bt_status_t status;
+ bt_property_t prop;
+ prop.type = BT_PROPERTY_BDADDR;
+ prop.val = (void*) &ad_addr;
+
+ status = btif_storage_get_adapter_property(&prop);
+
+ BTIF_TRACE_DEBUG("%s() Attempting auto pair", __FUNCTION__);
+
+ pin_code.pin[0] = ad_addr.address[5];
+ pin_code.pin[1] = ad_addr.address[4];
+ pin_code.pin[2] = ad_addr.address[3];
+ pin_code.pin[3] = ad_addr.address[2];
+ pin_code.pin[4] = ad_addr.address[1];
+ pin_code.pin[5] = ad_addr.address[0];
+
+ pairing_cb.autopair_attempts++;
+ BTA_DmPinReply( (UINT8*)bd_addr.address, TRUE, 6, pin_code.pin);
+ return;
+ }
+ }
}
HAL_CBACK(bt_hal_cbacks, pin_request_cb,
&bd_addr, &bd_name, cod, p_pin_req->min_16_digit);
@@ -1215,6 +1243,16 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl)
}
}
+ // We could have received a new link key without going through the pairing flow.
+ // If so, we don't want to perform SDP or any other operations on the authenticated
+ // device.
+ if (!bdaddr_equals(p_auth_cmpl->bd_addr, pairing_cb.bd_addr)) {
+ char address[32];
+ bdaddr_to_string(&p_auth_cmpl->bd_addr, address, sizeof(address));
+ LOG_INFO("%s skipping SDP since we did not initiate pairing to %s.", __func__, address);
+ return;
+ }
+
// Skip SDP for certain HID Devices
if (p_auth_cmpl->success)
{
@@ -1925,6 +1963,7 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
bdcpy(bd_addr.address, p_data->link_up.bd_addr);
BTIF_TRACE_DEBUG("BTA_DM_LINK_UP_EVT. Sending BT_ACL_STATE_CONNECTED");
+#if BLE_INCLUDED == TRUE
if(p_data->link_up.link_type == BT_TRANSPORT_LE)
{
num_active_le_links++;
@@ -1952,6 +1991,7 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
btif_av_trigger_suspend();
}
+#endif
btif_update_remote_version_property(&bd_addr);
HAL_CBACK(bt_hal_cbacks, acl_state_changed_cb, BT_STATUS_SUCCESS,
@@ -1962,7 +2002,7 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
bdcpy(bd_addr.address, p_data->link_down.bd_addr);
btm_set_bond_type_dev(p_data->link_down.bd_addr, BOND_TYPE_UNKNOWN);
-
+#if BLE_INCLUDED == TRUE
BTIF_TRACE_DEBUG("BTA_DM_LINK_DOWN_EVT. Sending BT_ACL_STATE_DISCONNECTED");
if (num_active_le_links > 0 &&
p_data->link_down.link_type == BT_TRANSPORT_LE)
@@ -1977,6 +2017,7 @@ static void btif_dm_upstreams_evt(UINT16 event, char* p_param)
num_active_br_edr_links--;
BTIF_TRACE_DEBUG("num_active_br_edr_links is %d ",num_active_br_edr_links);
}
+#endif
btif_av_move_idle(bd_addr);
BTIF_TRACE_DEBUG("BTA_DM_LINK_DOWN_EVT. Sending BT_ACL_STATE_DISCONNECTED");
HAL_CBACK(bt_hal_cbacks, acl_state_changed_cb, BT_STATUS_SUCCESS,
@@ -2854,10 +2895,10 @@ bt_status_t btif_dm_get_remote_services_by_transport(bt_bdaddr_t *remote_addr, c
mask_ext.num_uuid = 0;
mask_ext.p_uuid = NULL;
mask_ext.srvc_mask = BTA_ALL_SERVICE_MASK;
-
+#if BLE_INCLUDED == TRUE
BTA_DmDiscoverByTransport(remote_addr->address, &mask_ext,
bte_dm_search_services_evt, TRUE, transport);
-
+#endif
return BT_STATUS_SUCCESS;
}
diff --git a/btif/src/btif_gap.c b/btif/src/btif_gap.c
index 941e97d7d..16c6d3a20 100644
--- a/btif/src/btif_gap.c
+++ b/btif/src/btif_gap.c
@@ -57,8 +57,9 @@ static void Gap_BleAttrDBUpdate(BD_ADDR p_bda, UINT16 int_min, UINT16 int_max, U
printf("%s:: remote_bd_addr=%02x:%02x:%02x:%02x:%02x:%02x, int_min=%d, int_max=%d, latency=%d sp_tout=%d\n", __FUNCTION__,
p_bda[0], p_bda[1], p_bda[2], p_bda[3], p_bda[4], p_bda[5],
int_min, int_max, latency, sp_tout);
+#if BLE_INCLUDED == TRUE
L2CA_UpdateBleConnParams(p_bda, 50, 70, 0, 1000);
-
+#endif
}
static const btgap_interface_t btgapInterface = {
diff --git a/btif/src/btif_gatt_qual.c b/btif/src/btif_gatt_qual.c
index fb4a74b30..5e2dd955e 100644
--- a/btif/src/btif_gatt_qual.c
+++ b/btif/src/btif_gatt_qual.c
@@ -50,7 +50,9 @@ UINT16 g_conn_id = 0;
tGATT_IF Gatt_Register (tBT_UUID *p_app_uuid128, tGATT_CBACK *p_cb_info)
{
tGATT_IF Gatt_if = 0;
+#if BTA_GATT_INCLUDED == TRUE
Gatt_if = GATT_Register (p_app_uuid128, p_cb_info);
+#endif
printf("%s:: Gatt_if=%d\n", __FUNCTION__, Gatt_if);
if (!BTM_SetSecurityLevel (TRUE, "gatt_tool", /*BTM_SEC_SERVICE_SDP_SERVER*/ BTM_SEC_PROTO_L2CAP,
0, 0x1f, 0, 0))
@@ -64,27 +66,35 @@ tGATT_IF Gatt_Register (tBT_UUID *p_app_uuid128, tGATT_CBACK *p_cb_info)
void Gatt_Deregister (tGATT_IF gatt_if)
{
tGATT_IF Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
GATT_Deregister (gatt_if);
+#endif
printf("%s:: \n", __FUNCTION__);
}
void Gatt_StartIf(tGATT_IF gatt_if)
{
+#if BTA_GATT_INCLUDED == TRUE
GATT_StartIf (gatt_if);
+#endif
printf("%s::\n", __FUNCTION__);
}
BOOLEAN Gatt_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct,tBT_TRANSPORT transport)
{
BOOLEAN Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATT_Connect(gatt_if, bd_addr, is_direct,BT_TRANSPORT_LE);
+#endif
printf("%s::Ret=%d,gatt_if=%d, is_direct=%d \n", __FUNCTION__, Ret, gatt_if, is_direct);
return Ret;
}
tGATT_STATUS Gatt_Disconnect (UINT16 conn_id)
{
tGATT_STATUS Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATT_Disconnect(conn_id);
+#endif
printf("%s::Ret=%d,conn_id=%d\n", __FUNCTION__, Ret, conn_id);
return Ret;
}
@@ -92,7 +102,9 @@ tGATT_STATUS Gatt_Disconnect (UINT16 conn_id)
BOOLEAN Gatt_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
{
BOOLEAN Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATT_Listen(gatt_if, start, bd_addr);
+#endif
printf("%s::Ret=%d, gatt_if=%d, start=%d \n", __FUNCTION__, Ret, gatt_if, start);
return Ret;
}
@@ -100,7 +112,9 @@ BOOLEAN Gatt_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
tGATT_STATUS Gatt_ConfigureMTU (UINT16 conn_id, UINT16 mtu)
{
tGATT_STATUS Ret =0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATTC_ConfigureMTU(conn_id, mtu);
+#endif
printf("%s::Ret=%d, conn_id=%d, mtu=%d \n", __FUNCTION__, Ret, conn_id, mtu);
return Ret;
}
@@ -108,7 +122,9 @@ BOOLEAN Gatt_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
tGATT_STATUS Gatt_Discover (UINT16 conn_id, tGATT_DISC_TYPE disc_type, tGATT_DISC_PARAM *p_param )
{
tGATT_STATUS Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATTC_Discover(conn_id, disc_type, p_param);
+#endif
printf("%s::Ret=%d, conn_id=%d, disc_type=%d \n", __FUNCTION__, Ret, conn_id, disc_type);
return Ret;
}
@@ -116,7 +132,9 @@ BOOLEAN Gatt_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
tGATT_STATUS Gatt_Read (UINT16 conn_id, tGATT_READ_TYPE type, tGATT_READ_PARAM *p_read)
{
tGATT_STATUS Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATTC_Read(conn_id, type, p_read);
+#endif
printf("%s::Ret=%d, conn_id=%d, type=%d \n", __FUNCTION__, Ret, conn_id, type);
return Ret;
}
@@ -124,28 +142,36 @@ BOOLEAN Gatt_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr)
tGATT_STATUS Gatt_Write (UINT16 conn_id, tGATT_WRITE_TYPE type, tGATT_VALUE *p_write)
{
tGATT_STATUS Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATTC_Write(conn_id, type, p_write);
+#endif
printf("%s::Ret=%d, conn_id=%d, type=%d \n", __FUNCTION__, Ret, conn_id, type);
return Ret;
}
tGATT_STATUS Gatt_ExecuteWrite (UINT16 conn_id, BOOLEAN is_execute)
{
tGATT_STATUS Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATTC_ExecuteWrite(conn_id, is_execute);
+#endif
printf("%s::Ret=%d, conn_id=%d, is_execute=%d \n", __FUNCTION__, Ret, conn_id, is_execute);
return Ret;
}
tGATT_STATUS Gatt_SendHandleValueConfirm (UINT16 conn_id, UINT16 handle)
{
tGATT_STATUS Ret = 0;
+#if BTA_GATT_INCLUDED == TRUE
Ret = GATTC_SendHandleValueConfirm(conn_id, handle);
+#endif
printf("%s::Ret=%d, conn_id=%d, handle=%d \n", __FUNCTION__, Ret, conn_id, handle);
return Ret;
}
void Gatt_SetIdleTimeout (BD_ADDR bd_addr, UINT16 idle_tout)
{
+#if BTA_GATT_INCLUDED == TRUE
GATT_SetIdleTimeout (bd_addr, idle_tout,BT_TRANSPORT_LE);
+#endif
printf("%s::\n", __FUNCTION__);
}
diff --git a/btif/src/btif_hf.c b/btif/src/btif_hf.c
index 1d956a393..43707adfc 100644
--- a/btif/src/btif_hf.c
+++ b/btif/src/btif_hf.c
@@ -1162,7 +1162,7 @@ static bt_status_t cops_response(const char *cops, bt_bdaddr_t *bd_addr)
tBTA_AG_RES_DATA ag_res;
/* Format the response */
- sprintf (ag_res.str, "0,0,\"%s\"", cops);
+ sprintf (ag_res.str, "0,0,\"%.16s\"", cops);
ag_res.ok_flag = BTA_AG_OK_DONE;
BTA_AgResult (btif_hf_cb[idx].handle, BTA_AG_COPS_RES, &ag_res);
diff --git a/btif/src/btif_media_task.c b/btif/src/btif_media_task.c
index c89af5892..0a2303a65 100644
--- a/btif/src/btif_media_task.c
+++ b/btif/src/btif_media_task.c
@@ -1,6 +1,7 @@
/******************************************************************************
*
* Copyright (C) 2009-2012 Broadcom Corporation
+ * Copyright (c) 2013, Linux Foundation. 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.
@@ -928,9 +929,8 @@ tBTIF_STATUS btif_a2dp_setup_codec(void)
GKI_disable();
-
-#ifdef BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ
- /* for now hardcode 48 khz 16 bit stereo PCM format */
+#if defined(SAMPLE_RATE_48K) || defined (BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ)
+ /* for now hardcode 44/48 khz 16 bit stereo */
media_feeding.cfg.pcm.sampling_freq = 48000;
#else
/* for now hardcode 44.1 khz 16 bit stereo PCM format */
@@ -2492,6 +2492,11 @@ static void btif_media_task_aa_start_tx(void)
APPL_TRACE_IMP("btif_media_task_aa_start_tx is timer %d, feeding mode %d",
btif_media_cb.is_tx_timer, btif_media_cb.feeding_mode);
+ if (btif_media_cb.is_tx_timer) {
+ LOG_WARN(LOG_TAG, "%s media alarm already running", __func__);
+ return;
+ }
+
/* Use a timer to poll the UIPC, get rid of the UIPC call back */
// UIPC_Ioctl(UIPC_CH_ID_AV_AUDIO, UIPC_REG_CBACK, NULL);
@@ -2513,7 +2518,8 @@ static void btif_media_task_aa_start_tx(void)
return;
}
- alarm_set_periodic(btif_media_cb.media_alarm, BTIF_MEDIA_TIME_TICK, btif_media_task_alarm_cb, NULL);
+ alarm_set_periodic(btif_media_cb.media_alarm, BTIF_MEDIA_TIME_TICK,
+ btif_media_task_alarm_cb, NULL);
#endif
}
diff --git a/btif/src/btif_rc.c b/btif/src/btif_rc.c
index 2b17fccb2..4a83c269d 100644
--- a/btif/src/btif_rc.c
+++ b/btif/src/btif_rc.c
@@ -41,6 +41,7 @@
#include "btif_util.h"
#include "btif_av.h"
#include "hardware/bt_rc.h"
+#include "device/include/interop.h"
#include "uinput.h"
#include "bdaddr.h"
@@ -478,8 +479,7 @@ void handle_rc_features(int index)
bdaddr_to_string(&avdtp_addr, &addr1, sizeof(bdstr_t)),
bdaddr_to_string(&rc_addr, &addr2, sizeof(bdstr_t)) );
- if (dev_blacklisted_for_absolute_volume(btif_rc_cb[index].rc_addr) ||
- bdcmp(avdtp_addr.address, rc_addr.address))
+ if (bdcmp(avdtp_addr.address, rc_addr.address))
{
btif_rc_cb[index].rc_features &= ~BTA_AV_FEAT_ADV_CTRL;
}
@@ -560,6 +560,8 @@ static BOOLEAN btif_rc_get_connection_state()
int clients;
for (clients = 0; clients < btif_max_rc_clients; clients++)
+ if ( (btif_rc_cb[clients].rc_features & BTA_AV_FEAT_ADV_CTRL) &&
+ (btif_rc_cb[clients].rc_features & BTA_AV_FEAT_RCTG))
{
if (btif_rc_cb[clients].rc_connected == TRUE)
{
diff --git a/btif/src/btif_smp.c b/btif/src/btif_smp.c
index 99f8eb5fc..072994517 100644
--- a/btif/src/btif_smp.c
+++ b/btif/src/btif_smp.c
@@ -95,6 +95,7 @@ static BOOLEAN Encrypt(UINT8 *key, UINT8 key_len,
return Ret;
}
+#if SMP_INCLUDED == TRUE
static const btsmp_interface_t btsmpInterface = {
sizeof(btsmp_interface_t),
SmpInit,
@@ -113,4 +114,5 @@ const btsmp_interface_t *btif_smp_get_interface(void)
return &btsmpInterface;
}
+#endif
#endif //TEST_APP_INTERFACE
diff --git a/btif/src/btif_storage.c b/btif/src/btif_storage.c
index b10f53d82..895631194 100644
--- a/btif/src/btif_storage.c
+++ b/btif/src/btif_storage.c
@@ -1726,6 +1726,39 @@ BOOLEAN btif_storage_is_fixed_pin_zeros_keyboard(bt_bdaddr_t *remote_bd_addr)
}
+static const char *wii_names[4] = {
+ "Nintendo RVL-CNT-01", /* 1st gen */
+ "Nintendo RVL-CNT-01-TR", /* 2nd gen */
+ "Nintendo RVL-CNT-01-UC", /* Wii U Pro Controller */
+ "Nintendo RVL-WBC-01", /* Balance Board */
+};
+
+/*******************************************************************************
+**
+** Function btif_storage_is_wiimote
+**
+** Description BTIF storage API - checks if this device is a wiimote
+**
+** Returns TRUE if the device is found in wiimote device list
+** FALSE otherwise
+**
+*******************************************************************************/
+BOOLEAN btif_storage_is_wiimote(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *remote_bd_name)
+{
+ uint8_t wii_names_size = sizeof(wii_names) / sizeof(wii_names[0]);
+ uint8_t i = 0;
+
+ /* Check device name */
+ for (i = 0; i < wii_names_size; i++)
+ {
+ if (!strcmp((char*)remote_bd_name->name, wii_names[i]))
+ return TRUE;
+ }
+
+ return FALSE;
+
+}
+
/*******************************************************************************
** Function btif_storage_load_hidd
**
diff --git a/device/include/interop.h b/device/include/interop.h
index 8391b4942..48aaf9066 100644
--- a/device/include/interop.h
+++ b/device/include/interop.h
@@ -58,6 +58,10 @@ typedef enum {
//Few carkits take long time to start sending AT commands
//Increase AG_CONN TIMEOUT so that AG connection go through
INTEROP_INCREASE_AG_CONN_TIMEOUT,
+ // Devices requiring this workaround do not handle Bluetooth Absolute Volume
+ // control correctly, leading to undesirable (potentially harmful) volume levels
+ // or general lack of controlability.
+ INTEROP_DISABLE_ABSOLUTE_VOLUME
} interop_feature_t;
// Check if a given |addr| matches a known interoperability workaround as identified
diff --git a/device/include/interop_database.h b/device/include/interop_database.h
index a0bdae756..c044db194 100644
--- a/device/include/interop_database.h
+++ b/device/include/interop_database.h
@@ -59,6 +59,38 @@ static const interop_addr_t interop_addr_database[] = {
// BMW car kits (Harman/Becker)
{{0x9c, 0xdf, 0x03, 0,0,0}, 3, INTEROP_AUTO_RETRY_PAIRING},
+ // Ausdom M05 - unacceptably loud volume
+ {{0xa0, 0xe9, 0xdb, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // iKross IKBT83B HS - unacceptably loud volume
+ {{0x00, 0x14, 0x02, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // Jabra EXTREAM2 - unacceptably loud volume
+ {{0x1c, 0x48, 0xf9, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // JayBird BlueBuds X - low granularity on volume control
+ {{0x44, 0x5e, 0xf3, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+ {{0xd4, 0x9c, 0x28, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // LG Tone HBS-730 - unacceptably loud volume
+ {{0x00, 0x18, 0x6b, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+ {{0xb8, 0xad, 0x3e, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // LG Tone HV-800 - unacceptably loud volume
+ {{0xa0, 0xe9, 0xdb, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // Mpow Cheetah - unacceptably loud volume
+ {{0x00, 0x11, 0xb1, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // SOL REPUBLIC Tracks Air - unable to adjust volume back off from max
+ {{0xa4, 0x15, 0x66, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // Swage Rokitboost HS - unacceptably loud volume
+ {{0x00, 0x14, 0xf1, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
+ // VW Car Kit - not enough granularity with volume
+ {{0x00, 0x26, 0x7e, 0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
+
// Apple Magic Mouse
{{0x04, 0x0C, 0xCE, 0,0,0}, 3, INTEROP_DISABLE_SDP_AFTER_PAIRING},
// Bluetooth Laser Travel Mouse
diff --git a/device/src/interop.c b/device/src/interop.c
index 633a3861c..32d819844 100644
--- a/device/src/interop.c
+++ b/device/src/interop.c
@@ -35,6 +35,7 @@ static const char* interop_feature_string(const interop_feature_t feature) {
CASE_RETURN_STR(INTEROP_DISABLE_AUTH_FOR_HID_POINTING)
CASE_RETURN_STR(INTEROP_DISABLE_SNIFF_DURING_SCO)
CASE_RETURN_STR(INTEROP_INCREASE_AG_CONN_TIMEOUT)
+ CASE_RETURN_STR(INTEROP_DISABLE_ABSOLUTE_VOLUME)
}
return "UNKNOWN";
diff --git a/hci/Android.mk b/hci/Android.mk
index 5dee0966a..197bda4c8 100644
--- a/hci/Android.mk
+++ b/hci/Android.mk
@@ -19,6 +19,10 @@ LOCAL_SRC_FILES := \
src/packet_fragmenter.c \
src/vendor.c
+ifeq ($(BOARD_HAVE_BLUETOOTH_BCM),true)
+LOCAL_CFLAGS += -DBOARD_HAVE_BLUETOOTH_BCM
+endif
+
ifeq ($(BLUETOOTH_HCI_USE_MCT),true)
LOCAL_CFLAGS += -DHCI_USE_MCT
endif
@@ -27,7 +31,7 @@ ifeq ($(QCOM_BT_USE_SMD_TTY),true)
LOCAL_CFLAGS += -DQCOM_WCN_SSR
endif
-ifeq ($(TARGET_BUILD_VARIANT), userdebug)
+ifeq ($(TARGET_BUILD_VARIANT), eng)
LOCAL_CFLAGS += -DBTSNOOP_DEFAULT=TRUE
endif
diff --git a/hci/include/hci_internals.h b/hci/include/hci_internals.h
index e28de6e70..3c25b112c 100644
--- a/hci/include/hci_internals.h
+++ b/hci/include/hci_internals.h
@@ -18,7 +18,13 @@
#pragma once
+#ifdef HAS_BDROID_BUILDCFG
+#include "bdroid_buildcfg.h"
+#endif
+
+#ifndef REMOVE_EAGER_THREADS
#define REMOVE_EAGER_THREADS TRUE
+#endif
#if (defined(REMOVE_EAGER_THREADS) && (REMOVE_EAGER_THREADS == TRUE))
#include "allocator.h"
diff --git a/hci/include/low_power_manager.h b/hci/include/low_power_manager.h
index 95f990af4..138b3ebed 100644
--- a/hci/include/low_power_manager.h
+++ b/hci/include/low_power_manager.h
@@ -41,6 +41,9 @@ typedef struct low_power_manager_t {
// Tell the low power manager that you're done transmitting data. Must be
// called on the thread provided at initialization time.
void (*transmit_done)(void);
+
+ void (*start_idle_timer)(bool check_LPM);
+ void (*stop_idle_timer)();
} low_power_manager_t;
const low_power_manager_t *low_power_manager_get_interface();
diff --git a/hci/src/hci_layer.c b/hci/src/hci_layer.c
index e9acb2ce1..a6c9a93f7 100644
--- a/hci/src/hci_layer.c
+++ b/hci/src/hci_layer.c
@@ -467,9 +467,17 @@ static void event_command_ready(fixed_queue_t *queue, UNUSED_ATTR void *context)
pthread_mutex_unlock(&commands_pending_response_lock);
// Send it off
+#ifdef BOARD_HAVE_BLUETOOTH_BCM
low_power_manager->wake_assert();
+#else
+ low_power_manager->stop_idle_timer();
+#endif
packet_fragmenter->fragment_and_dispatch(wait_entry->command);
+#ifdef BOARD_HAVE_BLUETOOTH_BCM
low_power_manager->transmit_done();
+#else
+ low_power_manager->start_idle_timer(false);
+#endif
non_repeating_timer_restart_if(command_response_timer, !list_is_empty(commands_pending_response));
}
diff --git a/hci/src/low_power_manager.c b/hci/src/low_power_manager.c
index 00d0fae53..ffd2c0367 100644
--- a/hci/src/low_power_manager.c
+++ b/hci/src/low_power_manager.c
@@ -55,8 +55,8 @@ static void event_allow_device_sleep(void *context);
static void event_idle_timeout(void *context);
static void reset_state();
-static void start_idle_timer();
-static void stop_idle_timer();
+void start_idle_timer(bool check_LPM);
+void stop_idle_timer();
static thread_fn event_functions[] = {
event_disable,
@@ -122,7 +122,7 @@ static void transmit_done() {
transmit_is_done = true;
if (wake_state == LPM_WAKE_W4_TX_DONE || wake_state == LPM_WAKE_ASSERTED) {
wake_state = LPM_WAKE_W4_TIMEOUT;
- start_idle_timer();
+ start_idle_timer(true);
}
}
@@ -156,7 +156,7 @@ static void allow_device_sleep() {
if (state == LPM_ENABLED && wake_state == LPM_WAKE_ASSERTED) {
if (transmit_is_done) {
wake_state = LPM_WAKE_W4_TIMEOUT;
- start_idle_timer();
+ start_idle_timer(true);
} else {
wake_state = LPM_WAKE_W4_TX_DONE;
}
@@ -183,14 +183,16 @@ static void idle_timer_expired(UNUSED_ATTR void *context) {
thread_post(thread, event_idle_timeout, NULL);
}
-static void start_idle_timer() {
- if (state == LPM_ENABLED) {
+void start_idle_timer(bool check_LPM) {
+ if (state == LPM_ENABLED || !check_LPM) {
alarm_set(idle_alarm, idle_timeout_ms, idle_timer_expired, NULL);
+ LOG_VERBOSE("%s check_LPM = %d", __func__, check_LPM);
}
}
-static void stop_idle_timer() {
+void stop_idle_timer() {
alarm_cancel(idle_alarm);
+ LOG_VERBOSE("%s", __func__);
}
static void event_disable(UNUSED_ATTR void *context) {
@@ -229,7 +231,9 @@ static const low_power_manager_t interface = {
cleanup,
post_command,
wake_assert,
- transmit_done
+ transmit_done,
+ start_idle_timer,
+ stop_idle_timer
};
const low_power_manager_t *low_power_manager_get_interface() {
diff --git a/hci/src/packet_fragmenter.c b/hci/src/packet_fragmenter.c
index e7cf6a6c0..9ee76f3ea 100644
--- a/hci/src/packet_fragmenter.c
+++ b/hci/src/packet_fragmenter.c
@@ -163,7 +163,7 @@ static void reassemble_and_dispatch(UNUSED_ATTR BT_HDR *packet) {
return;
}
else if (full_length == packet->len) {
- LOG_WARN("%s complete l2cap packet received:l2cap full length %d and hci length %d.", __func__, l2cap_length, packet->len);
+ LOG_VERBOSE("%s complete l2cap packet received:l2cap full length %d and hci length %d.", __func__, l2cap_length, packet->len);
callbacks->reassembled(packet);
return;
}
diff --git a/include/bt_target.h b/include/bt_target.h
index b2b6d012d..6e9a835c6 100644
--- a/include/bt_target.h
+++ b/include/bt_target.h
@@ -41,13 +41,17 @@
#include "dyn_mem.h" /* defines static and/or dynamic memory for components */
//------------------Added from bdroid_buildcfg.h---------------------
+#ifndef I2SPCM_SLAVE_BRCM
+#define I2SPCM_SLAVE_BRCM FALSE
+#endif
+
#ifndef L2CAP_EXTFEA_SUPPORTED_MASK
#define L2CAP_EXTFEA_SUPPORTED_MASK (L2CAP_EXTFEA_ENH_RETRANS | L2CAP_EXTFEA_STREAM_MODE | L2CAP_EXTFEA_NO_CRC | L2CAP_EXTFEA_FIXED_CHNLS)
#endif
/* This feature is used to update any QCOM related changes in the stack*/
#ifndef BLUETOOTH_QTI_SW
-#define BLUETOOTH_QTI_SW TRUE
+#define BLUETOOTH_QTI_SW FALSE
#endif
#ifndef BTUI_OPS_FORMATS
@@ -151,10 +155,6 @@
#define BTA_AV_RET_TOUT 15
#endif
-#ifndef PORCHE_PAIRING_CONFLICT
-#define PORCHE_PAIRING_CONFLICT TRUE
-#endif
-
#ifndef BTA_AV_CO_CP_SCMS_T
#define BTA_AV_CO_CP_SCMS_T FALSE
#endif
@@ -220,7 +220,7 @@
******************************************************************************/
#ifndef TEST_APP_INTERFACE
-#define TEST_APP_INTERFACE TRUE
+#define TEST_APP_INTERFACE FALSE
#endif
/******************************************************************************
@@ -1659,7 +1659,7 @@ Range: 2 octets
#endif
#ifndef SDP_AVRCP_1_5
-#define SDP_AVRCP_1_5 TRUE
+#define SDP_AVRCP_1_5 FALSE
#if SDP_AVRCP_1_5 == TRUE
#ifndef AVCT_BROWSE_INCLUDED
diff --git a/include/bt_testapp.h b/include/bt_testapp.h
index 6d07aee46..d399ae072 100644
--- a/include/bt_testapp.h
+++ b/include/bt_testapp.h
@@ -193,6 +193,7 @@ typedef struct
}btgatt_test_interface_t;
+#if SMP_INCLUDED == TRUE
typedef struct
{
size_t size;
@@ -204,6 +205,7 @@ typedef struct
void (*PasskeyReply) (BD_ADDR bd_addr, UINT8 res, UINT32 passkey);
BOOLEAN (*Encrypt) (UINT8 *key, UINT8 key_len, UINT8 *plain_text, UINT8 pt_len, tSMP_ENC *p_out);
}btsmp_interface_t;
+#endif
typedef struct
{
size_t size;
diff --git a/main/Android.mk b/main/Android.mk
index d3dcb5337..d98d2efef 100644
--- a/main/Android.mk
+++ b/main/Android.mk
@@ -6,6 +6,10 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
+ifeq ($(BOARD_USES_LEGACY_ALSA_AUDIO),true)
+ LOCAL_CFLAGS += -DSAMPLE_RATE_48K
+endif
+
# HAL layer
LOCAL_SRC_FILES:= \
../btif/src/bluetooth.c
diff --git a/osi/src/alarm.c b/osi/src/alarm.c
index 720020bfb..20355fc17 100644
--- a/osi/src/alarm.c
+++ b/osi/src/alarm.c
@@ -35,12 +35,6 @@
#include "osi/include/semaphore.h"
#include "osi/include/thread.h"
-// Make callbacks run at high thread priority. Some callbacks are used for audio
-// related timer tasks as well as re-transmissions etc. Since we at this point
-// cannot differentiate what callback we are dealing with, assume high priority
-// for now.
-// TODO(eisenbach): Determine correct thread priority (from parent?/per alarm?)
-static const int CALLBACK_THREAD_PRIORITY_HIGH = -19;
struct alarm_t {
// The lock is held while the callback for this alarm is being executed.
@@ -252,7 +246,8 @@ static bool lazy_initialize(void) {
// during a2dp music playback, media task/btu/hci/event threads are all high priority
// but actual callback thread is remaining normal which mean it's possible not to
// schedule alarm callback in-time if system is busy
- thread_set_priority(callback_thread, CALLBACK_THREAD_PRIORITY_HIGH);
+ thread_set_priority(callback_thread, TIMER_CALLBACK_THREAD_PRIORITY);
+
thread_post(callback_thread, callback_dispatch, NULL);
return true;
}
@@ -351,7 +346,7 @@ done:
struct itimerspec time_to_expire;
timer_gettime(timer, &time_to_expire);
if (time_to_expire.it_value.tv_sec == 0 && time_to_expire.it_value.tv_nsec == 0) {
- LOG_ERROR("%s alarm expiration too close for posix timers, switching to guns", __func__);
+ LOG_DEBUG("%s alarm expiration too close for posix timers, switching to guns", __func__);
semaphore_post(alarm_expired);
}
}
diff --git a/stack/btm/btm_acl.c b/stack/btm/btm_acl.c
index ba212a16c..322a5f72f 100644
--- a/stack/btm/btm_acl.c
+++ b/stack/btm/btm_acl.c
@@ -332,6 +332,7 @@ void btm_acl_created (BD_ADDR bda, DEV_CLASS dc, BD_NAME bdn,
/* if BR/EDR do something more */
if (transport == BT_TRANSPORT_BR_EDR)
{
+ btsnd_hcic_read_rmt_clk_offset (p->hci_handle);
btsnd_hcic_rmt_ver_req (p->hci_handle);
}
p_dev_rec = btm_find_dev_by_handle (hci_handle);
@@ -1029,12 +1030,16 @@ void btm_read_remote_version_complete (UINT8 *p)
p_acl_cb->remote_addr[3], p_acl_cb->remote_addr[4], p_acl_cb->remote_addr[5]);
BTM_TRACE_WARNING ("btm_read_remote_version_complete lmp_version %d manufacturer %d lmp_subversion %d",
p_acl_cb->lmp_version,p_acl_cb->manufacturer, p_acl_cb->lmp_subversion);
+#if BLE_INCLUDED == TRUE
if (p_acl_cb->transport == BT_TRANSPORT_BR_EDR)
+#endif
btm_read_remote_features (p_acl_cb->hci_handle);
}
+#if BLE_INCLUDED == TRUE
if (p_acl_cb->transport == BT_TRANSPORT_LE)
l2cble_notify_le_connection (p_acl_cb->remote_addr);
+#endif
break;
}
}
diff --git a/stack/btm/btm_dev.c b/stack/btm/btm_dev.c
index 44a3bf8a9..78af31ffb 100644
--- a/stack/btm/btm_dev.c
+++ b/stack/btm/btm_dev.c
@@ -152,9 +152,9 @@ BOOLEAN BTM_SecAddDevice (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_name,
if (pin_length >= 16 ||
key_type == BTM_LKEY_TYPE_AUTH_COMB ||
key_type == BTM_LKEY_TYPE_AUTH_COMB_P_256) {
- // Set the fiag if the link key was made by using either a 16 digit
+ // Set the flag if the link key was made by using either a 16 digit
// pin or MITM.
- p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED;
+ p_dev_rec->sec_flags |= BTM_SEC_16_DIGIT_PIN_AUTHED | BTM_SEC_LINK_KEY_AUTHED;
}
}
diff --git a/stack/btm/btm_int.h b/stack/btm/btm_int.h
index 4664fda81..0e18c7f1f 100644
--- a/stack/btm/btm_int.h
+++ b/stack/btm/btm_int.h
@@ -876,11 +876,6 @@ typedef struct
BOOLEAN security_mode_changed; /* mode changed during bonding */
BOOLEAN pin_type_changed; /* pin type changed during bonding */
BOOLEAN sec_req_pending; /* TRUE if a request is pending */
-// btla-specific ++
-#ifdef PORCHE_PAIRING_CONFLICT
- UINT8 pin_code_len_saved; /* for legacy devices */
-#endif
-// btla-specific --
UINT8 pin_code_len; /* for legacy devices */
PIN_CODE pin_code; /* for legacy devices */
diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c
index 5d8cbcd9e..9ee86c75a 100644
--- a/stack/btm/btm_sec.c
+++ b/stack/btm/btm_sec.c
@@ -1082,13 +1082,6 @@ void BTM_PINCodeReply (BD_ADDR bd_addr, UINT8 res, UINT8 pin_len, UINT8 *p_pin,
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_AUTH_COMPLETE);
btm_cb.acl_disc_reason = HCI_SUCCESS;
-#ifdef PORCHE_PAIRING_CONFLICT
- BTM_TRACE_EVENT("BTM_PINCodeReply(): Saving pin_len: %d btm_cb.pin_code_len: %d", pin_len, btm_cb.pin_code_len);
- /* if this was not pre-fetched, save the PIN */
- if (btm_cb.pin_code_len == 0)
- memcpy (btm_cb.pin_code, p_pin, pin_len);
- btm_cb.pin_code_len_saved = pin_len;
-#endif
btsnd_hcic_pin_code_req_reply (bd_addr, pin_len, p_pin);
}
@@ -5582,10 +5575,6 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
tBTM_SEC_DEV_REC *p_dev_rec;
tBTM_CB *p_cb = &btm_cb;
-#ifdef PORCHE_PAIRING_CONFLICT
- UINT8 default_pin_code_len = 4;
- PIN_CODE default_pin_code = {0x30, 0x30, 0x30, 0x30};
-#endif
BTM_TRACE_EVENT ("btm_sec_pin_code_request() State: %s, BDA:%04x%08x",
btm_pair_state_descr(btm_cb.pairing_state),
(p_bda[0]<<8)+p_bda[1], (p_bda[2]<<24)+(p_bda[3]<<16)+(p_bda[4]<<8)+p_bda[5] );
@@ -5595,41 +5584,15 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
if ( (memcmp (p_bda, btm_cb.pairing_bda, BD_ADDR_LEN) == 0) &&
(btm_cb.pairing_state == BTM_PAIR_STATE_WAIT_AUTH_COMPLETE) )
{
- /* fake this out - porshe carkit issue - */
-// btm_cb.pairing_state = BTM_PAIR_STATE_IDLE;
- if(! btm_cb.pin_code_len_saved)
- {
- btsnd_hcic_pin_code_neg_reply (p_bda);
- return;
- }
- else
- {
- btsnd_hcic_pin_code_req_reply (p_bda, btm_cb.pin_code_len_saved, p_cb->pin_code);
- return;
- }
+ btsnd_hcic_pin_code_neg_reply (p_bda);
+ return;
}
else if ((btm_cb.pairing_state != BTM_PAIR_STATE_WAIT_PIN_REQ)
|| memcmp (p_bda, btm_cb.pairing_bda, BD_ADDR_LEN) != 0)
{
BTM_TRACE_WARNING ("btm_sec_pin_code_request() rejected - state: %s",
btm_pair_state_descr(btm_cb.pairing_state));
-
-#ifdef PORCHE_PAIRING_CONFLICT
- /* reply pin code again due to counter in_rand when local initiates pairing */
- BTM_TRACE_EVENT ("btm_sec_pin_code_request from remote dev. for local initiated pairing");
- if(! btm_cb.pin_code_len_saved)
- {
- btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_AUTH_COMPLETE);
- btsnd_hcic_pin_code_req_reply (p_bda, default_pin_code_len, default_pin_code);
- }
- else
- {
- btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_AUTH_COMPLETE);
- btsnd_hcic_pin_code_req_reply (p_bda, btm_cb.pin_code_len_saved, p_cb->pin_code);
- }
-#else
btsnd_hcic_pin_code_neg_reply (p_bda);
-#endif
return;
}
}
@@ -5666,10 +5629,6 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
BTM_TRACE_EVENT ("btm_sec_pin_code_request bonding sending reply");
btsnd_hcic_pin_code_req_reply (p_bda, btm_cb.pin_code_len, p_cb->pin_code);
-#ifdef PORCHE_PAIRING_CONFLICT
- btm_cb.pin_code_len_saved = btm_cb.pin_code_len;
-#endif
-
/* Mark that we forwarded received from the user PIN code */
btm_cb.pin_code_len = 0;
@@ -5700,7 +5659,6 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
/* Notify upper layer of PIN request and start expiration timer */
else
{
- btm_cb.pin_code_len_saved = 0;
btm_sec_change_pairing_state (BTM_PAIR_STATE_WAIT_LOCAL_PIN);
/* Pin code request can not come at the same time as connection request */
memcpy (p_cb->connecting_bda, p_bda, BD_ADDR_LEN);
diff --git a/stack/l2cap/l2c_link.c b/stack/l2cap/l2c_link.c
index 6e694d0f0..2c56cadf8 100644
--- a/stack/l2cap/l2c_link.c
+++ b/stack/l2cap/l2c_link.c
@@ -949,7 +949,11 @@ void l2c_link_adjust_allocation (void)
/* Now, assign the quotas to each link */
for (yy = 0, p_lcb = &l2cb.lcb_pool[0]; yy < MAX_L2CAP_LINKS; yy++, p_lcb++)
{
- if (p_lcb->in_use)
+ if (p_lcb->in_use
+#if (BLE_INCLUDED == TRUE)
+ && p_lcb->transport == BT_TRANSPORT_BR_EDR
+#endif
+ )
{
if (p_lcb->acl_priority == L2CAP_PRIORITY_HIGH)
{
diff --git a/stack/rfcomm/rfc_mx_fsm.c b/stack/rfcomm/rfc_mx_fsm.c
index 5c1c1a698..667a57161 100644
--- a/stack/rfcomm/rfc_mx_fsm.c
+++ b/stack/rfcomm/rfc_mx_fsm.c
@@ -411,6 +411,7 @@ void rfc_mx_sm_state_wait_sabme (tRFC_MCB *p_mcb, UINT16 event, void *p_data)
p_mcb->state = RFC_MX_STATE_CONNECTED;
p_mcb->peer_ready = TRUE;
+ PORT_StartCnf (p_mcb, RFCOMM_SUCCESS);
}
return;
diff --git a/stack/smp/smp_act.c b/stack/smp/smp_act.c
index 411713973..119fd4de6 100644
--- a/stack/smp/smp_act.c
+++ b/stack/smp/smp_act.c
@@ -187,8 +187,7 @@ void smp_send_app_cback(tSMP_CB *p_cb, tSMP_INT_DATA *p_data)
if (!(p_cb->loc_auth_req & SMP_SC_SUPPORT_BIT)
|| lmp_version_below(p_cb->pairing_bda, HCI_PROTO_VERSION_4_2)
|| interop_addr_match(INTEROP_DISABLE_LE_SECURE_CONNECTIONS,
- (const bt_bdaddr_t *)&p_cb->pairing_bda)
- || lmp_version_below(p_cb->pairing_bda, HCI_PROTO_VERSION_4_2))
+ (const bt_bdaddr_t *)&p_cb->pairing_bda))
{
p_cb->loc_auth_req &= ~SMP_KP_SUPPORT_BIT;
p_cb->local_i_key &= ~SMP_SEC_KEY_TYPE_LK;
diff --git a/test/blegatt_test/gatt_test.c b/test/blegatt_test/gatt_test.c
index 5cfd0315d..6943d3ba0 100644
--- a/test/blegatt_test/gatt_test.c
+++ b/test/blegatt_test/gatt_test.c
@@ -148,7 +148,9 @@ static int g_server_if_scan = 0;
const btgatt_test_interface_t *sGattInterface = NULL;
const btgatt_interface_t *sGattIfaceScan = NULL;
+#if SMP_INCLUDED == TRUE
const btsmp_interface_t *sSmpIface = NULL;
+#endif
const btgap_interface_t *sGapInterface = NULL;
const btl2cap_interface_t *sL2capInterface = NULL;
@@ -441,7 +443,7 @@ static tGATT_CBACK gap_cback =
};
-
+#if SMP_INCLUDED == TRUE
/************************************************************************************
** SMP Callbacks
************************************************************************************/
@@ -477,7 +479,7 @@ static UINT8 SMP_cb (tSMP_EVT event, BD_ADDR bda, tSMP_EVT_DATA *p_data)
}
return 0;
}
-
+#endif
@@ -2525,10 +2527,12 @@ static void do_le_coc_disconnect(char *p)
*******************************************************************************/
void do_smp_init(char *p)
{
+#if SMP_INCLUDED == TRUE
sSmpIface->init();
sleep(1);
sSmpIface->Register(SMP_cb);
sleep(1);
+#endif
}
void do_smp_pair(char *p)
@@ -2536,7 +2540,9 @@ void do_smp_pair(char *p)
tSMP_STATUS Ret = 0;
bt_bdaddr_t bd_addr = {{0}};
if(FALSE == GetBdAddr(p, &bd_addr)) return;
+#if SMP_INCLUDED == TRUE
Ret = sSmpIface->Pair(bd_addr.address);
+#endif
printf("%s:: Ret=%d \n", __FUNCTION__, Ret);
}
@@ -2545,7 +2551,9 @@ void do_smp_pair_cancel(char *p)
BOOLEAN Ret = 0;
bt_bdaddr_t bd_addr = {{0}};
if(FALSE == GetBdAddr(p, &bd_addr)) return;
+#if SMP_INCLUDED == TRUE
Ret = sSmpIface->PairCancel(bd_addr.address);
+#endif
printf("%s:: Ret=%d \n", __FUNCTION__, Ret);
}
@@ -2555,7 +2563,9 @@ void do_smp_security_grant(char *p)
bt_bdaddr_t bd_addr = {{0}};
if(FALSE == GetBdAddr(p, &bd_addr)) return; //arg1
res = get_int(&p, -1); // arg2
+#if SMP_INCLUDED == TRUE
sSmpIface->SecurityGrant(bd_addr.address, res);
+#endif
printf("%s:: Ret=%d \n", __FUNCTION__,res);
}
@@ -2570,7 +2580,9 @@ void do_smp_passkey_reply(char *p)
printf("res value=%d\n", res);
passkey = get_int(&p, -1); // arg3
printf("passkey value=%d\n", passkey);
+#if SMP_INCLUDED == TRUE
sSmpIface->PasskeyReply(bd_addr.address, res, passkey);
+#endif
printf("%s:: Ret=%d \n", __FUNCTION__,res);
}
@@ -2737,12 +2749,13 @@ const t_cmd console_cmd_list[] =
{ "s_add_service", do_le_server_add_service, "::", 0 },
{ "pair", do_pairing, ":: BdAddr<00112233445566>", 0 },
-
+#if SMP_INCLUDED == TRUE
{ "smp_init", do_smp_init, "::", 0 }, //Here itself we will register.
{ "smp_pair", do_smp_pair, ":: BdAddr<00112233445566>", 0 },
{ "smp_pair_cancel", do_smp_pair_cancel, ":: BdAddr<00112233445566>", 0 },
{ "smp_security_grant", do_smp_security_grant, ":: BdAddr<00112233445566>, res<>", 0 },
{ "smp_passkey_reply", do_smp_passkey_reply, ":: BdAddr<00112233445566>, res<>, passkey<>", 0 },
+#endif
//{ "smp_encrypt", do_smp_encrypt, "::", 0 },
{ "l2cap_send_data_cid", do_l2cap_send_data_cid, ":: BdAddr<00112233445566>, CID<>", 0 },
@@ -2862,8 +2875,12 @@ int main (int argc, char * argv[])
bdt_enable();
sleep(5);
bdt_log("Get SMP IF BT Interface = %x \n", sBtInterface);
+#if BTA_GATT_INCLUDED == TRUE
sGattInterface = sBtInterface->get_testapp_interface(TEST_APP_GATT);
+#endif
+#if SMP_INCLUDED == TRUE
sSmpIface = sBtInterface->get_testapp_interface(TEST_APP_SMP);
+#endif
bdt_log("Get GAP IF");
sGapInterface = sBtInterface->get_testapp_interface(TEST_APP_GAP);