fix SPP open with wrong remote bd_addr
This commit is contained in:
@@ -464,11 +464,12 @@ int PORT_SetEventMask (UINT16 port_handle, UINT32 mask)
|
||||
** by handle is up and running
|
||||
**
|
||||
** Parameters: handle - Handle returned in the RFCOMM_CreateConnection
|
||||
** ignore_rfc_state - If need to ignore rfc state
|
||||
** bd_addr - OUT bd_addr of the peer
|
||||
** p_lcid - OUT L2CAP's LCID
|
||||
**
|
||||
*******************************************************************************/
|
||||
int PORT_CheckConnection (UINT16 handle, BD_ADDR bd_addr, UINT16 *p_lcid)
|
||||
int PORT_CheckConnection(UINT16 handle, BOOLEAN ignore_rfc_state, BD_ADDR bd_addr, UINT16 *p_lcid)
|
||||
{
|
||||
tPORT *p_port;
|
||||
|
||||
@@ -485,9 +486,8 @@ int PORT_CheckConnection (UINT16 handle, BD_ADDR bd_addr, UINT16 *p_lcid)
|
||||
return (PORT_NOT_OPENED);
|
||||
}
|
||||
|
||||
if (!p_port->rfc.p_mcb
|
||||
|| !p_port->rfc.p_mcb->peer_ready
|
||||
|| (p_port->rfc.state != RFC_STATE_OPENED)) {
|
||||
if (!p_port->rfc.p_mcb || !p_port->rfc.p_mcb->peer_ready ||
|
||||
(!ignore_rfc_state ? (p_port->rfc.state != RFC_STATE_OPENED) : false)) {
|
||||
return (PORT_LINE_ERR);
|
||||
}
|
||||
|
||||
|
||||
@@ -427,7 +427,10 @@ void PORT_ParNegCnf (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k)
|
||||
void PORT_DlcEstablishInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu)
|
||||
{
|
||||
tPORT *p_port = port_find_mcb_dlci_port (p_mcb, dlci);
|
||||
BOOLEAN accept = true;
|
||||
tPORT_MGMT_SR_CALLBACK_ARG mgmt_cb_arg = {
|
||||
.accept = TRUE,
|
||||
.ignore_rfc_state = FALSE,
|
||||
};
|
||||
|
||||
RFCOMM_TRACE_DEBUG ("PORT_DlcEstablishInd p_mcb:%p, dlci:%d mtu:%di, p_port:%p", p_mcb, dlci, mtu, p_port);
|
||||
RFCOMM_TRACE_DEBUG ("PORT_DlcEstablishInd p_mcb addr:%02x:%02x:%02x:%02x:%02x:%02x",
|
||||
@@ -461,10 +464,17 @@ void PORT_DlcEstablishInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu)
|
||||
}
|
||||
|
||||
if (p_port->p_mgmt_callback) {
|
||||
p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx, &accept);
|
||||
/**
|
||||
* @note
|
||||
* 1. The manage callback function may change the value of accept in mgmt_cb_arg.
|
||||
* 2. Use mgmt_cb_arg.ignore_rfc_state to work around the issue caused by sending
|
||||
* RFCOMM establish response after the manage callback function.
|
||||
*/
|
||||
mgmt_cb_arg.ignore_rfc_state = TRUE;
|
||||
p_port->p_mgmt_callback (PORT_SUCCESS, p_port->inx, &mgmt_cb_arg);
|
||||
}
|
||||
|
||||
if (accept) {
|
||||
if (mgmt_cb_arg.accept) {
|
||||
RFCOMM_DlcEstablishRsp(p_mcb, dlci, p_port->mtu, RFCOMM_SUCCESS);
|
||||
p_port->state = PORT_STATE_OPENED;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user