Fix bug that occurs when LLPC deactivates asynchronously.
Bug steps: 1. A P2P connection is established. 2. The NFC radio is shutdown. (e.g. to apply a new radio config.) 3. LLCP is told to deactivate itself. 4. LLCP starts an asynchronous operation as part of its deactivation. 5. When the asynchronous operation completes, LLCP starts a new state transition, which overrides the currently executing state transition (that was started in Step 2). This messes up the state of a driver, causing a fatal error to occur. This change ensures that in Step 5, LLCP resumes the current state transition instead of starting a new one.
This commit is contained in:
Родитель
513432e2d7
Коммит
604645a48b
|
@ -122,7 +122,16 @@ NfcCxLLCPInterfaceLinkStatusCB(
|
|||
{
|
||||
NfcCxRFInterfaceP2pConnectionLost(RFInterface);
|
||||
NfcCxSNEPInterfaceDeinit(NfcCxLLCPInterfaceGetLibNfcContext(LLCPInterface)->SNEPInterface);
|
||||
NfcCxPostLibNfcThreadMessage(RFInterface, LIBNFC_STATE_HANDLER, NfcCxEventDeactivated, NULL, NULL, NULL);
|
||||
|
||||
if (LLCPInterface->IsDeactivatePending)
|
||||
{
|
||||
LLCPInterface->IsDeactivatePending = false;
|
||||
NfcCxInternalSequence(NfcCxLLCPInterfaceGetRFInterface(LLCPInterface), NfcCxLLCPInterfaceGetRFInterface(LLCPInterface)->pSeqHandler, STATUS_SUCCESS, NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
NfcCxPostLibNfcThreadMessage(RFInterface, LIBNFC_STATE_HANDLER, NfcCxEventDeactivated, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -247,6 +256,10 @@ NfcCxLLCPInterfaceDeactivate(
|
|||
|
||||
if (LLCPInterface->eLinkStatus == phFriNfc_LlcpMac_eLinkActivated) {
|
||||
nfcStatus = phLibNfc_Llcp_Deactivate(RFInterface->pLibNfcContext->pRemDevList[0].hTargetDev);
|
||||
if (nfcStatus == NFCSTATUS_PENDING)
|
||||
{
|
||||
LLCPInterface->IsDeactivatePending = true;
|
||||
}
|
||||
}
|
||||
|
||||
Status = NfcCxNtStatusFromNfcStatus(nfcStatus);
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef struct _NFCCX_LLCP_INTERFACE {
|
|||
phLibNfc_Llcp_sLinkParameters_t sLocalLinkInfo;
|
||||
phNfc_sData_t sServiceName;
|
||||
UCHAR eRequestState;
|
||||
bool IsDeactivatePending;
|
||||
} NFCCX_LLCP_INTERFACE, *PNFCCX_LLCP_INTERFACE;
|
||||
|
||||
typedef struct _NFCCX_LLCP_LIBNFC_REQUEST_CONTEXT {
|
||||
|
|
Загрузка…
Ссылка в новой задаче