system/bt
Révision | f3be84555a575f8ab6089a54df927364231972e3 (tree) |
---|---|
l'heure | 2016-10-04 03:14:07 |
Auteur | Linux Build Service Account <lnxbuild@loca...> |
Commiter | Linux Build Service Account |
Promotion of bt.lnx.2.1-00018.
CRs Change ID Subject
1066335 Ic96205b5c304acb44eab53f4e2cb150726643bda BT: Serialize stack shutdown, state change callback and
1063890 I9afb5fec10a23725126e472c84b573dcdeacbfe0 BT: Calling HCI reset when Hardware error event occurs
1066796 I29bb6ae17dc5a83459cc5cd4c8cfc6ae59bb4504 GAP : PIN popup shown for dead legacy remotes
1070434 Ib4e8494270cea976d4549e903e78ec8b3398ec39 BT: Changing l2cap sock mutex lock type to static.
1071866 Bluetooth: split-a2dp: APTx-HD support
1068541 Ic3be9669c7cad52e0282a9947313659ef9056a02 Update Interop datatbase to prevent preferred conn updat
Change-Id: Idfe2fb86d32554d9f3ec4582d0f8611655e6a203
CRs-Fixed: 1066796, 1071866, 1070434, 1068541, 1063890, 1066335
@@ -421,8 +421,10 @@ static void* a2dp_codec_parser(uint8_t *codec_cfg, audio_format_t *codec_type) | ||
421 | 421 | default: |
422 | 422 | ERROR("Unknown channel mode"); |
423 | 423 | } |
424 | - if (*codec_type == AUDIO_FORMAT_APTX_HD) | |
424 | + if (*codec_type == AUDIO_FORMAT_APTX_HD) { | |
425 | + p_cfg += 4; | |
425 | 426 | len -= 4;//ignore 4 bytes not used |
427 | + } | |
426 | 428 | if (len == 0) |
427 | 429 | INFO("Codec config copied"); |
428 | 430 |
@@ -80,7 +80,7 @@ enum | ||
80 | 80 | { |
81 | 81 | APTX = 1, |
82 | 82 | AAC, |
83 | - APTX_HD | |
83 | + APTXHD | |
84 | 84 | }; |
85 | 85 | |
86 | 86 | /* state machine states */ |
@@ -709,19 +709,36 @@ static void bta_av_api_register(tBTA_AV_DATA *p_data) | ||
709 | 709 | { |
710 | 710 | if((*bta_av_a2d_cos.cap)(APTX) != TRUE) |
711 | 711 | { |
712 | + APPL_TRACE_DEBUG("%s: aptx-Classic offload codec not supported",__func__); | |
712 | 713 | index++; |
713 | 714 | continue; |
714 | 715 | } |
715 | 716 | else |
716 | - APPL_TRACE_DEBUG("%s:codec supported",__func__) | |
717 | + APPL_TRACE_DEBUG("%s:aptx-Classic offload codec supported",__func__) | |
718 | + } else { | |
719 | + if (codecId == A2D_APTX_HD_CODEC_ID_BLUETOOTH && | |
720 | + vendorId == A2D_APTX_HD_VENDOR_ID ) { | |
721 | + if((*bta_av_a2d_cos.cap)(APTXHD) != TRUE) | |
722 | + { | |
723 | + APPL_TRACE_DEBUG("%s: aptx-HD offload codec not supported",__func__) | |
724 | + index++; | |
725 | + continue; | |
726 | + } | |
727 | + else | |
728 | + APPL_TRACE_DEBUG("%s: aptx-HD offload codec supported",__func__) | |
729 | + | |
730 | + } | |
717 | 731 | } |
718 | 732 | } |
719 | 733 | else if (codec_type == AAC) |
720 | 734 | { |
721 | 735 | if ((*bta_av_a2d_cos.cap)(AAC) != TRUE) |
722 | 736 | { |
737 | + APPL_TRACE_DEBUG("%s: AAC offload codec not supported",__func__); | |
723 | 738 | index++; |
724 | 739 | continue; |
740 | + } else { | |
741 | + APPL_TRACE_DEBUG("%s: AAC offload codec supported",__func__); | |
725 | 742 | } |
726 | 743 | } |
727 | 744 | } else if (codec_type == A2D_NON_A2DP_MEDIA_CT) { |
@@ -31,6 +31,7 @@ | ||
31 | 31 | #include "btm_api.h" |
32 | 32 | #include "btm_ble_api.h" |
33 | 33 | #include "btm_int.h" |
34 | +#include "device/include/interop.h" | |
34 | 35 | #include "osi/include/log.h" |
35 | 36 | #include "srvc_api.h" |
36 | 37 | #include "stack/include/l2c_api.h" |
@@ -1736,6 +1737,7 @@ void bta_hh_w4_le_read_char_cmpl(tBTA_HH_DEV_CB *p_dev_cb, tBTA_HH_DATA *p_buf) | ||
1736 | 1737 | { |
1737 | 1738 | tBTA_GATTC_READ * p_data = (tBTA_GATTC_READ *)p_buf; |
1738 | 1739 | UINT8 *pp ; |
1740 | + BD_NAME bdname; | |
1739 | 1741 | |
1740 | 1742 | const tBTA_GATTC_CHARACTERISTIC *p_char = BTA_GATTC_GetCharacteristic(p_dev_cb->conn_id, |
1741 | 1743 | p_data->handle); |
@@ -1766,7 +1768,12 @@ void bta_hh_w4_le_read_char_cmpl(tBTA_HH_DEV_CB *p_dev_cb, tBTA_HH_DATA *p_buf) | ||
1766 | 1768 | tout = BTM_BLE_CONN_TIMEOUT_MIN_DEF; |
1767 | 1769 | |
1768 | 1770 | BTM_BleSetPrefConnParams (p_dev_cb->addr, min, max, latency, tout); |
1769 | - L2CA_UpdateBleConnParams(p_dev_cb->addr, min, max, latency, tout); | |
1771 | + | |
1772 | + if (!BTM_GetRemoteDeviceName(p_dev_cb->addr, bdname) || !*bdname || | |
1773 | + (!interop_match_name(INTEROP_DISABLE_LE_CONN_PREFERRED_PARAMS, (const char*) bdname))) | |
1774 | + { | |
1775 | + L2CA_UpdateBleConnParams(p_dev_cb->addr, min, max, latency, tout); | |
1776 | + } | |
1770 | 1777 | } |
1771 | 1778 | else |
1772 | 1779 | { |
@@ -122,9 +122,10 @@ const tA2D_SBC_CIE bta_av_co_sbc_sink_caps = | ||
122 | 122 | #endif |
123 | 123 | |
124 | 124 | /* A2dp offload capabilities */ |
125 | -#define SBC 0 | |
126 | -#define APTX 1 | |
127 | -#define AAC 2 | |
125 | +#define SBC 0 | |
126 | +#define APTX 1 | |
127 | +#define AAC 2 | |
128 | +#define APTXHD 3 | |
128 | 129 | /* Default SBC codec configuration */ |
129 | 130 | const tA2D_SBC_CIE btif_av_sbc_default_config = |
130 | 131 | { |
@@ -170,7 +171,11 @@ const tA2D_APTX_HD_CIE bta_av_co_aptx_hd_caps = | ||
170 | 171 | { |
171 | 172 | A2D_APTX_HD_VENDOR_ID, |
172 | 173 | A2D_APTX_HD_CODEC_ID_BLUETOOTH, |
174 | +#ifndef BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ | |
173 | 175 | A2D_APTX_HD_SAMPLERATE_44100, |
176 | +#else | |
177 | + A2D_APTX_HD_SAMPLERATE_48000, | |
178 | +#endif | |
174 | 179 | A2D_APTX_HD_CHANNELS_STEREO, |
175 | 180 | A2D_APTX_HD_ACL_SPRINT_RESERVED0, |
176 | 181 | A2D_APTX_HD_ACL_SPRINT_RESERVED1, |
@@ -183,7 +188,11 @@ const tA2D_APTX_HD_CIE btif_av_aptx_hd_default_config = | ||
183 | 188 | { |
184 | 189 | A2D_APTX_HD_VENDOR_ID, |
185 | 190 | A2D_APTX_HD_CODEC_ID_BLUETOOTH, |
191 | +#ifndef BTA_AV_SPLIT_A2DP_DEF_FREQ_48KHZ | |
186 | 192 | A2D_APTX_HD_SAMPLERATE_44100, |
193 | +#else | |
194 | + A2D_APTX_HD_SAMPLERATE_48000, | |
195 | +#endif | |
187 | 196 | A2D_APTX_HD_CHANNELS_STEREO, |
188 | 197 | A2D_APTX_HD_ACL_SPRINT_RESERVED0, |
189 | 198 | A2D_APTX_HD_ACL_SPRINT_RESERVED1, |
@@ -1698,13 +1707,13 @@ static BOOLEAN bta_av_co_audio_peer_supports_codec(tBTA_AV_CO_PEER *p_peer, UINT | ||
1698 | 1707 | * multicast is not supported for aptX |
1699 | 1708 | */ |
1700 | 1709 | if ((!bt_split_a2dp_enabled && isA2dAptXEnabled && (btif_av_is_multicast_supported() == FALSE)) || |
1701 | - (bt_split_a2dp_enabled && btif_av_is_codec_offload_supported(APTX))) | |
1710 | + (bt_split_a2dp_enabled && (btif_av_is_codec_offload_supported(APTX)|| btif_av_is_codec_offload_supported(APTXHD)))) | |
1702 | 1711 | { |
1703 | 1712 | UINT16 codecId; |
1704 | 1713 | UINT32 vendorId; |
1705 | 1714 | UINT8* aptx_capabilities; |
1706 | 1715 | |
1707 | - if (isA2dAptXHdEnabled) { | |
1716 | + if ((bt_split_a2dp_enabled && btif_av_is_codec_offload_supported(APTXHD)) || isA2dAptXHdEnabled) { | |
1708 | 1717 | for (index = 0; index < p_peer->num_sup_snks; index++) |
1709 | 1718 | { |
1710 | 1719 | if (p_peer->snks[index].codec_type == A2D_NON_A2DP_MEDIA_CT) |
@@ -117,12 +117,14 @@ typedef struct | ||
117 | 117 | BOOLEAN sbc_offload; |
118 | 118 | BOOLEAN aptx_offload; |
119 | 119 | BOOLEAN aac_offload; |
120 | + BOOLEAN aptxhd_offload; | |
120 | 121 | } btif_av_a2dp_offloaded_codec_cap_t; |
121 | 122 | |
122 | 123 | typedef enum { |
123 | 124 | SBC, |
124 | 125 | APTX, |
125 | 126 | AAC, |
127 | + APTXHD, | |
126 | 128 | }btif_av_codec_list; |
127 | 129 | |
128 | 130 | /***************************************************************************** |
@@ -299,6 +301,7 @@ const char *dump_av_codec_name(btif_av_codec_list codec) | ||
299 | 301 | CASE_RETURN_STR(SBC) |
300 | 302 | CASE_RETURN_STR(APTX) |
301 | 303 | CASE_RETURN_STR(AAC) |
304 | + CASE_RETURN_STR(APTXHD) | |
302 | 305 | default: return "UNKNOWN_CODEC"; |
303 | 306 | } |
304 | 307 | } |
@@ -2247,6 +2250,11 @@ static void a2dp_offload_codec_cap_parser(const char *value) | ||
2247 | 2250 | BTIF_TRACE_ERROR("%s: AAC offload supported",__func__); |
2248 | 2251 | btif_av_codec_offload.aac_offload = TRUE; |
2249 | 2252 | } |
2253 | + else if (strcmp(tok,"aptxhd") == 0) | |
2254 | + { | |
2255 | + BTIF_TRACE_ERROR("%s: APTXHD offload supported",__func__); | |
2256 | + btif_av_codec_offload.aptxhd_offload = TRUE; | |
2257 | + } | |
2250 | 2258 | tok = strtok_r(NULL, "-", &tmp_token); |
2251 | 2259 | }; |
2252 | 2260 | } |
@@ -3645,10 +3653,13 @@ BOOLEAN btif_av_is_codec_offload_supported(int codec) | ||
3645 | 3653 | case AAC: |
3646 | 3654 | ret = btif_av_codec_offload.aac_offload; |
3647 | 3655 | break; |
3656 | + case APTXHD: | |
3657 | + ret = btif_av_codec_offload.aptxhd_offload; | |
3658 | + break; | |
3648 | 3659 | default: |
3649 | 3660 | ret = FALSE; |
3650 | 3661 | } |
3651 | - BTIF_TRACE_DEBUG("btif_av_is_codec_offload_supported %s code supported = %d",dump_av_codec_name(codec),ret); | |
3662 | + BTIF_TRACE_DEBUG("btif_av_is_codec_offload_supported %s codec supported = %d",dump_av_codec_name(codec),ret); | |
3652 | 3663 | return ret; |
3653 | 3664 | } |
3654 | 3665 |
@@ -4312,6 +4312,8 @@ static void btif_media_send_aa_frame(uint64_t timestamp_us) | ||
4312 | 4312 | #define A2DP_CODEC_AAC 2 |
4313 | 4313 | /* Below type is not defined in spec, it is for our convenience */ |
4314 | 4314 | #define A2DP_CODEC_APTX 8 |
4315 | + | |
4316 | +#define A2DP_CODEC_APTX_HD 9 | |
4315 | 4317 | /* Need to check if we need a different type for APTX low latency |
4316 | 4318 | * or just we can handle with reducing the MTU updated in media |
4317 | 4319 | * channel configuration. |
@@ -4324,6 +4326,7 @@ static void btif_media_send_aa_frame(uint64_t timestamp_us) | ||
4324 | 4326 | #define A2DP_TRANSPORT_STREAM_TYPE_SBC 0 |
4325 | 4327 | #define A2DP_TRANSPORT_STREAM_TYPE_AAC 2 |
4326 | 4328 | #define A2DP_TRANSPORT_STREAM_TYPE_APTX 8 |
4329 | +#define A2DP_TRANSPORT_STREAM_TYPE_APTX_HD 9 | |
4327 | 4330 | |
4328 | 4331 | void disconnect_a2dp_on_vendor_start_failure() |
4329 | 4332 | { |
@@ -4506,8 +4509,16 @@ BOOLEAN btif_media_send_vendor_selected_codec() | ||
4506 | 4509 | UINT16 index = 0; |
4507 | 4510 | |
4508 | 4511 | codec_type = bta_av_co_get_current_codec(); |
4509 | - if (codec_type == A2D_NON_A2DP_MEDIA_CT) | |
4510 | - codec_type = A2DP_CODEC_APTX; | |
4512 | + if (codec_type == A2D_NON_A2DP_MEDIA_CT) { | |
4513 | + UINT8* ptr = bta_av_co_get_current_codecInfo(); | |
4514 | + if (ptr) { | |
4515 | + tA2D_APTX_CIE* codecInfo = (tA2D_APTX_CIE*) &ptr[BTA_AV_CFG_START_IDX]; | |
4516 | + if (codecInfo && codecInfo->vendorId == A2D_APTX_VENDOR_ID && codecInfo->codecId == A2D_APTX_CODEC_ID_BLUETOOTH) | |
4517 | + codec_type = A2DP_CODEC_APTX; | |
4518 | + else if (codecInfo && codecInfo->vendorId == A2D_APTX_HD_VENDOR_ID && codecInfo->codecId == A2D_APTX_HD_CODEC_ID_BLUETOOTH) | |
4519 | + codec_type = A2DP_CODEC_APTX_HD; | |
4520 | + } | |
4521 | + } | |
4511 | 4522 | |
4512 | 4523 | APPL_TRACE_IMP("btif_media_send_selected_codec: codec: %d", codec_type); |
4513 | 4524 | param[index++] = VS_QHCI_A2DP_SELECTED_CODEC; |
@@ -4566,8 +4577,18 @@ BOOLEAN btif_media_send_vendor_transport_cfg() | ||
4566 | 4577 | UINT8 stream_type; |
4567 | 4578 | APPL_TRACE_IMP("btif_media_send_vendor_transport_cfg: codec: %d", codec_type); |
4568 | 4579 | stream_type = codec_type; |
4569 | - if (codec_type == A2D_NON_A2DP_MEDIA_CT) | |
4570 | - stream_type = A2DP_TRANSPORT_STREAM_TYPE_APTX; | |
4580 | + | |
4581 | + if (codec_type == A2D_NON_A2DP_MEDIA_CT) { | |
4582 | + UINT8* ptr = bta_av_co_get_current_codecInfo(); | |
4583 | + if (ptr) { | |
4584 | + tA2D_APTX_CIE* codecInfo = (tA2D_APTX_CIE*) &ptr[BTA_AV_CFG_START_IDX]; | |
4585 | + if (codecInfo && codecInfo->vendorId == A2D_APTX_VENDOR_ID && codecInfo->codecId == A2D_APTX_CODEC_ID_BLUETOOTH) | |
4586 | + stream_type = A2DP_TRANSPORT_STREAM_TYPE_APTX; | |
4587 | + else if (codecInfo && codecInfo->vendorId == A2D_APTX_HD_VENDOR_ID && codecInfo->codecId == A2D_APTX_HD_CODEC_ID_BLUETOOTH) | |
4588 | + stream_type = A2DP_TRANSPORT_STREAM_TYPE_APTX_HD; | |
4589 | + } | |
4590 | + } | |
4591 | + | |
4571 | 4592 | param[0] = VS_QHCI_A2DP_TRANSPORT_CONFIGURATION; |
4572 | 4593 | param[1] = A2DP_TRANSPORT_TYPE_SLIMBUS; |
4573 | 4594 | param[2] = stream_type; |
@@ -90,7 +90,7 @@ typedef struct l2cap_socket { | ||
90 | 90 | |
91 | 91 | static bt_status_t btSock_start_l2cap_server_l(l2cap_socket *sock); |
92 | 92 | |
93 | -static pthread_mutex_t state_lock; | |
93 | +static pthread_mutex_t state_lock = PTHREAD_MUTEX_INITIALIZER; | |
94 | 94 | |
95 | 95 | l2cap_socket *socks = NULL; |
96 | 96 | static uid_set_t* uid_set = NULL; |
@@ -367,7 +367,6 @@ fail_sockpair: | ||
367 | 367 | bt_status_t btsock_l2cap_init(int handle, uid_set_t* set) |
368 | 368 | { |
369 | 369 | APPL_TRACE_DEBUG("%s handle = %d", __func__); |
370 | - pthread_mutex_init(&state_lock, NULL); | |
371 | 370 | pthread_mutex_lock(&state_lock); |
372 | 371 | pth = handle; |
373 | 372 | socks = NULL; |
@@ -384,7 +383,6 @@ bt_status_t btsock_l2cap_cleanup() | ||
384 | 383 | while (socks) |
385 | 384 | btsock_l2cap_free_l(socks); |
386 | 385 | pthread_mutex_unlock(&state_lock); |
387 | - pthread_mutex_destroy(&state_lock); | |
388 | 386 | |
389 | 387 | return BT_STATUS_SUCCESS; |
390 | 388 | } |
@@ -178,7 +178,9 @@ static void event_shut_down_stack(UNUSED_ATTR void *context) { | ||
178 | 178 | module_shut_down(get_module(CONTROLLER_MODULE)); // Doesn't do any work, just puts it in a restartable state |
179 | 179 | |
180 | 180 | LOG_INFO(LOG_TAG, "%s finished", __func__); |
181 | + hack_future = future_new(); | |
181 | 182 | btif_thread_post(event_signal_stack_down, NULL); |
183 | + future_await(hack_future); | |
182 | 184 | } |
183 | 185 | |
184 | 186 | static void ensure_stack_is_not_running(void) { |
@@ -224,6 +226,7 @@ static void event_signal_stack_up(UNUSED_ATTR void *context) { | ||
224 | 226 | |
225 | 227 | static void event_signal_stack_down(UNUSED_ATTR void *context) { |
226 | 228 | HAL_CBACK(bt_hal_cbacks, adapter_state_changed_cb, BT_STATE_OFF); |
229 | + future_ready(stack_manager_get_hack_future(), FUTURE_SUCCESS); | |
227 | 230 | } |
228 | 231 | |
229 | 232 | static void ensure_manager_initialized(void) { |
@@ -96,6 +96,11 @@ typedef enum { | ||
96 | 96 | //Few carkits take long time to start sending AT commands |
97 | 97 | //Increase AG_CONN TIMEOUT so that AG connection go through |
98 | 98 | INTEROP_INCREASE_AG_CONN_TIMEOUT, |
99 | + | |
100 | + // Some HOGP devices do not respond well when we switch from default LE conn parameters | |
101 | + // to preferred conn params immediately post connection. Disable automatic switching to | |
102 | + // preferred conn params for such devices and allow them to explicity ask for it. | |
103 | + INTEROP_DISABLE_LE_CONN_PREFERRED_PARAMS, | |
99 | 104 | } interop_feature_t; |
100 | 105 | |
101 | 106 | // Check if a given |addr| matches a known interoperability workaround as identified |
@@ -149,6 +149,10 @@ static const interop_name_entry_t interop_name_database[] = { | ||
149 | 149 | |
150 | 150 | // HID Authentication Blacklist |
151 | 151 | {"Targus BT Laser Notebook Mouse", 30, INTEROP_DISABLE_AUTH_FOR_HID_POINTING}, |
152 | + | |
153 | + //Below devices reject connection updated with preferred | |
154 | + {"BSMBB09DS", 9, INTEROP_DISABLE_LE_CONN_PREFERRED_PARAMS}, | |
155 | + {"ELECOM", 6, INTEROP_DISABLE_LE_CONN_PREFERRED_PARAMS}, | |
152 | 156 | }; |
153 | 157 | |
154 | 158 | typedef struct { |
@@ -159,6 +159,7 @@ static const char* interop_feature_string_(const interop_feature_t feature) { | ||
159 | 159 | CASE_RETURN_STR(INTEROP_REMOVE_HID_DIG_DESCRIPTOR) |
160 | 160 | CASE_RETURN_STR(INTEROP_DISABLE_SNIFF_DURING_SCO) |
161 | 161 | CASE_RETURN_STR(INTEROP_INCREASE_AG_CONN_TIMEOUT) |
162 | + CASE_RETURN_STR(INTEROP_DISABLE_LE_CONN_PREFERRED_PARAMS) | |
162 | 163 | } |
163 | 164 | |
164 | 165 | return "UNKNOWN"; |
@@ -33,6 +33,7 @@ | ||
33 | 33 | |
34 | 34 | #include "bt_types.h" |
35 | 35 | #include "bt_utils.h" |
36 | +#include "btif/include/btif_storage.h" | |
36 | 37 | #include "btm_ble_api.h" |
37 | 38 | #include "btm_int.h" |
38 | 39 | #include "btu.h" |
@@ -124,6 +125,37 @@ BOOLEAN BTM_SecAddBleDevice (BD_ADDR bd_addr, BD_NAME bd_name, tBT_DEVICE_TYPE d | ||
124 | 125 | |
125 | 126 | /******************************************************************************* |
126 | 127 | ** |
128 | +** Function BTM_GetRemoteDeviceName | |
129 | +** | |
130 | +** Description This function is called to get the dev name of remote device | |
131 | +** from NV | |
132 | +** | |
133 | +** Returns TRUE if success; otherwise failed. | |
134 | +** | |
135 | +*******************************************************************************/ | |
136 | +BOOLEAN BTM_GetRemoteDeviceName(BD_ADDR bda, BD_NAME bd_name) | |
137 | +{ | |
138 | + BTM_TRACE_DEBUG("%s", __func__); | |
139 | + BOOLEAN ret = FALSE; | |
140 | + bt_bdname_t bdname; | |
141 | + bt_property_t prop_name; | |
142 | + bt_bdaddr_t bd_addr; | |
143 | + bdcpy(bd_addr.address, bda); | |
144 | + | |
145 | + BTIF_STORAGE_FILL_PROPERTY(&prop_name, BT_PROPERTY_BDNAME, | |
146 | + sizeof(bt_bdname_t), &bdname); | |
147 | + if (btif_storage_get_remote_device_property( | |
148 | + &bd_addr, &prop_name) == BT_STATUS_SUCCESS) | |
149 | + { | |
150 | + APPL_TRACE_DEBUG("%s, NV name = %s", __func__, bdname.name); | |
151 | + strlcpy((char*) bd_name, (char*) bdname.name, BD_NAME_LEN); | |
152 | + ret = TRUE; | |
153 | + } | |
154 | + return ret; | |
155 | +} | |
156 | + | |
157 | +/******************************************************************************* | |
158 | +** | |
127 | 159 | ** Function BTM_SecAddBleKey |
128 | 160 | ** |
129 | 161 | ** Description Add/modify LE device information. This function will be |
@@ -2745,6 +2777,7 @@ void btm_ble_set_keep_rfu_in_auth_req(BOOLEAN keep_rfu) | ||
2745 | 2777 | btm_cb.devcb.keep_rfu_in_auth_req = keep_rfu; |
2746 | 2778 | } |
2747 | 2779 | |
2780 | + | |
2748 | 2781 | #endif /* BTM_BLE_CONFORMANCE_TESTING */ |
2749 | 2782 | |
2750 | 2783 | #endif /* BLE_INCLUDED */ |
@@ -297,6 +297,7 @@ void btm_sec_free_dev (tBTM_SEC_DEV_REC *p_dev_rec) | ||
297 | 297 | { |
298 | 298 | p_dev_rec->bond_type = BOND_TYPE_UNKNOWN; |
299 | 299 | p_dev_rec->sec_flags = 0; |
300 | + p_dev_rec->sm4 = BTM_SM4_UNKNOWN; | |
300 | 301 | |
301 | 302 | #if BLE_INCLUDED == TRUE |
302 | 303 | /* Clear out any saved BLE keys */ |
@@ -226,6 +226,17 @@ void BTM_DeviceReset (UNUSED_ATTR tBTM_CMPL_CB *p_cb) { | ||
226 | 226 | ); |
227 | 227 | } |
228 | 228 | |
229 | +void BTM_HCI_Reset(void) | |
230 | +{ | |
231 | + /* Flush all ACL connections */ | |
232 | + btm_acl_device_down(); | |
233 | + | |
234 | + /* Clear the callback, so application would not hang on reset */ | |
235 | + btm_db_reset(); | |
236 | + | |
237 | + btsnd_hcic_reset(LOCAL_BR_EDR_CONTROLLER_ID); | |
238 | +} | |
239 | + | |
229 | 240 | /******************************************************************************* |
230 | 241 | ** |
231 | 242 | ** Function BTM_IsDeviceUp |
@@ -1153,7 +1153,7 @@ static void btu_hcif_hardware_error_evt (UINT8 *p) | ||
1153 | 1153 | |
1154 | 1154 | /* Reset the controller */ |
1155 | 1155 | if (BTM_IsDeviceUp()) |
1156 | - BTM_DeviceReset (NULL); | |
1156 | + BTM_HCI_Reset(); | |
1157 | 1157 | |
1158 | 1158 | if(*p == 0x0f || (*p == 0x0a)) |
1159 | 1159 | { |
@@ -726,6 +726,21 @@ BOOLEAN btsnd_hcic_write_def_policy_set (UINT16 settings) | ||
726 | 726 | return (TRUE); |
727 | 727 | } |
728 | 728 | |
729 | +BOOLEAN btsnd_hcic_reset (UINT8 local_controller_id) | |
730 | +{ | |
731 | + BT_HDR *p = (BT_HDR *)osi_malloc(HCI_CMD_BUF_SIZE); | |
732 | + UINT8 *pp = (UINT8 *)(p + 1); | |
733 | + | |
734 | + p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RESET; | |
735 | + p->offset = 0; | |
736 | + | |
737 | + UINT16_TO_STREAM (pp, HCI_RESET); | |
738 | + UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RESET); | |
739 | + | |
740 | + btu_hcif_send_cmd (local_controller_id, p); | |
741 | + return (TRUE); | |
742 | +} | |
743 | + | |
729 | 744 | BOOLEAN btsnd_hcic_set_event_filter (UINT8 filt_type, UINT8 filt_cond_type, |
730 | 745 | UINT8 *filt_cond, UINT8 filt_cond_len) |
731 | 746 | { |
@@ -1936,6 +1936,17 @@ extern void BTM_DeviceReset (tBTM_CMPL_CB *p_cb); | ||
1936 | 1936 | |
1937 | 1937 | /******************************************************************************* |
1938 | 1938 | ** |
1939 | +** Function BTM_HCI_Reset | |
1940 | +** | |
1941 | +** Description This function is called to send reset command to the controller. | |
1942 | +** | |
1943 | +** Returns void | |
1944 | +** | |
1945 | +*******************************************************************************/ | |
1946 | +extern void BTM_HCI_Reset (void); | |
1947 | + | |
1948 | +/******************************************************************************* | |
1949 | +** | |
1939 | 1950 | ** Function BTM_IsDeviceUp |
1940 | 1951 | ** |
1941 | 1952 | ** Description This function is called to check if the device is up. |
@@ -1861,6 +1861,20 @@ extern tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK *p_ener_cback | ||
1861 | 1861 | *******************************************************************************/ |
1862 | 1862 | extern tBTM_STATUS BTM_SetBleDataLength(BD_ADDR bd_addr, UINT16 tx_pdu_length); |
1863 | 1863 | |
1864 | + | |
1865 | + | |
1866 | +/******************************************************************************* | |
1867 | +** | |
1868 | +** Function BTM_GetRemoteDeviceName | |
1869 | +** | |
1870 | +** Description This function is called to get the dev name of remote device | |
1871 | +** from NV | |
1872 | +** | |
1873 | +** Returns TRUE if success; otherwise failed. | |
1874 | +** | |
1875 | +*******************************************************************************/ | |
1876 | +extern BOOLEAN BTM_GetRemoteDeviceName(BD_ADDR bda, BD_NAME bdname); | |
1877 | + | |
1864 | 1878 | #ifdef __cplusplus |
1865 | 1879 | } |
1866 | 1880 | #endif |
@@ -494,6 +494,10 @@ extern BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all | ||
494 | 494 | #define HCI_DELETE_KEY_ALL_FLAG_OFF 6 |
495 | 495 | /* Delete Stored Key */ |
496 | 496 | |
497 | +extern BOOLEAN btsnd_hcic_reset(UINT8 local_controller_id); /* Reset */ | |
498 | + | |
499 | +#define HCIC_PARAM_SIZE_RESET 0 /* Reset */ | |
500 | + | |
497 | 501 | /* Change Local Name */ |
498 | 502 | extern BOOLEAN btsnd_hcic_change_name(BD_NAME name); |
499 | 503 |
@@ -31,6 +31,7 @@ | ||
31 | 31 | #include "btm_int.h" |
32 | 32 | #include "hcimsgs.h" |
33 | 33 | #include "device/include/controller.h" |
34 | +#include "device/include/interop.h" | |
34 | 35 | #include "stack_config.h" |
35 | 36 | |
36 | 37 | #if (BLE_INCLUDED == TRUE) |
@@ -283,6 +284,7 @@ void l2cble_notify_le_connection (BD_ADDR bda) | ||
283 | 284 | tL2C_LCB *p_lcb = l2cu_find_lcb_by_bd_addr (bda, BT_TRANSPORT_LE); |
284 | 285 | tACL_CONN *p_acl = btm_bda_to_acl(bda, BT_TRANSPORT_LE) ; |
285 | 286 | tL2C_CCB *p_ccb; |
287 | + BD_NAME bdname; | |
286 | 288 | |
287 | 289 | if (p_lcb != NULL && p_acl != NULL && p_lcb->link_state != LST_CONNECTED) |
288 | 290 | { |
@@ -305,7 +307,12 @@ void l2cble_notify_le_connection (BD_ADDR bda) | ||
305 | 307 | l2c_csm_execute (p_ccb, L2CEVT_LP_CONNECT_CFM, NULL); |
306 | 308 | } |
307 | 309 | |
308 | - l2cble_use_preferred_conn_params(bda); | |
310 | + | |
311 | + if (!BTM_GetRemoteDeviceName(bda, bdname) || !*bdname || | |
312 | + (!interop_match_name(INTEROP_DISABLE_LE_CONN_PREFERRED_PARAMS, (const char*) bdname))) | |
313 | + { | |
314 | + l2cble_use_preferred_conn_params(bda); | |
315 | + } | |
309 | 316 | } |
310 | 317 | |
311 | 318 | /******************************************************************************* |