NFC service is getting stuck if NFC reset is done during wTx
Fix is added to unblock the transceive when nfc off/on requested.
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
index 31a858a..b6bbe27 100644
--- a/nci/jni/NativeNfcManager.cpp
+++ b/nci/jni/NativeNfcManager.cpp
@@ -1666,7 +1666,9 @@
pn544InteropAbortNow();
RoutingManager::getInstance().onNfccShutdown();
PowerSwitch::getInstance().initialize(PowerSwitch::UNKNOWN_LEVEL);
-
+#if (NXP_EXTNS == TRUE)
+ SecureElement::getInstance().releasePendingTransceive();
+#endif
if (sIsNfaEnabled) {
SyncEventGuard guard(sNfaDisableEvent);
EXTNS_Close();
diff --git a/nci/jni/NativeSecureElement.cpp b/nci/jni/NativeSecureElement.cpp
index a8a746a..e98f0a6 100644
--- a/nci/jni/NativeSecureElement.cpp
+++ b/nci/jni/NativeSecureElement.cpp
@@ -118,6 +118,8 @@
if(!se.mIsWiredModeOpen)
return false;
+ /* release any pending transceive wait */
+ se.releasePendingTransceive();
status = se.setNfccPwrConfig(se.POWER_ALWAYS_ON);
if(status != NFA_STATUS_OK)
@@ -130,12 +132,12 @@
if(status == NFA_STATUS_OK)
stat = true;
}
+ se.mIsWiredModeOpen = false;
/* if nothing is active after this, then tell the controller to power down */
if (! PowerSwitch::getInstance ().setModeOff (PowerSwitch::SE_CONNECTED))
PowerSwitch::getInstance ().setLevel (PowerSwitch::LOW_POWER);
LOG(INFO) << StringPrintf("%s: exit", __func__);
-
return stat ? JNI_TRUE : JNI_FALSE;
}
/*******************************************************************************
diff --git a/nci/jni/SecureElement.cpp b/nci/jni/SecureElement.cpp
index ff79f0b..9cfefc3 100644
--- a/nci/jni/SecureElement.cpp
+++ b/nci/jni/SecureElement.cpp
@@ -1537,3 +1537,24 @@
mIsInit = false;
mNativeData = NULL;
}
+
+/*******************************************************************************
+**
+** Function: releasePendingTransceive
+**
+** Description: release any pending transceive wait.
+**
+** Returns: None.
+**
+*******************************************************************************/
+void SecureElement::releasePendingTransceive()
+{
+ static const char fn [] = "SecureElement::releasePendingTransceive";
+ LOG(INFO) << StringPrintf("%s: Entered", fn);
+ if(mIsWiredModeOpen)
+ {
+ SyncEventGuard guard (mTransceiveEvent);
+ mTransceiveEvent.notifyOne();
+ }
+ LOG(INFO) << StringPrintf("%s: Exit", fn);
+}
\ No newline at end of file
diff --git a/nci/jni/SecureElement.h b/nci/jni/SecureElement.h
index f694300..78859e7 100644
--- a/nci/jni/SecureElement.h
+++ b/nci/jni/SecureElement.h
@@ -484,4 +484,14 @@
**
*******************************************************************************/
void finalize();
+/*******************************************************************************
+**
+** Function: releasePendingTransceive
+**
+** Description: release any pending transceive wait.
+**
+** Returns: None.
+**
+*******************************************************************************/
+void releasePendingTransceive();
};