summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/phLibNfc_initiator.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/phLibNfc_initiator.c b/src/phLibNfc_initiator.c
index d93d5f6..340af78 100644
--- a/src/phLibNfc_initiator.c
+++ b/src/phLibNfc_initiator.c
@@ -55,7 +55,7 @@
*************************** Global Variables **********************************
*/
-
+#define PN544_IO_TIMEOUT_RESPONSE 0x89
/*
*************************** Static Function Declaration ***********************
@@ -1154,10 +1154,17 @@ void phLibNfc_RemoteDev_Transceive_Cb(void *context,
phLibNfc_Reconnect_Mifare_Cb,
(void *)gpphLibContext);
}
- else
+ else if ((PHNFCSTATUS(status) == PN544_IO_TIMEOUT_RESPONSE) ||
+ (PHNFCSTATUS(status) == NFCSTATUS_RF_TIMEOUT))
{
+ // 0x89, 0x09 HCI response values from PN544 indicate timeout
trans_status = NFCSTATUS_TARGET_LOST;
}
+ else
+ {
+ // PN544 did get some reply from tag, just not valid
+ trans_status = NFCSTATUS_FAILED;
+ }
/*Update the state machine */
phLibNfc_UpdateCurState(status,gpphLibContext);
gpphLibContext->LibNfcState.next_state = eLibNfcHalStateConnect;