Merge "Added recovery function when SE wired mode selected"
diff --git a/Linux_x86/phOsalNfc.c b/Linux_x86/phOsalNfc.c
index 3f4542d..83b4e6e 100644
--- a/Linux_x86/phOsalNfc.c
+++ b/Linux_x86/phOsalNfc.c
@@ -47,6 +47,8 @@
 char phOsalNfc_DbgTraceBuffer[MAX_PRINT_BUFSIZE];
 #endif
 
+void phLibNfc_Mgt_Recovery();
+
 /*!
  * \brief Allocates memory.
  *        This function attempts to allocate \a size bytes on the heap and
@@ -145,6 +147,7 @@
     if(eExceptionType == phOsalNfc_e_UnrecovFirmwareErr)
     {
         ALOGE("HCI Timeout - Exception raised");
+        phLibNfc_Mgt_Recovery();
         ALOGE("Force restart of NFC Service");
         abort();
     }
diff --git a/src/phLibNfc.c b/src/phLibNfc.c
index 1012acb..c7c37c8 100644
--- a/src/phLibNfc.c
+++ b/src/phLibNfc.c
@@ -129,6 +129,18 @@
     return status;
 }
 
+// Function for delay the recovery in case wired mode is set
+// to complete the possible pending transaction with SE
+void phLibNfc_Mgt_Recovery ()
+{
+    /* Wait before recovery if wired mode */
+    if (gpphLibContext->sSeContext.eActivatedMode == phLibNfc_SE_ActModeWired)
+    {
+        usleep (12000000);
+    }
+
+    return;
+}
 
 extern uint8_t nxp_nfc_isoxchg_timeout;
 NFCSTATUS phLibNfc_SetIsoXchgTimeout(uint8_t timeout) {
diff --git a/src/phLibNfc.h b/src/phLibNfc.h
index 1eb62ae..6111a93 100644
--- a/src/phLibNfc.h
+++ b/src/phLibNfc.h
@@ -856,6 +856,10 @@
 
 int phLibNfc_Load_Firmware_Image ();
 
+// Function for delay the recovery in case wired mode is set
+// to complete the possible pending transaction with SE
+void phLibNfc_Mgt_Recovery ();
+
 // timeout is 8 bits
 // bits [0..3] => timeout value, (256*16/13.56*10^6) * 2^value
 //                  [0] -> 0.0003s