summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bta/jv/bta_jv_act.c44
-rwxr-xr-x[-rw-r--r--]btif/src/btif_dm.c1
-rwxr-xr-x[-rw-r--r--]btif/src/btif_hf.c8
-rwxr-xr-x[-rw-r--r--]btif/src/btif_storage.c4
-rwxr-xr-x[-rw-r--r--]hci/src/hci_mct.c10
5 files changed, 48 insertions, 19 deletions
diff --git a/bta/jv/bta_jv_act.c b/bta/jv/bta_jv_act.c
index c984b82..77d18d9 100644
--- a/bta/jv/bta_jv_act.c
+++ b/bta/jv/bta_jv_act.c
@@ -1891,26 +1891,34 @@ void bta_jv_rfcomm_connect(tBTA_JV_MSG *p_data)
if (evt_data.status == BTA_JV_SUCCESS)
{
p_cb = bta_jv_alloc_rfc_cb(handle, &p_pcb);
- p_cb->p_cback = cc->p_cback;
- p_cb->sec_id = sec_id;
- p_cb->scn = 0;
- p_pcb->state = BTA_JV_ST_CL_OPENING;
- p_pcb->user_data = cc->user_data;
- evt_data.use_co = TRUE;
+ if(p_cb)
+ {
+ p_cb->p_cback = cc->p_cback;
+ p_cb->sec_id = sec_id;
+ p_cb->scn = 0;
+ p_pcb->state = BTA_JV_ST_CL_OPENING;
+ p_pcb->user_data = cc->user_data;
+ evt_data.use_co = TRUE;
- PORT_SetEventCallback(handle, bta_jv_port_event_cl_cback);
- PORT_SetEventMask(handle, event_mask);
- PORT_SetDataCOCallback (handle, bta_jv_port_data_co_cback);
+ PORT_SetEventCallback(handle, bta_jv_port_event_cl_cback);
+ PORT_SetEventMask(handle, event_mask);
+ PORT_SetDataCOCallback (handle, bta_jv_port_data_co_cback);
- PORT_GetState(handle, &port_state);
+ PORT_GetState(handle, &port_state);
- port_state.fc_type = (PORT_FC_CTS_ON_INPUT | PORT_FC_CTS_ON_OUTPUT);
+ port_state.fc_type = (PORT_FC_CTS_ON_INPUT | PORT_FC_CTS_ON_OUTPUT);
-/* coverity[uninit_use_in_call]
-FALSE-POSITIVE: port_state is initialized at PORT_GetState() */
- PORT_SetState(handle, &port_state);
+ /* coverity[uninit_use_in_call]
+ FALSE-POSITIVE: port_state is initialized at PORT_GetState() */
+ PORT_SetState(handle, &port_state);
- evt_data.handle = p_cb->handle;
+ evt_data.handle = p_cb->handle;
+ }
+ else
+ {
+ evt_data.status = BTA_JV_FAILURE;
+ APPL_TRACE_ERROR0("run out of rfc control block");
+ }
}
cc->p_cback(BTA_JV_RFCOMM_CL_INIT_EVT, (tBTA_JV *)&evt_data, cc->user_data);
}
@@ -2210,6 +2218,12 @@ void bta_jv_rfcomm_start_server(tBTA_JV_MSG *p_data)
}
p_cb = bta_jv_alloc_rfc_cb(handle, &p_pcb);
+ if(!p_cb)
+ {
+ APPL_TRACE_ERROR0("run out of rfc control block");
+ break;
+ }
+
p_cb->max_sess = rs->max_session;
p_cb->p_cback = rs->p_cback;
p_cb->sec_id = sec_id;
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.c
index ac46e87..5517f55 100644..100755
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.c
@@ -119,6 +119,7 @@ bt_status_t btif_in_execute_service_request(tBTA_SERVICE_ID service_id,
switch (service_id)
{
case BTA_HFP_SERVICE_ID:
+ case BTA_HSP_SERVICE_ID:
{
btif_hf_execute_service(b_enable);
}break;
diff --git a/btif/src/btif_hf.c b/btif/src/btif_hf.c
index 8e605d5..49b0257 100644..100755
--- a/btif/src/btif_hf.c
+++ b/btif/src/btif_hf.c
@@ -484,8 +484,14 @@ static bt_status_t init( bthf_callbacks_t* callbacks )
bt_hf_callbacks = callbacks;
/* Invoke the enable service API to the core to set the appropriate service_id
- * Internally, the HSP_SERVICE_ID shall also be enabled */
+ * Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
+ * othwerwise only HSP is enabled (tablet)
+ */
+#if (defined(BTIF_HF_SERVICES) && (BTIF_HF_SERVICES & BTA_HFP_SERVICE_MASK))
btif_enable_service(BTA_HFP_SERVICE_ID);
+#else
+ btif_enable_service(BTA_HSP_SERVICE_ID);
+#endif
memset(&btif_hf_cb, 0, sizeof(btif_hf_cb_t));
clear_phone_state();
diff --git a/btif/src/btif_storage.c b/btif/src/btif_storage.c
index bd0ed28..6d702a7 100644..100755
--- a/btif/src/btif_storage.c
+++ b/btif/src/btif_storage.c
@@ -554,6 +554,10 @@ bt_status_t btif_storage_get_adapter_property(bt_property_t *property)
uuid16_to_uuid128(UUID_SERVCLASS_AG_HANDSFREE,
p_uuid+num_uuids);
num_uuids++;
+ }
+ /* intentional fall through: Send both BFP & HSP UUIDs if HFP is enabled */
+ case BTA_HSP_SERVICE_ID:
+ {
uuid16_to_uuid128(UUID_SERVCLASS_HEADSET_AUDIO_GATEWAY,
p_uuid+num_uuids);
num_uuids++;
diff --git a/hci/src/hci_mct.c b/hci/src/hci_mct.c
index e5febc9..4e70063 100644..100755
--- a/hci/src/hci_mct.c
+++ b/hci/src/hci_mct.c
@@ -666,10 +666,11 @@ void hci_mct_send_msg(HC_BT_HDR *p_msg)
}
p = ((uint8_t *)(p_msg + 1)) + p_msg->offset;
- userial_write(event, (uint8_t *) p, p_msg->len);
if (event == MSG_STACK_TO_HC_HCI_CMD)
{
+ uint8_t *p_tmp = p;
+
utils_lock();
num_hci_cmd_pkts--;
utils_unlock();
@@ -678,10 +679,13 @@ void hci_mct_send_msg(HC_BT_HDR *p_msg)
* have stored with the opcode of HCI command.
* Retrieve the opcode from the Cmd packet.
*/
- p++;
- STREAM_TO_UINT16(lay_spec, p);
+ p_tmp++;
+ STREAM_TO_UINT16(lay_spec, p_tmp);
}
+ userial_write(event, (uint8_t *) p, p_msg->len);
+
+
/* generate snoop trace message */
btsnoop_capture(p_msg, FALSE);