Loading system/bta/sys/bta_sys.h +9 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,15 @@ typedef void(tBTA_SYS_DISABLE)(void); typedef uint8_t tBTA_SYS_ID; inline std::string BtaIdSysText(tBTA_SYS_ID sys_id) { switch (sys_id) { case BTA_ID_HD: return std::string("Hid Device"); default: return std::string("Unknown"); } } #define BTA_SYS_CONN_OPEN 0x00 #define BTA_SYS_CONN_CLOSE 0x01 #define BTA_SYS_APP_OPEN 0x02 Loading system/btif/src/btif_sock_rfc.cc +3 −7 Original line number Diff line number Diff line Loading @@ -285,10 +285,6 @@ bt_status_t btsock_rfc_listen(const char* service_name, if ((flags & BTSOCK_FLAG_NO_SDP) == 0) { if (!service_uuid || service_uuid->IsEmpty()) { APPL_TRACE_DEBUG( "%s: service_uuid not set AND BTSOCK_FLAG_NO_SDP is not set - " "changing to SPP", __func__); // Use serial port profile to listen to specified channel service_uuid = &UUID_SPP; } else { Loading @@ -305,10 +301,10 @@ bt_status_t btsock_rfc_listen(const char* service_name, rfc_slot_t* slot = alloc_rfc_slot(NULL, service_name, *service_uuid, channel, flags, true); if (!slot) { LOG_ERROR("%s unable to allocate RFCOMM slot.", __func__); LOG_ERROR("unable to allocate RFCOMM slot"); return BT_STATUS_FAIL; } APPL_TRACE_DEBUG("BTA_JvGetChannelId: service_name: %s - channel: %d", LOG_DEBUG("Adding listening socket service_name: %s - channel: %d", service_name, channel); BTA_JvGetChannelId(BTA_JV_CONN_TYPE_RFCOMM, slot->id, channel); *sock_fd = slot->app_fd; // Transfer ownership of fd to caller. Loading system/btif/src/btif_sock_thread.cc +1 −3 Original line number Diff line number Diff line Loading @@ -150,7 +150,6 @@ static void free_thread_slot(int h) { } void btsock_thread_init() { static int initialized; APPL_TRACE_DEBUG("in initialized:%d", initialized); if (!initialized) { initialized = 1; int h; Loading Loading @@ -409,10 +408,9 @@ static int process_cmd_sock(int h) { OSI_NO_INTR(ret = recv(fd, &cmd, sizeof(cmd), MSG_WAITALL)); if (ret != sizeof(cmd)) { APPL_TRACE_ERROR("recv cmd errno:%d", errno); LOG_ERROR("recv cmd errno:%d", errno); return false; } APPL_TRACE_DEBUG("cmd.id:%d", cmd.id); switch (cmd.id) { case CMD_ADD_FD: add_poll(h, cmd.fd, cmd.type, cmd.flags, cmd.user_id); Loading system/btif/src/btif_storage.cc +9 −14 Original line number Diff line number Diff line Loading @@ -188,12 +188,12 @@ static int prop2cfg(const RawAddress* remote_bd_addr, bt_property_t* prop) { bdstr = remote_bd_addr->ToString(); } BTIF_TRACE_DEBUG("in, bd addr:%s, prop type:%d, len:%d", bdstr.c_str(), prop->type, prop->len); char value[1024]; if (prop->len <= 0 || prop->len > (int)sizeof(value) - 1) { BTIF_TRACE_ERROR("property type:%d, len:%d is invalid", prop->type, prop->len); LOG_WARN( "Unable to save property to configuration file type:%d, " " len:%d is invalid", prop->type, prop->len); return false; } switch (prop->type) { Loading Loading @@ -285,11 +285,9 @@ static int cfg2prop(const RawAddress* remote_bd_addr, bt_property_t* prop) { if (remote_bd_addr) { bdstr = remote_bd_addr->ToString(); } BTIF_TRACE_DEBUG("in, bd addr:%s, prop type:%d, len:%d", bdstr.c_str(), prop->type, prop->len); if (prop->len <= 0) { BTIF_TRACE_ERROR("property type:%d, len:%d is invalid", prop->type, prop->len); LOG_WARN("Invalid property read from configuration file type:%d, len:%d", prop->type, prop->len); return false; } int ret = false; Loading Loading @@ -425,8 +423,6 @@ static bt_status_t btif_in_fetch_bonded_device(const std::string& bdstr) { if ((btif_in_fetch_bonded_ble_device(bdstr, false, NULL) != BT_STATUS_SUCCESS) && (!bt_linkkey_file_found)) { BTIF_TRACE_DEBUG("Remote device:%s, no link key or ble key found", bdstr.c_str()); return BT_STATUS_FAIL; } return BT_STATUS_SUCCESS; Loading Loading @@ -480,8 +476,7 @@ static bt_status_t btif_in_fetch_bonded_devices( } } if (!btif_in_fetch_bonded_ble_device(name, add, p_bonded_devices) && !bt_linkkey_file_found) { BTIF_TRACE_DEBUG("Remote device:%s, no link key or ble key found", name.c_str()); LOG_VERBOSE("No link key or ble key found for device:%s", name.c_str()); } } return BT_STATUS_SUCCESS; Loading Loading @@ -840,7 +835,7 @@ bt_status_t btif_storage_add_bonded_device(RawAddress* remote_bd_addr, bt_status_t btif_storage_remove_bonded_device( const RawAddress* remote_bd_addr) { std::string bdstr = remote_bd_addr->ToString(); BTIF_TRACE_DEBUG("in bd addr:%s", bdstr.c_str()); LOG_DEBUG("Removing bonded device addr:%s", bdstr.c_str()); btif_storage_remove_ble_bonding_keys(remote_bd_addr); Loading Loading @@ -1133,7 +1128,7 @@ bt_status_t btif_storage_get_ble_bonding_key(const RawAddress& remote_bd_addr, bt_status_t btif_storage_remove_ble_bonding_keys( const RawAddress* remote_bd_addr) { std::string bdstr = remote_bd_addr->ToString(); BTIF_TRACE_DEBUG(" %s in bd addr:%s", __func__, bdstr.c_str()); LOG_DEBUG("Removing bonding keys for bd addr:%s", bdstr.c_str()); int ret = 1; if (btif_config_exist(bdstr, "LE_KEY_PENC")) ret &= btif_config_remove(bdstr, "LE_KEY_PENC"); Loading system/stack/btm/btm_ble_addr.cc +4 −4 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ void btm_ble_set_random_address(const RawAddress& random_bda); /* This function generates Resolvable Private Address (RPA) from Identity * Resolving Key |irk| and |random|*/ RawAddress generate_rpa_from_irk_and_rand(const Octet16& irk, static RawAddress generate_rpa_from_irk_and_rand(const Octet16& irk, BT_OCTET8 random) { random[2] &= (~BLE_RESOLVE_ADDR_MASK); random[2] |= BLE_RESOLVE_ADDR_MSB; Loading Loading @@ -223,8 +223,8 @@ tBTM_SEC_DEV_REC* btm_ble_resolve_random_addr(const RawAddress& random_bda) { * address mapping between pseudo address and real connection address ******************************************************************************/ /** Find the security record whose LE identity address is matching */ tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr(const RawAddress& bd_addr, uint8_t addr_type) { static tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr( const RawAddress& bd_addr, uint8_t addr_type) { list_node_t* end = list_end(btm_cb.sec_dev_rec); for (list_node_t* node = list_begin(btm_cb.sec_dev_rec); node != end; node = list_next(node)) { Loading Loading
system/bta/sys/bta_sys.h +9 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,15 @@ typedef void(tBTA_SYS_DISABLE)(void); typedef uint8_t tBTA_SYS_ID; inline std::string BtaIdSysText(tBTA_SYS_ID sys_id) { switch (sys_id) { case BTA_ID_HD: return std::string("Hid Device"); default: return std::string("Unknown"); } } #define BTA_SYS_CONN_OPEN 0x00 #define BTA_SYS_CONN_CLOSE 0x01 #define BTA_SYS_APP_OPEN 0x02 Loading
system/btif/src/btif_sock_rfc.cc +3 −7 Original line number Diff line number Diff line Loading @@ -285,10 +285,6 @@ bt_status_t btsock_rfc_listen(const char* service_name, if ((flags & BTSOCK_FLAG_NO_SDP) == 0) { if (!service_uuid || service_uuid->IsEmpty()) { APPL_TRACE_DEBUG( "%s: service_uuid not set AND BTSOCK_FLAG_NO_SDP is not set - " "changing to SPP", __func__); // Use serial port profile to listen to specified channel service_uuid = &UUID_SPP; } else { Loading @@ -305,10 +301,10 @@ bt_status_t btsock_rfc_listen(const char* service_name, rfc_slot_t* slot = alloc_rfc_slot(NULL, service_name, *service_uuid, channel, flags, true); if (!slot) { LOG_ERROR("%s unable to allocate RFCOMM slot.", __func__); LOG_ERROR("unable to allocate RFCOMM slot"); return BT_STATUS_FAIL; } APPL_TRACE_DEBUG("BTA_JvGetChannelId: service_name: %s - channel: %d", LOG_DEBUG("Adding listening socket service_name: %s - channel: %d", service_name, channel); BTA_JvGetChannelId(BTA_JV_CONN_TYPE_RFCOMM, slot->id, channel); *sock_fd = slot->app_fd; // Transfer ownership of fd to caller. Loading
system/btif/src/btif_sock_thread.cc +1 −3 Original line number Diff line number Diff line Loading @@ -150,7 +150,6 @@ static void free_thread_slot(int h) { } void btsock_thread_init() { static int initialized; APPL_TRACE_DEBUG("in initialized:%d", initialized); if (!initialized) { initialized = 1; int h; Loading Loading @@ -409,10 +408,9 @@ static int process_cmd_sock(int h) { OSI_NO_INTR(ret = recv(fd, &cmd, sizeof(cmd), MSG_WAITALL)); if (ret != sizeof(cmd)) { APPL_TRACE_ERROR("recv cmd errno:%d", errno); LOG_ERROR("recv cmd errno:%d", errno); return false; } APPL_TRACE_DEBUG("cmd.id:%d", cmd.id); switch (cmd.id) { case CMD_ADD_FD: add_poll(h, cmd.fd, cmd.type, cmd.flags, cmd.user_id); Loading
system/btif/src/btif_storage.cc +9 −14 Original line number Diff line number Diff line Loading @@ -188,12 +188,12 @@ static int prop2cfg(const RawAddress* remote_bd_addr, bt_property_t* prop) { bdstr = remote_bd_addr->ToString(); } BTIF_TRACE_DEBUG("in, bd addr:%s, prop type:%d, len:%d", bdstr.c_str(), prop->type, prop->len); char value[1024]; if (prop->len <= 0 || prop->len > (int)sizeof(value) - 1) { BTIF_TRACE_ERROR("property type:%d, len:%d is invalid", prop->type, prop->len); LOG_WARN( "Unable to save property to configuration file type:%d, " " len:%d is invalid", prop->type, prop->len); return false; } switch (prop->type) { Loading Loading @@ -285,11 +285,9 @@ static int cfg2prop(const RawAddress* remote_bd_addr, bt_property_t* prop) { if (remote_bd_addr) { bdstr = remote_bd_addr->ToString(); } BTIF_TRACE_DEBUG("in, bd addr:%s, prop type:%d, len:%d", bdstr.c_str(), prop->type, prop->len); if (prop->len <= 0) { BTIF_TRACE_ERROR("property type:%d, len:%d is invalid", prop->type, prop->len); LOG_WARN("Invalid property read from configuration file type:%d, len:%d", prop->type, prop->len); return false; } int ret = false; Loading Loading @@ -425,8 +423,6 @@ static bt_status_t btif_in_fetch_bonded_device(const std::string& bdstr) { if ((btif_in_fetch_bonded_ble_device(bdstr, false, NULL) != BT_STATUS_SUCCESS) && (!bt_linkkey_file_found)) { BTIF_TRACE_DEBUG("Remote device:%s, no link key or ble key found", bdstr.c_str()); return BT_STATUS_FAIL; } return BT_STATUS_SUCCESS; Loading Loading @@ -480,8 +476,7 @@ static bt_status_t btif_in_fetch_bonded_devices( } } if (!btif_in_fetch_bonded_ble_device(name, add, p_bonded_devices) && !bt_linkkey_file_found) { BTIF_TRACE_DEBUG("Remote device:%s, no link key or ble key found", name.c_str()); LOG_VERBOSE("No link key or ble key found for device:%s", name.c_str()); } } return BT_STATUS_SUCCESS; Loading Loading @@ -840,7 +835,7 @@ bt_status_t btif_storage_add_bonded_device(RawAddress* remote_bd_addr, bt_status_t btif_storage_remove_bonded_device( const RawAddress* remote_bd_addr) { std::string bdstr = remote_bd_addr->ToString(); BTIF_TRACE_DEBUG("in bd addr:%s", bdstr.c_str()); LOG_DEBUG("Removing bonded device addr:%s", bdstr.c_str()); btif_storage_remove_ble_bonding_keys(remote_bd_addr); Loading Loading @@ -1133,7 +1128,7 @@ bt_status_t btif_storage_get_ble_bonding_key(const RawAddress& remote_bd_addr, bt_status_t btif_storage_remove_ble_bonding_keys( const RawAddress* remote_bd_addr) { std::string bdstr = remote_bd_addr->ToString(); BTIF_TRACE_DEBUG(" %s in bd addr:%s", __func__, bdstr.c_str()); LOG_DEBUG("Removing bonding keys for bd addr:%s", bdstr.c_str()); int ret = 1; if (btif_config_exist(bdstr, "LE_KEY_PENC")) ret &= btif_config_remove(bdstr, "LE_KEY_PENC"); Loading
system/stack/btm/btm_ble_addr.cc +4 −4 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ void btm_ble_set_random_address(const RawAddress& random_bda); /* This function generates Resolvable Private Address (RPA) from Identity * Resolving Key |irk| and |random|*/ RawAddress generate_rpa_from_irk_and_rand(const Octet16& irk, static RawAddress generate_rpa_from_irk_and_rand(const Octet16& irk, BT_OCTET8 random) { random[2] &= (~BLE_RESOLVE_ADDR_MASK); random[2] |= BLE_RESOLVE_ADDR_MSB; Loading Loading @@ -223,8 +223,8 @@ tBTM_SEC_DEV_REC* btm_ble_resolve_random_addr(const RawAddress& random_bda) { * address mapping between pseudo address and real connection address ******************************************************************************/ /** Find the security record whose LE identity address is matching */ tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr(const RawAddress& bd_addr, uint8_t addr_type) { static tBTM_SEC_DEV_REC* btm_find_dev_by_identity_addr( const RawAddress& bd_addr, uint8_t addr_type) { list_node_t* end = list_end(btm_cb.sec_dev_rec); for (list_node_t* node = list_begin(btm_cb.sec_dev_rec); node != end; node = list_next(node)) { Loading