#include <hardware/bluetooth.h>
+/**
+ * TODO(armansito): cutils/properties.h is only being used to pull-in runtime
+ * settings on Android. Remove this conditional include once we have a generic
+ * way to obtain system properties.
+ */
+#if !defined(OS_GENERIC)
#include <cutils/properties.h>
-#include "gki.h"
-#include "btu.h"
-#include "btcore/include/bdaddr.h"
+#endif /* !defined(OS_GENERIC) */
+
+#include "bdaddr.h"
#include "bta_api.h"
+#include "bta_gatt_api.h"
#include "btif_api.h"
-#include "btif_util.h"
+#include "btif_config.h"
#include "btif_dm.h"
-#include "btif_storage.h"
#include "btif_hh.h"
-#include "btif_config.h"
#include "btif_sdp.h"
+#include "btif_storage.h"
+#include "btif_util.h"
+#include "btu.h"
+#include "gki.h"
+ #include "bta_gatt_api.h"
+ #include "device/include/interop.h"
+ #include "include/stack_config.h"
+ #include "osi/include/log.h"
#include "osi/include/allocator.h"
+#include "osi/include/log.h"
+#include "stack_config.h"
/******************************************************************************
- ** Device specific workarounds
- ******************************************************************************/
-
- /**
- * The devices below have proven problematic during the pairing process, often
- * requiring multiple retries to complete pairing. To avoid degrading the user
- * experience for other devices, explicitely blacklist troubled devices here.
- */
- static const UINT8 blacklist_pairing_retries[][3] = {
- {0x9C, 0xDF, 0x03} // BMW car kits (Harman/Becker)
- };
-
- BOOLEAN blacklistPairingRetries(BD_ADDR bd_addr)
- {
- const unsigned blacklist_size = sizeof(blacklist_pairing_retries)
- / sizeof(blacklist_pairing_retries[0]);
- for (unsigned i = 0; i != blacklist_size; ++i)
- {
- if (blacklist_pairing_retries[i][0] == bd_addr[0] &&
- blacklist_pairing_retries[i][1] == bd_addr[1] &&
- blacklist_pairing_retries[i][2] == bd_addr[2])
- return TRUE;
- }
- return FALSE;
- }
-
- /******************************************************************************
** Constants & Macros
******************************************************************************/
sizeof(uint32_t), &remote_cod);
if (btif_storage_get_remote_device_property((bt_bdaddr_t *)remote_bdaddr, &prop_name) == BT_STATUS_SUCCESS)
{
- LOG_INFO("%s remote_cod = 0x%08x cod = 0x%08x", __func__, remote_cod, cod);
+ LOG_INFO(LOG_TAG, "%s remote_cod = 0x%08x cod = 0x%08x", __func__, remote_cod, cod);
if ((remote_cod & 0x7ff) == cod)
return TRUE;
}
btm_status = BTM_ReadRemoteVersion(*(BD_ADDR*)p_bd, &lmp_ver,
&mfct_set, &lmp_subver);
- LOG_DEBUG("remote version info [%s]: %x, %x, %x", bdaddr_to_string(p_bd, bdstr, sizeof(bdstr)),
+ LOG_DEBUG(LOG_TAG, "remote version info [%s]: %x, %x, %x", bdaddr_to_string(p_bd, bdstr, sizeof(bdstr)),
lmp_ver, mfct_set, lmp_subver);
if (btm_status == BTM_SUCCESS)
cod = devclass2uint(p_ssp_cfm_req->dev_class);
if (cod == 0) {
- LOG_DEBUG("%s cod is 0, set as unclassified", __func__);
+ LOG_DEBUG(LOG_TAG, "%s cod is 0, set as unclassified", __func__);
cod = COD_UNCLASSIFIED;
}
cod = devclass2uint(p_ssp_key_notif->dev_class);
if (cod == 0) {
- LOG_DEBUG("%s cod is 0, set as unclassified", __func__);
+ LOG_DEBUG(LOG_TAG, "%s cod is 0, set as unclassified", __func__);
cod = COD_UNCLASSIFIED;
}
if (check_sdp_bl(&bd_addr) && check_cod_hid(&bd_addr, COD_HID_MAJOR))
{
- LOG_WARN("%s:skip SDP", __FUNCTION__);
+ LOG_WARN(LOG_TAG, "%s:skip SDP", __FUNCTION__);
skip_sdp = TRUE;
}
if(!pairing_cb.is_local_initiated && skip_sdp)
{
bond_state_changed(status, &bd_addr, state);
- LOG_WARN("%s: Incoming HID Connection",__FUNCTION__);
+ LOG_WARN(LOG_TAG, "%s: Incoming HID Connection",__FUNCTION__);
bt_property_t prop;
bt_bdaddr_t bd_addr;
bt_uuid_t uuid;
switch(p_auth_cmpl->fail_reason)
{
case HCI_ERR_PAGE_TIMEOUT:
- if (blacklistPairingRetries(bd_addr.address) && pairing_cb.timeout_retries)
+ if (interop_match(INTEROP_AUTO_RETRY_PAIRING, &bd_addr)
+ && pairing_cb.timeout_retries)
{
BTIF_TRACE_WARNING("%s() - Pairing timeout; retrying (%d) ...", __FUNCTION__, pairing_cb.timeout_retries);
--pairing_cb.timeout_retries;
cod = devclass2uint (p_search_data->inq_res.dev_class);
if (cod == 0) {
- LOG_DEBUG("%s cod is 0, set as unclassified", __func__);
+ LOG_DEBUG(LOG_TAG, "%s cod is 0, set as unclassified", __func__);
cod = COD_UNCLASSIFIED;
}
{
char temp[256];
uuid_to_string_legacy((bt_uuid_t*)(p_data->disc_res.p_uuid_list + (i*MAX_UUID_SIZE)), temp);
- LOG_INFO("%s index:%d uuid:%s", __func__, i, temp);
+ LOG_INFO(LOG_TAG, "%s index:%d uuid:%s", __func__, i, temp);
}
}
}
uuid_to_string_legacy(&uuid, temp);
- LOG_INFO("%s uuid:%s", __func__, temp);
+ LOG_INFO(LOG_TAG, "%s uuid:%s", __func__, temp);
bdcpy(bd_addr.address, p_data->disc_ble_res.bd_addr);
prop.type = BT_PROPERTY_UUIDS;
#ifdef BTIF_DM_OOB_TEST
void btif_dm_load_local_oob(void)
{
+ /**
+ * TODO(armansito): On OSs other than Android, the sys/properties.h system
+ * does not exist. Remove this conditional include once we have a generic way
+ * to obtain system properties.
+ */
+#if !defined(OS_GENERIC)
char prop_oob[PROPERTY_VALUE_MAX];
property_get("service.brcm.bt.oob", prop_oob, "3");
BTIF_TRACE_DEBUG("btif_dm_load_local_oob prop_oob = %s",prop_oob);
BTIF_TRACE_DEBUG("btif_dm_load_local_oob: read OOB, call BTA_DmLocalOob()");
BTA_DmLocalOob();
}
-#else
+#else /* (BTM_OOB_INCLUDED != TRUE) */
BTIF_TRACE_ERROR("BTM_OOB_INCLUDED is FALSE!!(btif_dm_load_local_oob)");
-#endif
+#endif /* (BTM_OOB_INCLUDED == TRUE) */
}
+#endif /* !defined(OS_GENERIC) */
}
void btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r)
{
+ /**
+ * TODO(armansito): On OSs other than Android, the sys/properties.h system
+ * does not exist. Remove this conditional include once we have a generic way
+ * to obtain system properties.
+ */
+#if !defined(OS_GENERIC)
FILE *fp;
char *path_a = "/data/misc/bluedroid/LOCAL/a.key";
char *path_b = "/data/misc/bluedroid/LOCAL/b.key";
}
}
}
+#endif /* !defined(OS_GENERIC) */
}
+
BOOLEAN btif_dm_proc_rmt_oob(BD_ADDR bd_addr, BT_OCTET16 p_c, BT_OCTET16 p_r)
{
+ /**
+ * TODO(armansito): On OSs other than Android, the sys/properties.h system
+ * does not exist. Remove this conditional include once we have a generic way
+ * to obtain system properties.
+ */
+#if !defined(OS_GENERIC)
char t[128];
FILE *fp;
char *path_a = "/data/misc/bluedroid/LOCAL/a.key";
}
BTIF_TRACE_DEBUG("btif_dm_proc_rmt_oob result=%d",result);
return result;
+#else /* defined(OS_GENERIC) */
+ return FALSE;
+#endif /* !defined(OS_GENERIC) */
}
#endif /* BTIF_DM_OOB_TEST */
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
}
static char* btif_get_default_local_name() {
+ /**
+ * TODO(armansito): On OSs other than Android, the sys/properties.h system
+ * does not exist. Remove this conditional include once we have a generic way
+ * to obtain system properties.
+ */
+#if !defined(OS_GENERIC)
if (btif_default_local_name[0] == '\0')
{
int max_len = sizeof(btif_default_local_name) - 1;
}
btif_default_local_name[max_len] = '\0';
}
+#endif /* !defined(OS_GENERIC) */
return btif_default_local_name;
}