diff options
author | Andre Eisenbach <eisenbach@google.com> | 2015-05-08 17:42:10 -0700 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-05-14 16:51:12 +0000 |
commit | 1287166da9c34f041d54a78800b79cb2738675a9 (patch) | |
tree | 810d92fe988a92a02f9f32c3f3185b75c9e5e99c | |
parent | b4180cf8a5d70f9e1e815b64ba5e1df25d2fdda4 (diff) | |
download | android_system_bt-1287166da9c34f041d54a78800b79cb2738675a9.tar.gz android_system_bt-1287166da9c34f041d54a78800b79cb2738675a9.tar.bz2 android_system_bt-1287166da9c34f041d54a78800b79cb2738675a9.zip |
DO NOT MERGE Fix compilation on platforms with BLE_INCLUDED == FALSE
This is not a comprehensive fix. More work is necessary to ensure the
correct separation of BLE_INCLUDED TRUE/FALSE as well as removing many
of the hacked-up if() statements resulting from this patch.
Change-Id: I1812594feba0bf43369096e472a8b18cde305255
-rw-r--r-- | bta/dm/bta_dm_act.c | 7 | ||||
-rw-r--r-- | btif/src/btif_dm.c | 7 | ||||
-rw-r--r-- | stack/btm/btm_dev.c | 6 | ||||
-rw-r--r-- | stack/btm/btm_int.h | 7 | ||||
-rw-r--r-- | stack/btm/btm_sec.c | 14 | ||||
-rw-r--r-- | stack/l2cap/l2c_api.c | 4 | ||||
-rw-r--r-- | stack/l2cap/l2c_link.c | 4 | ||||
-rw-r--r-- | stack/l2cap/l2c_main.c | 4 | ||||
-rw-r--r-- | stack/smp/smp_act.c | 3 | ||||
-rw-r--r-- | stack/smp/smp_br_main.c | 4 | ||||
-rw-r--r-- | stack/smp/smp_int.h | 4 |
11 files changed, 49 insertions, 15 deletions
diff --git a/bta/dm/bta_dm_act.c b/bta/dm/bta_dm_act.c index 8f54d7af9..23dd0a17f 100644 --- a/bta/dm/bta_dm_act.c +++ b/bta/dm/bta_dm_act.c @@ -2728,9 +2728,10 @@ static UINT8 bta_dm_new_link_key_cback(BD_ADDR bd_addr, DEV_CLASS dev_class, memcpy(p_auth_cmpl->key, key, LINK_KEY_LEN); sec_event.auth_cmpl.fail_reason = HCI_SUCCESS; +#if BLE_INCLUDED == TRUE // Report the BR link key based on the BR/EDR address and type BTM_ReadDevInfo(bd_addr, &sec_event.auth_cmpl.dev_type, &sec_event.auth_cmpl.addr_type); - +#endif if(bta_dm_cb.p_sec_cback) bta_dm_cb.p_sec_cback(event, &sec_event); } @@ -2765,8 +2766,10 @@ static UINT8 bta_dm_authentication_complete_cback(BD_ADDR bd_addr, DEV_CLASS dev memcpy(sec_event.auth_cmpl.bd_name, bd_name, (BD_NAME_LEN-1)); sec_event.auth_cmpl.bd_name[BD_NAME_LEN-1] = 0; +#if BLE_INCLUDED == TRUE // Report the BR link key based on the BR/EDR address and type BTM_ReadDevInfo(bd_addr, &sec_event.auth_cmpl.dev_type, &sec_event.auth_cmpl.addr_type); +#endif sec_event.auth_cmpl.fail_reason = (UINT8)result; if(bta_dm_cb.p_sec_cback) @@ -4385,7 +4388,9 @@ static UINT8 bta_dm_ble_smp_cback (tBTM_LE_EVT event, BD_ADDR bda, tBTM_LE_EVT_D case BTM_LE_COMPLT_EVT: bdcpy(sec_event.auth_cmpl.bd_addr, bda); +#if BLE_INCLUDED == TRUE BTM_ReadDevInfo(bda, &sec_event.auth_cmpl.dev_type, &sec_event.auth_cmpl.addr_type); +#endif p_name = BTM_SecReadDevName(bda); if (p_name != NULL) { diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c index ddb77b094..7b96bc918 100644 --- a/btif/src/btif_dm.c +++ b/btif/src/btif_dm.c @@ -130,6 +130,7 @@ BOOLEAN blacklistPairingRetries(BD_ADDR bd_addr) typedef struct { bt_bond_state_t state; + bt_bdaddr_t static_bdaddr; BD_ADDR bd_addr; UINT8 bond_type; UINT8 pin_code_len; @@ -143,7 +144,6 @@ typedef struct #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) BOOLEAN is_le_only; BOOLEAN is_le_nc; /* LE Numeric comparison */ - bt_bdaddr_t static_bdaddr; btif_dm_ble_cb_t ble; #endif } btif_dm_pairing_cb_t; @@ -1115,7 +1115,9 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl) // Skip SDP for certain HID Devices if (p_auth_cmpl->success) { +#if BLE_INCLUDED == TRUE btif_storage_set_remote_addr_type(&bd_addr, p_auth_cmpl->addr_type); +#endif btif_update_remote_properties(p_auth_cmpl->bd_addr, p_auth_cmpl->bd_name, NULL, p_auth_cmpl->dev_type); pairing_cb.timeout_retries = 0; @@ -1152,6 +1154,8 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl) { /* Trigger SDP on the device */ pairing_cb.sdp_attempts = 1;; + +#if BLE_INCLUDED == TRUE /* If bonded due to cross-key, save the static address too*/ if(pairing_cb.state == BT_BOND_STATE_BONDING && (bdcmp(p_auth_cmpl->bd_addr, pairing_cb.bd_addr) != 0)) @@ -1160,6 +1164,7 @@ static void btif_dm_auth_cmpl_evt (tBTA_DM_AUTH_CMPL *p_auth_cmpl) __func__); bdcpy(pairing_cb.static_bdaddr.address, p_auth_cmpl->bd_addr); } +#endif if(btif_dm_inquiry_in_progress) btif_dm_cancel_discovery(); diff --git a/stack/btm/btm_dev.c b/stack/btm/btm_dev.c index faae4f56d..88171013c 100644 --- a/stack/btm/btm_dev.c +++ b/stack/btm/btm_dev.c @@ -441,12 +441,14 @@ tBTM_SEC_DEV_REC *btm_find_dev(BD_ADDR bd_addr) if (!memcmp (p_dev_rec->bd_addr, bd_addr, BD_ADDR_LEN)) return(p_dev_rec); +#if BLE_INCLUDED == TRUE // If a LE random address is looking for device record if (!memcmp(p_dev_rec->ble.pseudo_addr, bd_addr, BD_ADDR_LEN)) return (p_dev_rec); if (btm_ble_addr_resolvable(bd_addr, p_dev_rec)) return(p_dev_rec); +#endif } } } @@ -464,6 +466,7 @@ tBTM_SEC_DEV_REC *btm_find_dev(BD_ADDR bd_addr) *******************************************************************************/ void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec) { +#if BLE_INCLUDED == TRUE tBTM_SEC_DEV_REC *p_dev_rec = &btm_cb.sec_dev_rec[0]; tBTM_SEC_DEV_REC temp_rec = *p_target_rec; BD_ADDR dummy_bda = {0}; @@ -478,8 +481,8 @@ void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec) { memcpy(p_target_rec, p_dev_rec, sizeof(tBTM_SEC_DEV_REC)); p_target_rec->ble = temp_rec.ble; - p_target_rec->enc_key_size = temp_rec.enc_key_size; p_target_rec->ble_hci_handle = temp_rec.ble_hci_handle; + p_target_rec->enc_key_size = temp_rec.enc_key_size; p_target_rec->conn_params = temp_rec.conn_params; p_target_rec->device_type |= temp_rec.device_type; p_target_rec->sec_flags |= temp_rec.sec_flags; @@ -504,6 +507,7 @@ void btm_consolidate_dev(tBTM_SEC_DEV_REC *p_target_rec) } } } +#endif } /******************************************************************************* diff --git a/stack/btm/btm_int.h b/stack/btm/btm_int.h index d56d261ab..2f3cea95a 100644 --- a/stack/btm/btm_int.h +++ b/stack/btm/btm_int.h @@ -573,12 +573,9 @@ typedef struct /* HCI_IO_CAPABILITY_REQUEST_EVT from the peer before */ /* it knows peer's support for Secure Connections */ -#if (BLE_INCLUDED == TRUE) UINT16 ble_hci_handle; /* use in DUMO connection */ UINT8 enc_key_size; /* current link encryption key size */ - tBTM_SEC_BLE ble; tBT_DEVICE_TYPE device_type; - tBTM_LE_CONN_PRAMS conn_params; BOOLEAN new_encryption_key_is_p256; /* Set to TRUE when the newly generated LK ** is generated from P-256. ** Link encrypted with such LK can be used @@ -587,6 +584,10 @@ typedef struct BOOLEAN no_smp_on_br; /* if set to TRUE then SMP on BR/EDR doesn't */ /* work, i.e. link keys crosspairing */ /* SC BR/EDR->SC LE doesn't happen */ + +#if BLE_INCLUDED == TRUE + tBTM_SEC_BLE ble; + tBTM_LE_CONN_PRAMS conn_params; #endif // btla-specific ++ diff --git a/stack/btm/btm_sec.c b/stack/btm/btm_sec.c index 33d0efc22..309ae8247 100644 --- a/stack/btm/btm_sec.c +++ b/stack/btm/btm_sec.c @@ -5873,9 +5873,11 @@ void btm_sec_dev_rec_cback_event (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 res, BOOLEA { p_dev_rec->p_callback = NULL; +#if BLE_INCLUDED == TRUE if (is_le_transport) (*p_callback) (p_dev_rec->ble.pseudo_addr, BT_TRANSPORT_LE, p_dev_rec->p_ref_data, res); else +#endif (*p_callback) (p_dev_rec->bd_addr, BT_TRANSPORT_BR_EDR, p_dev_rec->p_ref_data, res); } @@ -6131,7 +6133,6 @@ static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRA tBTM_SEC_QUEUE_ENTRY *p_e; BUFFER_Q *bq = &btm_cb.sec_pending_q; UINT8 res = encr_enable ? BTM_SUCCESS : BTM_ERR_PROCESSING; - UINT8 sec_act ; p_e = (tBTM_SEC_QUEUE_ENTRY *)GKI_getfirst(bq); @@ -6143,7 +6144,9 @@ static void btm_sec_check_pending_enc_req (tBTM_SEC_DEV_REC *p_dev_rec, tBT_TRA #endif ) { - sec_act = *(UINT8 *)(p_e->p_ref_data); +#if BLE_INCLUDED == TRUE + UINT8 sec_act = *(UINT8 *)(p_e->p_ref_data); +#endif if (encr_enable == 0 || transport == BT_TRANSPORT_BR_EDR #if BLE_INCLUDED == TRUE @@ -6178,7 +6181,6 @@ static UINT16 btm_sec_set_serv_level4_flags(UINT16 cur_security, BOOLEAN is_orig return cur_security | sec_level4_flags; } -#if (BLE_INCLUDED == TRUE) /******************************************************************************* ** ** Function btm_sec_clear_ble_keys @@ -6220,8 +6222,10 @@ BOOLEAN btm_sec_is_a_bonded_dev (BD_ADDR bda) BOOLEAN is_bonded= FALSE; if (p_dev_rec && -#if (SMP_INCLUDED== TRUE) +#if (SMP_INCLUDED == TRUE) ((p_dev_rec->ble.key_type && (p_dev_rec->sec_flags & BTM_SEC_LE_LINK_KEY_KNOWN))|| +#else + ( #endif (p_dev_rec->sec_flags & BTM_SEC_LINK_KEY_KNOWN))) { @@ -6340,5 +6344,3 @@ static BOOLEAN btm_sec_is_master(tBTM_SEC_DEV_REC *p_dev_rec) return (p && (p->link_role == BTM_ROLE_MASTER)); } -#endif /* BLE_INCLUDED */ - diff --git a/stack/l2cap/l2c_api.c b/stack/l2cap/l2c_api.c index 3a8d5de48..e7dbf36e2 100644 --- a/stack/l2cap/l2c_api.c +++ b/stack/l2cap/l2c_api.c @@ -1420,9 +1420,11 @@ BOOLEAN L2CA_ConnectFixedChnl (UINT16 fixed_cid, BD_ADDR rem_bda) // Fixed channels are mandatory on LE transports so ignore the received // channel mask and use the locally cached LE channel mask. +#if BLE_INCLUDED == TRUE if (transport == BT_TRANSPORT_LE) peer_channel_mask = l2cb.l2c_ble_fixed_chnls_mask; else +#endif peer_channel_mask = p_lcb->peer_chnl_mask[0]; // Check for supported channel @@ -1544,9 +1546,11 @@ UINT16 L2CA_SendFixedChnlData (UINT16 fixed_cid, BD_ADDR rem_bda, BT_HDR *p_buf) tL2C_BLE_FIXED_CHNLS_MASK peer_channel_mask; // Select peer channels mask to use depending on transport +#if BLE_INCLUDED == TRUE if (transport == BT_TRANSPORT_LE) peer_channel_mask = l2cb.l2c_ble_fixed_chnls_mask; else +#endif peer_channel_mask = p_lcb->peer_chnl_mask[0]; if ((peer_channel_mask & (1 << fixed_cid)) == 0) diff --git a/stack/l2cap/l2c_link.c b/stack/l2cap/l2c_link.c index 97bf58d9b..822257e1c 100644 --- a/stack/l2cap/l2c_link.c +++ b/stack/l2cap/l2c_link.c @@ -1156,11 +1156,13 @@ void l2c_link_check_send_pkts (tL2C_LCB *p_lcb, tL2C_CCB *p_ccb, BT_HDR *p_buf) (l2cb.round_robin_unacked >= l2cb.round_robin_quota)) #if (BLE_INCLUDED == TRUE) && (p_lcb->transport == BT_TRANSPORT_BR_EDR) -#endif ) || (p_lcb->transport == BT_TRANSPORT_LE && (l2cb.ble_round_robin_unacked >= l2cb.ble_round_robin_quota || l2cb.controller_le_xmit_window == 0 ))) +#else + )) +#endif break; diff --git a/stack/l2cap/l2c_main.c b/stack/l2cap/l2c_main.c index 212d5dfcd..fcc53d5b1 100644 --- a/stack/l2cap/l2c_main.c +++ b/stack/l2cap/l2c_main.c @@ -186,10 +186,12 @@ void l2c_rcv_acl_data (BT_HDR *p_msg) STREAM_TO_UINT16 (l2cap_len, p); STREAM_TO_UINT16 (rcv_cid, p); +#if BLE_INCLUDED == TRUE /* for BLE channel, always notify connection when ACL data received on the link */ if (p_lcb && p_lcb->transport == BT_TRANSPORT_LE && p_lcb->link_state != LST_DISCONNECTING) /* only process fixed channel data as channel open indication when link is not in disconnecting mode */ l2cble_notify_le_connection(p_lcb->remote_bd_addr); +#endif /* Find the CCB for this CID */ if (rcv_cid >= L2CAP_BASE_APPL_CID) @@ -894,8 +896,10 @@ void l2c_init (void) l2cb.high_pri_min_xmit_quota = L2CAP_HIGH_PRI_MIN_XMIT_QUOTA; #endif +#if BLE_INCLUDED == TRUE l2cb.l2c_ble_fixed_chnls_mask = L2CAP_FIXED_CHNL_ATT_BIT | L2CAP_FIXED_CHNL_BLE_SIG_BIT | L2CAP_FIXED_CHNL_SMP_BIT; +#endif l2cb.rcv_pending_q = list_new(NULL); if (l2cb.rcv_pending_q == NULL) diff --git a/stack/smp/smp_act.c b/stack/smp/smp_act.c index f1c6936cc..7c5bd8e71 100644 --- a/stack/smp/smp_act.c +++ b/stack/smp/smp_act.c @@ -23,6 +23,7 @@ #include "l2c_api.h" #include "smp_int.h" +#if SMP_INCLUDED == TRUE const UINT8 smp_association_table[2][SMP_IO_CAP_MAX][SMP_IO_CAP_MAX] = { /* initiator */ @@ -2088,4 +2089,4 @@ void smp_br_pairing_complete(tSMP_CB *p_cb, tSMP_INT_DATA *p_data) smp_proc_pairing_cmpl(p_cb); } - +#endif diff --git a/stack/smp/smp_br_main.c b/stack/smp/smp_br_main.c index 573db7fbc..11039ec20 100644 --- a/stack/smp/smp_br_main.c +++ b/stack/smp/smp_br_main.c @@ -21,6 +21,8 @@ #include <string.h> #include "smp_int.h" +#if BLE_INCLUDED == TRUE + const char *const smp_br_state_name [SMP_BR_STATE_MAX+1] = { "SMP_BR_STATE_IDLE", @@ -394,4 +396,4 @@ void smp_br_state_machine_event(tSMP_CB *p_cb, tSMP_BR_EVENT event, void *p_data SMP_TRACE_DEBUG( "result state = %s", smp_get_br_state_name( p_cb->br_state ) ) ; } - +#endif diff --git a/stack/smp/smp_int.h b/stack/smp/smp_int.h index 52b03019a..a058bab53 100644 --- a/stack/smp/smp_int.h +++ b/stack/smp/smp_int.h @@ -24,6 +24,8 @@ #ifndef SMP_INT_H #define SMP_INT_H +#if BLE_INCLUDED == TRUE + #include "btu.h" #include "btm_ble_api.h" #include "btm_api.h" @@ -536,4 +538,6 @@ extern BOOLEAN aes_cipher_msg_auth_code(BT_OCTET16 key, UINT8 *input, UINT16 len UINT16 tlen, UINT8 *p_signature); extern void print128(BT_OCTET16 x, const UINT8 *key_name); +#endif + #endif /* SMP_INT_H */ |