summaryrefslogtreecommitdiffstats
path: root/src/phHciNfc_WI.c
diff options
context:
space:
mode:
authorDaniel Tomas <dtomas.nxp@gmail.com>2011-06-21 17:24:09 +0200
committermike wakerly <mikey@google.com>2011-06-28 10:47:23 -0700
commit967359c892ff74962b4f4243d989f447ffe4ae11 (patch)
tree548bdc1245227f4b64e4e698552d8f66255d2363 /src/phHciNfc_WI.c
parent99141cdd942973bc0cb8ef208ef717b14eb73b8e (diff)
downloadexternal_libnfc-nxp-967359c892ff74962b4f4243d989f447ffe4ae11.zip
external_libnfc-nxp-967359c892ff74962b4f4243d989f447ffe4ae11.tar.gz
external_libnfc-nxp-967359c892ff74962b4f4243d989f447ffe4ae11.tar.bz2
Patch to support the new PN544 firmware events
Change-Id: I6e5a976721fb52f2da30081276bb2ac15d27d186
Diffstat (limited to 'src/phHciNfc_WI.c')
-rw-r--r--src/phHciNfc_WI.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/phHciNfc_WI.c b/src/phHciNfc_WI.c
index 4da2078..e1310a4 100644
--- a/src/phHciNfc_WI.c
+++ b/src/phHciNfc_WI.c
@@ -63,6 +63,9 @@
/****************** Static Function Declaration **************************/
+static uint8_t paypass_removal[2] = {0x50, 0x00};
+static uint8_t mifare_access = 0x60;
+
static
NFCSTATUS
phHciNfc_Recv_WI_Response(
@@ -700,12 +703,33 @@ phHciNfc_Recv_WI_Event(
EventInfo.eventType = NFC_EVT_TRANSACTION;
EventInfo.eventInfo.aid.buffer = (uint8_t *)p_wi_info->aid;
/* check for AID data is at least 1 byte is their */
- if(length > HCP_HEADER_LEN)
+ if (length > HCP_HEADER_LEN)
{
EventInfo.eventInfo.aid.length = length - HCP_HEADER_LEN;
- (void) memcpy((void *)p_wi_info->aid,message->payload,
- EventInfo.eventInfo.aid.length );
+ memcpy((void *)p_wi_info->aid, message->payload,
+ EventInfo.eventInfo.aid.length );
+ }
+
+ /* Filter Transaction event */
+ if (EventInfo.eventInfo.aid.length == 4)
+ {
+ EventInfo.eventType = NFC_EVT_APDU_RECEIVED;
+ }
+ else if (EventInfo.eventInfo.aid.length == 2)
+ {
+ if (!memcmp(paypass_removal, EventInfo.eventInfo.aid.buffer, EventInfo.eventInfo.aid.length))
+ {
+ EventInfo.eventType = NFC_EVT_EMV_CARD_REMOVAL;
+ }
+ else if(mifare_access == EventInfo.eventInfo.aid.buffer[0])
+ {
+ EventInfo.eventType = NFC_EVT_MIFARE_ACCESS;
+ }
}
+
+ EventInfo.eventInfo.aid.buffer = (uint8_t *)p_wi_info->aid;
+ (void) memcpy((void *)p_wi_info->aid,message->payload,
+ EventInfo.eventInfo.aid.length );
break;
}
default: