summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2013-04-12 15:47:41 -0700
committerMartijn Coenen <maco@google.com>2013-04-12 15:50:29 -0700
commitd508d9900a7d318073bd7b308d094755df316527 (patch)
tree0da5d8c7683ddae7242824e7861a22235cf274fe
parent774304ff788dd1670a23e1f68fac244cf98d4c3c (diff)
downloadlibnfc-nxp-d508d9900a7d318073bd7b308d094755df316527.tar.gz
Restore SE activated mode in case of failure.
There is a tight race condition where opening of the SE can fail, due to a tag/p2p device having just come in. In that case, restore the original state of the SE activated mode. This will prevent future calls into this method and Connect() from immediately bailing out. Bug: 8599167 Change-Id: I1890e4efb73a9f5bdd6abe0644f88051b32e8c02
-rw-r--r--src/phLibNfc_SE.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/phLibNfc_SE.c b/src/phLibNfc_SE.c
index 2cdb24e..0ccfce6 100644
--- a/src/phLibNfc_SE.c
+++ b/src/phLibNfc_SE.c
@@ -470,6 +470,7 @@ NFCSTATUS phLibNfc_SE_SetMode ( phLibNfc_Handle hSE_Handle,
}
else
{
+ phLibNfc_eSE_ActivationMode originalMode = pLibContext->sSeContext.eActivatedMode;
switch(eActivation_mode)
{
case phLibNfc_SE_ActModeVirtual:
@@ -655,6 +656,8 @@ NFCSTATUS phLibNfc_SE_SetMode ( phLibNfc_Handle hSE_Handle,
}
else
{
+ // Restore original mode
+ pLibContext->sSeContext.eActivatedMode = originalMode;
Status = NFCSTATUS_FAILED;
}
}