Loading system/bta/dm/bta_dm_pm.cc +5 −1 Original line number Diff line number Diff line Loading @@ -938,8 +938,12 @@ static void bta_dm_pm_ssr(const RawAddress& peer_addr, const int ssr) { /* HH has the per connection SSR preference, already read the SSR params * from BTA HH */ if (current_ssr_index == BTA_DM_PM_SSR_HH) { tAclLinkSpec link_spec; link_spec.addrt.bda = peer_addr; link_spec.addrt.type = BLE_ADDR_PUBLIC; link_spec.transport = BT_TRANSPORT_BR_EDR; if (GetInterfaceToProfiles()->profileSpecific_HACK->bta_hh_read_ssr_param( peer_addr, &p_spec_cur->max_lat, &p_spec_cur->min_rmt_to) == link_spec, &p_spec_cur->max_lat, &p_spec_cur->min_rmt_to) == BTA_HH_ERR) { continue; } Loading system/bta/hh/bta_hh_act.cc +38 −32 Original line number Diff line number Diff line Loading @@ -214,7 +214,8 @@ static void bta_hh_sdp_cback(uint16_t result, uint16_t attr_mask, /* if not added before */ if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) { /* add device/update attr_mask information */ if (HID_HostAddDev(p_cb->addr, attr_mask, &hdl) == HID_SUCCESS) { if (HID_HostAddDev(p_cb->link_spec.addrt.bda, attr_mask, &hdl) == HID_SUCCESS) { status = BTA_HH_OK; /* update cb_index[] map */ bta_hh_cb.cb_index[hdl] = p_cb->index; Loading Loading @@ -292,7 +293,7 @@ static void bta_hh_di_sdp_cback(UNUSED_ATTR const RawAddress& bd_addr, bta_hh_update_di_info(p_cb, BTA_HH_VENDOR_ID_INVALID, 0, 0, 0, 0); } ret = HID_HostGetSDPRecord(p_cb->addr, bta_hh_cb.p_disc_db, ret = HID_HostGetSDPRecord(p_cb->link_spec.addrt.bda, bta_hh_cb.p_disc_db, p_bta_hh_cfg->sdp_db_size, bta_hh_sdp_cback); if (ret == HID_SUCCESS) { status = BTA_HH_OK; Loading Loading @@ -330,7 +331,7 @@ static void bta_hh_start_sdp(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { /* Do DI discovery first */ if (get_legacy_stack_sdp_api()->device_id.SDP_DiDiscover( p_data->api_conn.bd_addr, bta_hh_cb.p_disc_db, p_data->api_conn.link_spec.addrt.bda, bta_hh_cb.p_disc_db, p_bta_hh_cfg->sdp_db_size, bta_hh_di_sdp_cback) == SDP_SUCCESS) { /* SDP search started successfully * Connection will be triggered at the end of successful SDP search Loading Loading @@ -377,7 +378,7 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { /* initialize call back data */ memset((void*)&conn_dat, 0, sizeof(tBTA_HH_CONN)); conn_dat.handle = p_cb->hid_handle; conn_dat.bda = p_cb->addr; conn_dat.link_spec = p_cb->link_spec; /* if SDP compl success */ if (status == BTA_HH_OK) { Loading Loading @@ -461,7 +462,8 @@ static void bta_hh_bredr_conn(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) { uint8_t hdl; if (HID_HostAddDev(p_cb->addr, p_cb->attr_mask, &hdl) == HID_SUCCESS) { if (HID_HostAddDev(p_cb->link_spec.addrt.bda, p_cb->attr_mask, &hdl) == HID_SUCCESS) { /* update device CB with newly register device handle */ bta_hh_add_device_to_list(p_cb, hdl, p_cb->attr_mask, NULL, p_cb->sub_class, Loading Loading @@ -496,7 +498,7 @@ void bta_hh_connect(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { bluetooth::Uuid remote_uuids[BT_MAX_NUM_UUIDS] = {}; bt_property_t remote_properties = {BT_PROPERTY_UUIDS, sizeof(remote_uuids), &remote_uuids}; const RawAddress& bd_addr = p_data->api_conn.bd_addr; const RawAddress& bd_addr = p_data->api_conn.link_spec.addrt.bda; // Find the device type tBT_DEVICE_TYPE dev_type; Loading Loading @@ -552,7 +554,7 @@ void bta_hh_connect(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { // Initiate HID host connection if (p_cb->is_le_device) { bta_hh_le_open_conn(p_cb, bd_addr); bta_hh_le_open_conn(p_cb, p_data->api_conn.link_spec); } else { bta_hh_bredr_conn(p_cb, p_data); } Loading @@ -568,13 +570,13 @@ void bta_hh_connect(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { * Returns void * ******************************************************************************/ void btif_hh_remove_device(RawAddress bd_addr); void btif_hh_remove_device(tAclLinkSpec link_spec); void bta_hh_api_disc_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { CHECK(p_cb != nullptr); if (p_cb->is_le_device) { LOG_DEBUG("Host initiating close to le device:%s", ADDRESS_TO_LOGGABLE_CSTR(p_cb->addr)); ADDRESS_TO_LOGGABLE_CSTR(p_cb->link_spec)); bta_hh_le_api_disc_act(p_cb); Loading @@ -585,10 +587,11 @@ void bta_hh_api_disc_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { tHID_STATUS status = HID_HostCloseDev(hid_handle); if (status != HID_SUCCESS) { LOG_WARN("Failed closing classic device:%s status:%s", ADDRESS_TO_LOGGABLE_CSTR(p_cb->addr), hid_status_text(status).c_str()); ADDRESS_TO_LOGGABLE_CSTR(p_cb->link_spec), hid_status_text(status).c_str()); } else { LOG_DEBUG("Host initiated close to classic device:%s", ADDRESS_TO_LOGGABLE_CSTR(p_cb->addr)); ADDRESS_TO_LOGGABLE_CSTR(p_cb->link_spec)); } tBTA_HH bta_hh = { .dev_status = {.status = Loading Loading @@ -616,7 +619,7 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { memset((void*)&conn, 0, sizeof(tBTA_HH_CONN)); conn.handle = dev_handle; conn.bda = p_cb->addr; conn.link_spec = p_cb->link_spec; /* increase connection number */ bta_hh_cb.cnt_num++; Loading @@ -628,7 +631,7 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { conn.attr_mask = p_cb->attr_mask; conn.app_id = p_cb->app_id; BTM_LogHistory(kBtmLogTag, p_cb->addr, "Opened", BTM_LogHistory(kBtmLogTag, p_cb->link_spec.addrt.bda, "Opened", base::StringPrintf( "%s initiator:%s", (p_cb->is_le_device) ? "le" : "classic", (p_cb->incoming_conn) ? "remote" : "local")); Loading @@ -636,7 +639,7 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { if (!p_cb->is_le_device) { /* inform role manager */ bta_sys_conn_open(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_conn_open(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); /* set protocol mode when not default report mode */ if (p_cb->mode != BTA_HH_PROTO_RPT_MODE) { Loading Loading @@ -688,7 +691,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { p_cb->incoming_hid_handle = dev_handle; memset(&conn_data, 0, sizeof(tBTA_HH_API_CONN)); conn_data.bd_addr = p_cb->addr; conn_data.link_spec = p_cb->link_spec; bta_hh_cb.p_cur = p_cb; bta_hh_bredr_conn(p_cb, (tBTA_HH_DATA*)&conn_data); } Loading @@ -712,7 +715,7 @@ void bta_hh_data_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { bta_hh_co_data((uint8_t)p_data->hid_cback.hdr.layer_specific, p_rpt, pdata->len, p_cb->mode, p_cb->sub_class, p_cb->dscp_info.ctry_code, p_cb->addr, p_cb->app_id); p_cb->dscp_info.ctry_code, p_cb->link_spec, p_cb->app_id); osi_free_and_reset((void**)&pdata); } Loading Loading @@ -766,7 +769,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { bta_hh.conn.status = p_data->hid_cback.data ? BTA_HH_ERR_PROTO : BTA_HH_OK; bta_hh.conn.handle = p_cb->hid_handle; bta_hh.conn.bda = p_cb->addr; bta_hh.conn.link_spec = p_cb->link_spec; (*bta_hh_cb.p_cback)(p_cb->w4_evt, &bta_hh); bta_hh_trace_dev_db(); p_cb->w4_evt = 0; Loading @@ -779,7 +782,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { } /* transaction achknoledgement received, inform PM for mode change */ bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); return; } /******************************************************************************* Loading Loading @@ -838,8 +841,8 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { } /* inform PM for mode change */ bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); (*bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH*)&hs_data); Loading @@ -866,7 +869,7 @@ void bta_hh_open_failure(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { conn_dat.handle = p_cb->hid_handle; conn_dat.status = (reason == HID_ERR_AUTH_FAILED) ? BTA_HH_ERR_AUTH_FAILED : BTA_HH_ERR; conn_dat.bda = p_cb->addr; conn_dat.link_spec = p_cb->link_spec; HID_HostCloseDev(p_cb->hid_handle); /* Report OPEN fail event */ Loading Loading @@ -916,14 +919,14 @@ void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { base::StringPrintf("%s %s %s", (l2cap_conn_fail) ? "l2cap_conn_fail" : "", (l2cap_req_fail) ? "l2cap_req_fail" : "", (l2cap_cfg_fail) ? "l2cap_cfg_fail" : ""); BTM_LogHistory(kBtmLogTag, p_cb->addr, "Closed", BTM_LogHistory(kBtmLogTag, p_cb->link_spec.addrt.bda, "Closed", base::StringPrintf("%s reason %s %s", (p_cb->is_le_device) ? "le" : "classic", hid_status_text(hid_status).c_str(), overlay_fail.c_str())); /* inform role manager */ bta_sys_conn_close(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_conn_close(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); /* update total conn number */ bta_hh_cb.cnt_num--; Loading Loading @@ -994,17 +997,18 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { switch (p_dev_info->sub_event) { case BTA_HH_ADD_DEV_EVT: /* add a device */ dev_info.bda = p_dev_info->bda; dev_info.link_spec = p_dev_info->link_spec; /* initialize callback data */ if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) { if (BTM_UseLeLink(p_data->api_conn.bd_addr)) { if (BTM_UseLeLink(p_data->api_conn.link_spec.addrt.bda)) { p_cb->is_le_device = true; dev_info.handle = bta_hh_le_add_device(p_cb, p_dev_info); if (dev_info.handle != BTA_HH_INVALID_HANDLE) dev_info.status = BTA_HH_OK; } else if (HID_HostAddDev(p_dev_info->bda, p_dev_info->attr_mask, if (HID_HostAddDev(p_dev_info->link_spec.addrt.bda, p_dev_info->attr_mask, &dev_handle) == HID_SUCCESS) { dev_info.handle = dev_handle; dev_info.status = BTA_HH_OK; Loading Loading @@ -1034,7 +1038,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { break; case BTA_HH_RMV_DEV_EVT: /* remove device */ dev_info.handle = (uint8_t)p_dev_info->hdr.layer_specific; dev_info.bda = p_cb->addr; dev_info.link_spec = p_cb->link_spec; if (p_cb->is_le_device) { bta_hh_le_remove_dev_bg_conn(p_cb); Loading Loading @@ -1164,12 +1168,12 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { /* if not control type transaction, notify PM for energy control */ if (p_data->api_sndcmd.t_type != HID_TRANS_CONTROL) { /* inform PM for mode change */ bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); } else if (api_sndcmd_param == BTA_HH_CTRL_SUSPEND) { bta_sys_sco_close(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_sco_close(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); } else if (api_sndcmd_param == BTA_HH_CTRL_EXIT_SUSPEND) { bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); } } } Loading Loading @@ -1235,7 +1239,9 @@ static void bta_hh_cback(uint8_t dev_handle, const RawAddress& addr, p_buf->hdr.event = sm_event; p_buf->hdr.layer_specific = (uint16_t)dev_handle; p_buf->data = data; p_buf->addr = addr; p_buf->link_spec.addrt.bda = addr; p_buf->link_spec.addrt.type = BLE_ADDR_PUBLIC; p_buf->link_spec.transport = BT_TRANSPORT_BR_EDR; p_buf->p_data = pdata; bta_sys_sendmsg(p_buf); Loading system/bta/hh/bta_hh_api.cc +7 −7 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ void BTA_HhClose(uint8_t dev_handle) { * Returns void * ******************************************************************************/ void BTA_HhOpen(const RawAddress& dev_bda) { void BTA_HhOpen(const tAclLinkSpec& link_spec) { tBTA_HH_API_CONN* p_buf = (tBTA_HH_API_CONN*)osi_calloc(sizeof(tBTA_HH_API_CONN)); tBTA_HH_PROTO_MODE mode = BTA_HH_PROTO_RPT_MODE; Loading @@ -115,7 +115,7 @@ void BTA_HhOpen(const RawAddress& dev_bda) { p_buf->hdr.event = BTA_HH_API_OPEN_EVT; p_buf->hdr.layer_specific = BTA_HH_INVALID_HANDLE; p_buf->mode = mode; p_buf->bd_addr = dev_bda; p_buf->link_spec = link_spec; bta_sys_sendmsg((void*)p_buf); } Loading Loading @@ -244,7 +244,7 @@ void BTA_HhSendCtrl(uint8_t dev_handle, tBTA_HH_TRANS_CTRL_TYPE c_type) { * Description This function send DATA transaction to HID device. * * Parameter dev_handle: device handle * dev_bda: remote device address * link_spec : remote device acl link specification * p_data: data to be sent in the DATA transaction; or * the data to be write into the Output Report of a LE * HID device. The report is identified the report ID Loading @@ -256,8 +256,8 @@ void BTA_HhSendCtrl(uint8_t dev_handle, tBTA_HH_TRANS_CTRL_TYPE c_type) { * Returns void * ******************************************************************************/ void BTA_HhSendData(uint8_t dev_handle, UNUSED_ATTR const RawAddress& dev_bda, BT_HDR* p_data) { void BTA_HhSendData(uint8_t dev_handle, UNUSED_ATTR const tAclLinkSpec& link_spec, BT_HDR* p_data) { if (p_data->layer_specific != BTA_HH_RPTT_OUTPUT) { LOG_ERROR( "ERROR! Wrong report type! Write Command only valid for output " Loading Loading @@ -298,7 +298,7 @@ void BTA_HhGetDscpInfo(uint8_t dev_handle) { * Returns void * ******************************************************************************/ void BTA_HhAddDev(const RawAddress& bda, tBTA_HH_ATTR_MASK attr_mask, void BTA_HhAddDev(const tAclLinkSpec& link_spec, tBTA_HH_ATTR_MASK attr_mask, uint8_t sub_class, uint8_t app_id, tBTA_HH_DEV_DSCP_INFO dscp_info) { size_t len = sizeof(tBTA_HH_MAINT_DEV) + dscp_info.descriptor.dl_len; Loading @@ -311,7 +311,7 @@ void BTA_HhAddDev(const RawAddress& bda, tBTA_HH_ATTR_MASK attr_mask, p_buf->attr_mask = (uint16_t)attr_mask; p_buf->sub_class = sub_class; p_buf->app_id = app_id; p_buf->bda = bda; p_buf->link_spec = link_spec; memcpy(&p_buf->dscp_info, &dscp_info, sizeof(tBTA_HH_DEV_DSCP_INFO)); if (dscp_info.descriptor.dl_len != 0 && dscp_info.descriptor.dsc_list) { Loading system/bta/hh/bta_hh_int.h +8 −8 Original line number Diff line number Diff line Loading @@ -82,21 +82,21 @@ typedef struct { typedef struct { BT_HDR_RIGID hdr; RawAddress bd_addr; tAclLinkSpec link_spec; tBTA_HH_PROTO_MODE mode; } tBTA_HH_API_CONN; /* internal event data from BTE HID callback */ typedef struct { BT_HDR_RIGID hdr; RawAddress addr; tAclLinkSpec link_spec; uint32_t data; BT_HDR* p_data; } tBTA_HH_CBACK_DATA; typedef struct { BT_HDR_RIGID hdr; RawAddress bda; tAclLinkSpec link_spec; uint16_t attr_mask; uint16_t sub_event; uint8_t sub_class; Loading Loading @@ -181,7 +181,7 @@ typedef struct { /* device control block */ typedef struct { tBTA_HH_DEV_DSCP_INFO dscp_info; /* report descriptor and DI information */ RawAddress addr; /* BD-Addr of the HID device */ tAclLinkSpec link_spec; /* ACL link specification of the HID device */ uint16_t attr_mask; /* attribute mask */ uint16_t w4_evt; /* W4_handshake event name */ uint8_t index; /* index number referenced to handle index */ Loading Loading @@ -266,8 +266,8 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data); void bta_hh_open_failure(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data); /* utility functions */ uint8_t bta_hh_find_cb(const RawAddress& bda); tBTA_HH_DEV_CB* bta_hh_get_cb(const RawAddress& bda); uint8_t bta_hh_find_cb(const tAclLinkSpec& link_spec); tBTA_HH_DEV_CB* bta_hh_get_cb(const tAclLinkSpec& link_spec); bool bta_hh_tod_spt(tBTA_HH_DEV_CB* p_cb, uint8_t sub_class); void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB* p_cb); Loading @@ -289,14 +289,14 @@ void bta_hh_api_enable(tBTA_HH_CBACK* p_cback, bool enable_hid, void bta_hh_api_disable(void); void bta_hh_disc_cmpl(void); tBTA_HH_STATUS bta_hh_read_ssr_param(const RawAddress& bd_addr, tBTA_HH_STATUS bta_hh_read_ssr_param(const tAclLinkSpec& link_spec, uint16_t* p_max_ssr_lat, uint16_t* p_min_ssr_tout); /* functions for LE HID */ void bta_hh_le_enable(void); void bta_hh_le_deregister(void); void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda); void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, const tAclLinkSpec& link_spec); void bta_hh_le_api_disc_act(tBTA_HH_DEV_CB* p_cb); void bta_hh_le_get_dscp_act(tBTA_HH_DEV_CB* p_cb); void bta_hh_le_write_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data); Loading system/bta/hh/bta_hh_le.cc +99 −61 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
system/bta/dm/bta_dm_pm.cc +5 −1 Original line number Diff line number Diff line Loading @@ -938,8 +938,12 @@ static void bta_dm_pm_ssr(const RawAddress& peer_addr, const int ssr) { /* HH has the per connection SSR preference, already read the SSR params * from BTA HH */ if (current_ssr_index == BTA_DM_PM_SSR_HH) { tAclLinkSpec link_spec; link_spec.addrt.bda = peer_addr; link_spec.addrt.type = BLE_ADDR_PUBLIC; link_spec.transport = BT_TRANSPORT_BR_EDR; if (GetInterfaceToProfiles()->profileSpecific_HACK->bta_hh_read_ssr_param( peer_addr, &p_spec_cur->max_lat, &p_spec_cur->min_rmt_to) == link_spec, &p_spec_cur->max_lat, &p_spec_cur->min_rmt_to) == BTA_HH_ERR) { continue; } Loading
system/bta/hh/bta_hh_act.cc +38 −32 Original line number Diff line number Diff line Loading @@ -214,7 +214,8 @@ static void bta_hh_sdp_cback(uint16_t result, uint16_t attr_mask, /* if not added before */ if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) { /* add device/update attr_mask information */ if (HID_HostAddDev(p_cb->addr, attr_mask, &hdl) == HID_SUCCESS) { if (HID_HostAddDev(p_cb->link_spec.addrt.bda, attr_mask, &hdl) == HID_SUCCESS) { status = BTA_HH_OK; /* update cb_index[] map */ bta_hh_cb.cb_index[hdl] = p_cb->index; Loading Loading @@ -292,7 +293,7 @@ static void bta_hh_di_sdp_cback(UNUSED_ATTR const RawAddress& bd_addr, bta_hh_update_di_info(p_cb, BTA_HH_VENDOR_ID_INVALID, 0, 0, 0, 0); } ret = HID_HostGetSDPRecord(p_cb->addr, bta_hh_cb.p_disc_db, ret = HID_HostGetSDPRecord(p_cb->link_spec.addrt.bda, bta_hh_cb.p_disc_db, p_bta_hh_cfg->sdp_db_size, bta_hh_sdp_cback); if (ret == HID_SUCCESS) { status = BTA_HH_OK; Loading Loading @@ -330,7 +331,7 @@ static void bta_hh_start_sdp(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { /* Do DI discovery first */ if (get_legacy_stack_sdp_api()->device_id.SDP_DiDiscover( p_data->api_conn.bd_addr, bta_hh_cb.p_disc_db, p_data->api_conn.link_spec.addrt.bda, bta_hh_cb.p_disc_db, p_bta_hh_cfg->sdp_db_size, bta_hh_di_sdp_cback) == SDP_SUCCESS) { /* SDP search started successfully * Connection will be triggered at the end of successful SDP search Loading Loading @@ -377,7 +378,7 @@ void bta_hh_sdp_cmpl(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { /* initialize call back data */ memset((void*)&conn_dat, 0, sizeof(tBTA_HH_CONN)); conn_dat.handle = p_cb->hid_handle; conn_dat.bda = p_cb->addr; conn_dat.link_spec = p_cb->link_spec; /* if SDP compl success */ if (status == BTA_HH_OK) { Loading Loading @@ -461,7 +462,8 @@ static void bta_hh_bredr_conn(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) { uint8_t hdl; if (HID_HostAddDev(p_cb->addr, p_cb->attr_mask, &hdl) == HID_SUCCESS) { if (HID_HostAddDev(p_cb->link_spec.addrt.bda, p_cb->attr_mask, &hdl) == HID_SUCCESS) { /* update device CB with newly register device handle */ bta_hh_add_device_to_list(p_cb, hdl, p_cb->attr_mask, NULL, p_cb->sub_class, Loading Loading @@ -496,7 +498,7 @@ void bta_hh_connect(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { bluetooth::Uuid remote_uuids[BT_MAX_NUM_UUIDS] = {}; bt_property_t remote_properties = {BT_PROPERTY_UUIDS, sizeof(remote_uuids), &remote_uuids}; const RawAddress& bd_addr = p_data->api_conn.bd_addr; const RawAddress& bd_addr = p_data->api_conn.link_spec.addrt.bda; // Find the device type tBT_DEVICE_TYPE dev_type; Loading Loading @@ -552,7 +554,7 @@ void bta_hh_connect(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { // Initiate HID host connection if (p_cb->is_le_device) { bta_hh_le_open_conn(p_cb, bd_addr); bta_hh_le_open_conn(p_cb, p_data->api_conn.link_spec); } else { bta_hh_bredr_conn(p_cb, p_data); } Loading @@ -568,13 +570,13 @@ void bta_hh_connect(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { * Returns void * ******************************************************************************/ void btif_hh_remove_device(RawAddress bd_addr); void btif_hh_remove_device(tAclLinkSpec link_spec); void bta_hh_api_disc_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { CHECK(p_cb != nullptr); if (p_cb->is_le_device) { LOG_DEBUG("Host initiating close to le device:%s", ADDRESS_TO_LOGGABLE_CSTR(p_cb->addr)); ADDRESS_TO_LOGGABLE_CSTR(p_cb->link_spec)); bta_hh_le_api_disc_act(p_cb); Loading @@ -585,10 +587,11 @@ void bta_hh_api_disc_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { tHID_STATUS status = HID_HostCloseDev(hid_handle); if (status != HID_SUCCESS) { LOG_WARN("Failed closing classic device:%s status:%s", ADDRESS_TO_LOGGABLE_CSTR(p_cb->addr), hid_status_text(status).c_str()); ADDRESS_TO_LOGGABLE_CSTR(p_cb->link_spec), hid_status_text(status).c_str()); } else { LOG_DEBUG("Host initiated close to classic device:%s", ADDRESS_TO_LOGGABLE_CSTR(p_cb->addr)); ADDRESS_TO_LOGGABLE_CSTR(p_cb->link_spec)); } tBTA_HH bta_hh = { .dev_status = {.status = Loading Loading @@ -616,7 +619,7 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { memset((void*)&conn, 0, sizeof(tBTA_HH_CONN)); conn.handle = dev_handle; conn.bda = p_cb->addr; conn.link_spec = p_cb->link_spec; /* increase connection number */ bta_hh_cb.cnt_num++; Loading @@ -628,7 +631,7 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { conn.attr_mask = p_cb->attr_mask; conn.app_id = p_cb->app_id; BTM_LogHistory(kBtmLogTag, p_cb->addr, "Opened", BTM_LogHistory(kBtmLogTag, p_cb->link_spec.addrt.bda, "Opened", base::StringPrintf( "%s initiator:%s", (p_cb->is_le_device) ? "le" : "classic", (p_cb->incoming_conn) ? "remote" : "local")); Loading @@ -636,7 +639,7 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { if (!p_cb->is_le_device) { /* inform role manager */ bta_sys_conn_open(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_conn_open(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); /* set protocol mode when not default report mode */ if (p_cb->mode != BTA_HH_PROTO_RPT_MODE) { Loading Loading @@ -688,7 +691,7 @@ void bta_hh_open_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { p_cb->incoming_hid_handle = dev_handle; memset(&conn_data, 0, sizeof(tBTA_HH_API_CONN)); conn_data.bd_addr = p_cb->addr; conn_data.link_spec = p_cb->link_spec; bta_hh_cb.p_cur = p_cb; bta_hh_bredr_conn(p_cb, (tBTA_HH_DATA*)&conn_data); } Loading @@ -712,7 +715,7 @@ void bta_hh_data_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { bta_hh_co_data((uint8_t)p_data->hid_cback.hdr.layer_specific, p_rpt, pdata->len, p_cb->mode, p_cb->sub_class, p_cb->dscp_info.ctry_code, p_cb->addr, p_cb->app_id); p_cb->dscp_info.ctry_code, p_cb->link_spec, p_cb->app_id); osi_free_and_reset((void**)&pdata); } Loading Loading @@ -766,7 +769,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { bta_hh.conn.status = p_data->hid_cback.data ? BTA_HH_ERR_PROTO : BTA_HH_OK; bta_hh.conn.handle = p_cb->hid_handle; bta_hh.conn.bda = p_cb->addr; bta_hh.conn.link_spec = p_cb->link_spec; (*bta_hh_cb.p_cback)(p_cb->w4_evt, &bta_hh); bta_hh_trace_dev_db(); p_cb->w4_evt = 0; Loading @@ -779,7 +782,7 @@ void bta_hh_handsk_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { } /* transaction achknoledgement received, inform PM for mode change */ bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); return; } /******************************************************************************* Loading Loading @@ -838,8 +841,8 @@ void bta_hh_ctrl_dat_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { } /* inform PM for mode change */ bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); (*bta_hh_cb.p_cback)(p_cb->w4_evt, (tBTA_HH*)&hs_data); Loading @@ -866,7 +869,7 @@ void bta_hh_open_failure(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { conn_dat.handle = p_cb->hid_handle; conn_dat.status = (reason == HID_ERR_AUTH_FAILED) ? BTA_HH_ERR_AUTH_FAILED : BTA_HH_ERR; conn_dat.bda = p_cb->addr; conn_dat.link_spec = p_cb->link_spec; HID_HostCloseDev(p_cb->hid_handle); /* Report OPEN fail event */ Loading Loading @@ -916,14 +919,14 @@ void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { base::StringPrintf("%s %s %s", (l2cap_conn_fail) ? "l2cap_conn_fail" : "", (l2cap_req_fail) ? "l2cap_req_fail" : "", (l2cap_cfg_fail) ? "l2cap_cfg_fail" : ""); BTM_LogHistory(kBtmLogTag, p_cb->addr, "Closed", BTM_LogHistory(kBtmLogTag, p_cb->link_spec.addrt.bda, "Closed", base::StringPrintf("%s reason %s %s", (p_cb->is_le_device) ? "le" : "classic", hid_status_text(hid_status).c_str(), overlay_fail.c_str())); /* inform role manager */ bta_sys_conn_close(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_conn_close(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); /* update total conn number */ bta_hh_cb.cnt_num--; Loading Loading @@ -994,17 +997,18 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { switch (p_dev_info->sub_event) { case BTA_HH_ADD_DEV_EVT: /* add a device */ dev_info.bda = p_dev_info->bda; dev_info.link_spec = p_dev_info->link_spec; /* initialize callback data */ if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) { if (BTM_UseLeLink(p_data->api_conn.bd_addr)) { if (BTM_UseLeLink(p_data->api_conn.link_spec.addrt.bda)) { p_cb->is_le_device = true; dev_info.handle = bta_hh_le_add_device(p_cb, p_dev_info); if (dev_info.handle != BTA_HH_INVALID_HANDLE) dev_info.status = BTA_HH_OK; } else if (HID_HostAddDev(p_dev_info->bda, p_dev_info->attr_mask, if (HID_HostAddDev(p_dev_info->link_spec.addrt.bda, p_dev_info->attr_mask, &dev_handle) == HID_SUCCESS) { dev_info.handle = dev_handle; dev_info.status = BTA_HH_OK; Loading Loading @@ -1034,7 +1038,7 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { break; case BTA_HH_RMV_DEV_EVT: /* remove device */ dev_info.handle = (uint8_t)p_dev_info->hdr.layer_specific; dev_info.bda = p_cb->addr; dev_info.link_spec = p_cb->link_spec; if (p_cb->is_le_device) { bta_hh_le_remove_dev_bg_conn(p_cb); Loading Loading @@ -1164,12 +1168,12 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) { /* if not control type transaction, notify PM for energy control */ if (p_data->api_sndcmd.t_type != HID_TRANS_CONTROL) { /* inform PM for mode change */ bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); bta_sys_idle(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); } else if (api_sndcmd_param == BTA_HH_CTRL_SUSPEND) { bta_sys_sco_close(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_sco_close(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); } else if (api_sndcmd_param == BTA_HH_CTRL_EXIT_SUSPEND) { bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->addr); bta_sys_busy(BTA_ID_HH, p_cb->app_id, p_cb->link_spec.addrt.bda); } } } Loading Loading @@ -1235,7 +1239,9 @@ static void bta_hh_cback(uint8_t dev_handle, const RawAddress& addr, p_buf->hdr.event = sm_event; p_buf->hdr.layer_specific = (uint16_t)dev_handle; p_buf->data = data; p_buf->addr = addr; p_buf->link_spec.addrt.bda = addr; p_buf->link_spec.addrt.type = BLE_ADDR_PUBLIC; p_buf->link_spec.transport = BT_TRANSPORT_BR_EDR; p_buf->p_data = pdata; bta_sys_sendmsg(p_buf); Loading
system/bta/hh/bta_hh_api.cc +7 −7 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ void BTA_HhClose(uint8_t dev_handle) { * Returns void * ******************************************************************************/ void BTA_HhOpen(const RawAddress& dev_bda) { void BTA_HhOpen(const tAclLinkSpec& link_spec) { tBTA_HH_API_CONN* p_buf = (tBTA_HH_API_CONN*)osi_calloc(sizeof(tBTA_HH_API_CONN)); tBTA_HH_PROTO_MODE mode = BTA_HH_PROTO_RPT_MODE; Loading @@ -115,7 +115,7 @@ void BTA_HhOpen(const RawAddress& dev_bda) { p_buf->hdr.event = BTA_HH_API_OPEN_EVT; p_buf->hdr.layer_specific = BTA_HH_INVALID_HANDLE; p_buf->mode = mode; p_buf->bd_addr = dev_bda; p_buf->link_spec = link_spec; bta_sys_sendmsg((void*)p_buf); } Loading Loading @@ -244,7 +244,7 @@ void BTA_HhSendCtrl(uint8_t dev_handle, tBTA_HH_TRANS_CTRL_TYPE c_type) { * Description This function send DATA transaction to HID device. * * Parameter dev_handle: device handle * dev_bda: remote device address * link_spec : remote device acl link specification * p_data: data to be sent in the DATA transaction; or * the data to be write into the Output Report of a LE * HID device. The report is identified the report ID Loading @@ -256,8 +256,8 @@ void BTA_HhSendCtrl(uint8_t dev_handle, tBTA_HH_TRANS_CTRL_TYPE c_type) { * Returns void * ******************************************************************************/ void BTA_HhSendData(uint8_t dev_handle, UNUSED_ATTR const RawAddress& dev_bda, BT_HDR* p_data) { void BTA_HhSendData(uint8_t dev_handle, UNUSED_ATTR const tAclLinkSpec& link_spec, BT_HDR* p_data) { if (p_data->layer_specific != BTA_HH_RPTT_OUTPUT) { LOG_ERROR( "ERROR! Wrong report type! Write Command only valid for output " Loading Loading @@ -298,7 +298,7 @@ void BTA_HhGetDscpInfo(uint8_t dev_handle) { * Returns void * ******************************************************************************/ void BTA_HhAddDev(const RawAddress& bda, tBTA_HH_ATTR_MASK attr_mask, void BTA_HhAddDev(const tAclLinkSpec& link_spec, tBTA_HH_ATTR_MASK attr_mask, uint8_t sub_class, uint8_t app_id, tBTA_HH_DEV_DSCP_INFO dscp_info) { size_t len = sizeof(tBTA_HH_MAINT_DEV) + dscp_info.descriptor.dl_len; Loading @@ -311,7 +311,7 @@ void BTA_HhAddDev(const RawAddress& bda, tBTA_HH_ATTR_MASK attr_mask, p_buf->attr_mask = (uint16_t)attr_mask; p_buf->sub_class = sub_class; p_buf->app_id = app_id; p_buf->bda = bda; p_buf->link_spec = link_spec; memcpy(&p_buf->dscp_info, &dscp_info, sizeof(tBTA_HH_DEV_DSCP_INFO)); if (dscp_info.descriptor.dl_len != 0 && dscp_info.descriptor.dsc_list) { Loading
system/bta/hh/bta_hh_int.h +8 −8 Original line number Diff line number Diff line Loading @@ -82,21 +82,21 @@ typedef struct { typedef struct { BT_HDR_RIGID hdr; RawAddress bd_addr; tAclLinkSpec link_spec; tBTA_HH_PROTO_MODE mode; } tBTA_HH_API_CONN; /* internal event data from BTE HID callback */ typedef struct { BT_HDR_RIGID hdr; RawAddress addr; tAclLinkSpec link_spec; uint32_t data; BT_HDR* p_data; } tBTA_HH_CBACK_DATA; typedef struct { BT_HDR_RIGID hdr; RawAddress bda; tAclLinkSpec link_spec; uint16_t attr_mask; uint16_t sub_event; uint8_t sub_class; Loading Loading @@ -181,7 +181,7 @@ typedef struct { /* device control block */ typedef struct { tBTA_HH_DEV_DSCP_INFO dscp_info; /* report descriptor and DI information */ RawAddress addr; /* BD-Addr of the HID device */ tAclLinkSpec link_spec; /* ACL link specification of the HID device */ uint16_t attr_mask; /* attribute mask */ uint16_t w4_evt; /* W4_handshake event name */ uint8_t index; /* index number referenced to handle index */ Loading Loading @@ -266,8 +266,8 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data); void bta_hh_open_failure(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data); /* utility functions */ uint8_t bta_hh_find_cb(const RawAddress& bda); tBTA_HH_DEV_CB* bta_hh_get_cb(const RawAddress& bda); uint8_t bta_hh_find_cb(const tAclLinkSpec& link_spec); tBTA_HH_DEV_CB* bta_hh_get_cb(const tAclLinkSpec& link_spec); bool bta_hh_tod_spt(tBTA_HH_DEV_CB* p_cb, uint8_t sub_class); void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB* p_cb); Loading @@ -289,14 +289,14 @@ void bta_hh_api_enable(tBTA_HH_CBACK* p_cback, bool enable_hid, void bta_hh_api_disable(void); void bta_hh_disc_cmpl(void); tBTA_HH_STATUS bta_hh_read_ssr_param(const RawAddress& bd_addr, tBTA_HH_STATUS bta_hh_read_ssr_param(const tAclLinkSpec& link_spec, uint16_t* p_max_ssr_lat, uint16_t* p_min_ssr_tout); /* functions for LE HID */ void bta_hh_le_enable(void); void bta_hh_le_deregister(void); void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, const RawAddress& remote_bda); void bta_hh_le_open_conn(tBTA_HH_DEV_CB* p_cb, const tAclLinkSpec& link_spec); void bta_hh_le_api_disc_act(tBTA_HH_DEV_CB* p_cb); void bta_hh_le_get_dscp_act(tBTA_HH_DEV_CB* p_cb); void bta_hh_le_write_dev_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data); Loading
system/bta/hh/bta_hh_le.cc +99 −61 File changed.Preview size limit exceeded, changes collapsed. Show changes