From 695e5c2f37870a63a6ff1322f7de01c524d3d860 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 15:31:48 +0000 Subject: [PATCH 01/19] Rename nfc_target_type_t as pn53x_target_type_t --- examples/nfc-dep-target.c | 2 +- examples/nfc-emulate-forum-tag4.c | 2 +- examples/nfc-emulate-tag.c | 6 ++-- examples/nfc-emulate-uid.c | 2 +- examples/nfc-poll.c | 32 ++++++++++---------- examples/nfc-relay.c | 2 +- examples/nfc-utils.c | 36 +++++++++++----------- examples/nfc-utils.h | 2 +- examples/pn53x-sam.c | 2 +- include/nfc/nfc-types.h | 38 +++++++++++------------ include/nfc/nfc.h | 2 +- libnfc/chips/pn53x.c | 50 +++++++++++++++---------------- libnfc/chips/pn53x.h | 4 +-- libnfc/nfc.c | 18 +++++------ 14 files changed, 99 insertions(+), 99 deletions(-) diff --git a/examples/nfc-dep-target.c b/examples/nfc-dep-target.c index 539bcb6..cf46d56 100644 --- a/examples/nfc-dep-target.c +++ b/examples/nfc-dep-target.c @@ -66,7 +66,7 @@ main (int argc, const char *argv[]) } const nfc_target_t nt = { - .ntt = NTT_DEP_PASSIVE_106, + .ptt = PTT_DEP_PASSIVE_106, .nti.ndi.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 }, .nti.ndi.szGB = 4, .nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 }, diff --git a/examples/nfc-emulate-forum-tag4.c b/examples/nfc-emulate-forum-tag4.c index 650221b..19b85c4 100644 --- a/examples/nfc-emulate-forum-tag4.c +++ b/examples/nfc-emulate-forum-tag4.c @@ -112,7 +112,7 @@ main (int argc, char *argv[]) printf ("Emulating NDEF tag now, please touch it with a second NFC device\n"); nfc_target_t nt = { - .ntt = NTT_MIFARE, + .ptt = PTT_MIFARE, .nti.nai.abtAtqa = { 0x00, 0x04 }, .nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index e5b9c81..f43916c 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -173,7 +173,7 @@ main (int argc, char *argv[]) // Example of a Mifare Classic Mini // Note that crypto1 is not implemented in this example nfc_target_t nt = { - .ntt = NTT_MIFARE, + .ptt = PTT_MIFARE, .nti.nai.abtAtqa = { 0x00, 0x04 }, .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, .nti.nai.btSak = 0x09, @@ -183,7 +183,7 @@ main (int argc, char *argv[]) /* // Example of a FeliCa nfc_target_t nt = { - .ntt = NTT_FELICA_212, + .ptt = PTT_FELICA_212, .nti.nfi.abtId = { 0x01, 0xFE, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF }, .nti.nfi.abtPad = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF }, .nti.nfi.abtSysCode = { 0xFF, 0xFF }, @@ -192,7 +192,7 @@ main (int argc, char *argv[]) /* // Example of a ISO14443-4 (DESfire) nfc_target_t nt = { - .ntt = NTT_MIFARE, + .ptt = PTT_MIFARE, .nti.nai.abtAtqa = { 0x03, 0x44 }, .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-emulate-uid.c b/examples/nfc-emulate-uid.c index 576d1f9..b5b60eb 100644 --- a/examples/nfc-emulate-uid.c +++ b/examples/nfc-emulate-uid.c @@ -132,7 +132,7 @@ main (int argc, char *argv[]) // Note: We have to build a "fake" nfc_target_t in order to do exactly the same that was done before the new nfc_target_init() was introduced. nfc_target_t nt = { - .ntt = NTT_MIFARE, + .ptt = PTT_MIFARE, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xaf }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index 5e4dd90..3ac5aa8 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -72,7 +72,7 @@ main (int argc, const char *argv[]) const byte_t btPollNr = 20; const byte_t btPeriod = 2; - const nfc_target_type_t nttArray[5] = {NTT_GENERIC_PASSIVE_106, NTT_GENERIC_PASSIVE_212, NTT_GENERIC_PASSIVE_424, NTT_ISO14443_4B_106, NTT_JEWEL_106}; + const pn53x_target_type_t pttArray[5] = {PTT_GENERIC_PASSIVE_106, PTT_GENERIC_PASSIVE_212, PTT_GENERIC_PASSIVE_424, PTT_ISO14443_4B_106, PTT_JEWEL_106}; const size_t szTargetTypes = 5; nfc_target_t antTargets[2]; @@ -106,53 +106,53 @@ main (int argc, const char *argv[]) printf ("Connected to NFC reader: %s\n", pnd->acName); printf ("PN532 will poll during %ld ms\n", (unsigned long) btPollNr * szTargetTypes * btPeriod * 150); - res = nfc_initiator_poll_targets (pnd, nttArray, szTargetTypes, btPollNr, btPeriod, antTargets, &szTargetFound); + res = nfc_initiator_poll_targets (pnd, pttArray, szTargetTypes, btPollNr, btPeriod, antTargets, &szTargetFound); if (res) { uint8_t n; printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound); for (n = 0; n < szTargetFound; n++) { - printf ("T%d: targetType=%02x ", n + 1, antTargets[n].ntt); - switch(antTargets[n].ntt) { - case NTT_JEWEL_106: + printf ("T%d: targetType=%02x ", n + 1, antTargets[n].ptt); + switch(antTargets[n].ptt) { + case PTT_JEWEL_106: printf ("(Innovision Jewel tag), targetData:\n"); print_nfc_jewel_info (antTargets[n].nti.nji); break; - case NTT_MIFARE: + case PTT_MIFARE: printf ("(Mifare card), targetData:\n"); print_nfc_iso14443a_info (antTargets[n].nti.nai); break; - case NTT_FELICA_212: + case PTT_FELICA_212: printf ("(FeliCa 212 kbps card), targetData:\n"); print_nfc_felica_info (antTargets[n].nti.nfi); break; - case NTT_FELICA_424: + case PTT_FELICA_424: printf ("(FeliCa 212 kbps card), targetData:\n"); print_nfc_felica_info (antTargets[n].nti.nfi); break; - case NTT_ISO14443_4A_106: + case PTT_ISO14443_4A_106: printf ("(Passive 106 kbps ISO/IEC 14443-4A card), targetData:\n"); print_nfc_iso14443a_info (antTargets[n].nti.nai); break; - case NTT_ISO14443_4B_TCL_106: + case PTT_ISO14443_4B_TCL_106: printf ("(Passive 106 kbps ISO/IEC 14443-4B card), targetData:\n"); print_nfc_iso14443b_info (antTargets[n].nti.nbi); break; - case NTT_DEP_PASSIVE_106: + case PTT_DEP_PASSIVE_106: printf ("(DEP passive 106 kbps)\n"); break; - case NTT_DEP_PASSIVE_212: + case PTT_DEP_PASSIVE_212: printf ("(DEP passive 212 kbps)\n"); break; - case NTT_DEP_PASSIVE_424: + case PTT_DEP_PASSIVE_424: printf ("(DEP passive 424 kbps)\n"); break; - case NTT_DEP_ACTIVE_106: + case PTT_DEP_ACTIVE_106: printf ("(DEP active 106 kbps)\n"); break; - case NTT_DEP_ACTIVE_212: + case PTT_DEP_ACTIVE_212: printf ("(DEP active 212 kbps)\n"); break; - case NTT_DEP_ACTIVE_424: + case PTT_DEP_ACTIVE_424: printf ("(DEP active 424 kbps)\n"); break; }; diff --git a/examples/nfc-relay.c b/examples/nfc-relay.c index 90b1e4e..fb2d9b1 100644 --- a/examples/nfc-relay.c +++ b/examples/nfc-relay.c @@ -127,7 +127,7 @@ main (int argc, char *argv[]) printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n"); nfc_target_t nt = { - .ntt = NTT_MIFARE, + .ptt = PTT_MIFARE, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-utils.c b/examples/nfc-utils.c index 47f3e75..6dfacd8 100644 --- a/examples/nfc-utils.c +++ b/examples/nfc-utils.c @@ -212,55 +212,55 @@ print_nfc_dep_info (const nfc_dep_info_t ndi) } } -void print_nfc_target_type( const nfc_target_type_t ntt ) +void print_nfc_target_type( const pn53x_target_type_t ptt ) { - switch (ntt) { - case NTT_GENERIC_PASSIVE_106: + switch (ptt) { + case PTT_GENERIC_PASSIVE_106: printf ("Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP)\n"); break; - case NTT_GENERIC_PASSIVE_212: + case PTT_GENERIC_PASSIVE_212: printf ("Generic passive 212 kbps (FeliCa, DEP)\n"); break; - case NTT_GENERIC_PASSIVE_424: + case PTT_GENERIC_PASSIVE_424: printf ("Generic passive 424 kbps (FeliCa, DEP)\n"); break; - case NTT_ISO14443_4B_106: + case PTT_ISO14443_4B_106: printf ("Passive 106 kbps ISO/IEC14443-4B\n"); break; - case NTT_JEWEL_106: + case PTT_JEWEL_106: printf ("Innovision Jewel tag\n"); break; - case NTT_MIFARE: + case PTT_MIFARE: printf ("mifare card\n"); break; - case NTT_FELICA_212: + case PTT_FELICA_212: printf ("FeliCa 212 kbps card\n"); break; - case NTT_FELICA_424: + case PTT_FELICA_424: printf ("FeliCa 424 kbps card\n"); break; - case NTT_ISO14443_4A_106: + case PTT_ISO14443_4A_106: printf ("Passive 106 kbps ISO/IEC14443-4A\n"); break; - case NTT_ISO14443_4B_TCL_106: + case PTT_ISO14443_4B_TCL_106: printf ("Passive 106 kbps ISO/IEC14443-4B with TCL flag\n"); break; - case NTT_DEP_PASSIVE_106: + case PTT_DEP_PASSIVE_106: printf ("DEP passive 106 kbps\n"); break; - case NTT_DEP_PASSIVE_212: + case PTT_DEP_PASSIVE_212: printf ("DEP passive 212 kbps\n"); break; - case NTT_DEP_PASSIVE_424: + case PTT_DEP_PASSIVE_424: printf ("DEP passive 424 kbps\n"); break; - case NTT_DEP_ACTIVE_106: + case PTT_DEP_ACTIVE_106: printf ("DEP active 106 kbps\n"); break; - case NTT_DEP_ACTIVE_212: + case PTT_DEP_ACTIVE_212: printf ("DEP active 212 kbps\n"); break; - case NTT_DEP_ACTIVE_424: + case PTT_DEP_ACTIVE_424: printf ("DEP active 424 kbps\n"); break; } diff --git a/examples/nfc-utils.h b/examples/nfc-utils.h index a842c77..83c5de4 100644 --- a/examples/nfc-utils.h +++ b/examples/nfc-utils.h @@ -40,7 +40,7 @@ void print_nfc_felica_info (const nfc_felica_info_t nfi); void print_nfc_jewel_info (const nfc_jewel_info_t nji); void print_nfc_dep_info (const nfc_dep_info_t ndi); -void print_nfc_target_type( const nfc_target_type_t ntt ); +void print_nfc_target_type( const pn53x_target_type_t ptt ); nfc_device_desc_t *parse_device_desc (int argc, const char *argv[], size_t * szFound); diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 181cd37..750e4f2 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -198,7 +198,7 @@ main (int argc, const char *argv[]) size_t szRx; nfc_target_t nt = { - .ntt = NTT_MIFARE, + .ptt = PTT_MIFARE, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xaf }, .nti.nai.btSak = 0x20, diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index 5270cd5..a51dbfd 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -291,43 +291,43 @@ typedef enum { } nfc_target_mode_t; /** - * @enum nfc_target_type_t + * @enum pn53x_target_type_t * @brief NFC target type enumeration */ typedef enum { /** Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP) */ - NTT_GENERIC_PASSIVE_106 = 0x00, + PTT_GENERIC_PASSIVE_106 = 0x00, /** Generic passive 212 kbps (FeliCa, DEP) */ - NTT_GENERIC_PASSIVE_212 = 0x01, + PTT_GENERIC_PASSIVE_212 = 0x01, /** Generic passive 424 kbps (FeliCa, DEP) */ - NTT_GENERIC_PASSIVE_424 = 0x02, + PTT_GENERIC_PASSIVE_424 = 0x02, /** Passive 106 kbps ISO/IEC14443-4B */ - NTT_ISO14443_4B_106 = 0x03, + PTT_ISO14443_4B_106 = 0x03, /** Innovision Jewel tag */ - NTT_JEWEL_106 = 0x04, + PTT_JEWEL_106 = 0x04, /** Mifare card */ - NTT_MIFARE = 0x10, + PTT_MIFARE = 0x10, /** FeliCa 212 kbps card */ - NTT_FELICA_212 = 0x11, + PTT_FELICA_212 = 0x11, /** FeliCa 424 kbps card */ - NTT_FELICA_424 = 0x12, + PTT_FELICA_424 = 0x12, /** Passive 106 kbps ISO/IEC 14443-4A */ - NTT_ISO14443_4A_106 = 0x20, + PTT_ISO14443_4A_106 = 0x20, /** Passive 106 kbps ISO/IEC 14443-4B with TCL flag */ - NTT_ISO14443_4B_TCL_106 = 0x23, + PTT_ISO14443_4B_TCL_106 = 0x23, /** DEP passive 106 kbps */ - NTT_DEP_PASSIVE_106 = 0x40, + PTT_DEP_PASSIVE_106 = 0x40, /** DEP passive 212 kbps */ - NTT_DEP_PASSIVE_212 = 0x41, + PTT_DEP_PASSIVE_212 = 0x41, /** DEP passive 424 kbps */ - NTT_DEP_PASSIVE_424 = 0x42, + PTT_DEP_PASSIVE_424 = 0x42, /** DEP active 106 kbps */ - NTT_DEP_ACTIVE_106 = 0x80, + PTT_DEP_ACTIVE_106 = 0x80, /** DEP active 212 kbps */ - NTT_DEP_ACTIVE_212 = 0x81, + PTT_DEP_ACTIVE_212 = 0x81, /** DEP active 424 kbps */ - NTT_DEP_ACTIVE_424 = 0x82, -} nfc_target_type_t; + PTT_DEP_ACTIVE_424 = 0x82, +} pn53x_target_type_t; /** * @struct nfc_target_t @@ -335,7 +335,7 @@ typedef enum { */ typedef struct { nfc_target_info_t nti; - nfc_target_type_t ntt; + pn53x_target_type_t ptt; } nfc_target_t; // Reset struct alignment to default diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index ca7d58b..6c5e6ba 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -74,7 +74,7 @@ extern "C" { NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, nfc_target_info_t anti[], const size_t szTargets, size_t * pszTargetFound); - NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const nfc_target_type_t * pnttTargetTypes, + NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound); NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index e767cf1..95a6069 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -369,15 +369,15 @@ pn53x_unwrap_frame (const byte_t * pbtFrame, const size_t szFrameBits, byte_t * } bool -pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, nfc_target_type_t ntt, +pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, pn53x_target_type_t ptt, nfc_target_info_t * pnti) { uint8_t szAttribRes; - switch (ntt) { - case NTT_MIFARE: - case NTT_GENERIC_PASSIVE_106: - case NTT_ISO14443_4A_106: + switch (ptt) { + case PTT_MIFARE: + case PTT_GENERIC_PASSIVE_106: + case PTT_ISO14443_4A_106: // We skip the first byte: its the target number (Tg) pbtRawData++; @@ -415,8 +415,8 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ } break; - case NTT_ISO14443_4B_106: - case NTT_ISO14443_4B_TCL_106: + case PTT_ISO14443_4B_106: + case PTT_ISO14443_4B_TCL_106: // We skip the first byte: its the target number (Tg) pbtRawData++; @@ -442,8 +442,8 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ } break; - case NTT_FELICA_212: - case NTT_FELICA_424: + case PTT_FELICA_212: + case PTT_FELICA_424: // We skip the first byte: its the target number (Tg) pbtRawData++; @@ -461,7 +461,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ memcpy (pnti->nfi.abtSysCode, pbtRawData, 2); } break; - case NTT_JEWEL_106: + case PTT_JEWEL_106: // We skip the first byte: its the target number (Tg) pbtRawData++; @@ -569,7 +569,7 @@ pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target) bool pn53x_InAutoPoll (nfc_device_t * pnd, - const nfc_target_type_t * pnttTargetTypes, const size_t szTargetTypes, + const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound) { size_t szTxInAutoPoll, @@ -592,7 +592,7 @@ pn53x_InAutoPoll (nfc_device_t * pnd, pbtTxInAutoPoll[2] = btPollNr; pbtTxInAutoPoll[3] = btPeriod; for (n = 0; n < szTargetTypes; n++) { - pbtTxInAutoPoll[4 + n] = pnttTargetTypes[n]; + pbtTxInAutoPoll[4 + n] = ppttTargetTypes[n]; } szRx = MAX_FRAME_LEN; @@ -607,19 +607,19 @@ pn53x_InAutoPoll (nfc_device_t * pnd, byte_t *pbt = abtRx + 1; /* 1st target */ // Target type - pntTargets[0].ntt = *(pbt++); + pntTargets[0].ptt = *(pbt++); // AutoPollTargetData length ln = *(pbt++); - pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[0].ntt, &(pntTargets[0].nti)); + pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[0].ptt, &(pntTargets[0].nti)); pbt += ln; if (abtRx[0] > 1) { /* 2nd target */ // Target type - pntTargets[1].ntt = *(pbt++); + pntTargets[1].ptt = *(pbt++); // AutoPollTargetData length ln = *(pbt++); - pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[1].ntt, &(pntTargets[1].nti)); + pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[1].ptt, &(pntTargets[1].nti)); } } } @@ -1070,10 +1070,10 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta const byte_t * pbtGB = NULL; size_t szGB = 0; - switch(nt.ntt) { - case NTT_MIFARE: - case NTT_GENERIC_PASSIVE_106: - case NTT_ISO14443_4A_106: { + switch(nt.ptt) { + case PTT_MIFARE: + case PTT_GENERIC_PASSIVE_106: + case PTT_ISO14443_4A_106: { // Set ATQA (SENS_RES) abtMifareParams[0] = nt.nti.nai.abtAtqa[1]; abtMifareParams[1] = nt.nti.nai.abtAtqa[0]; @@ -1089,8 +1089,8 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta } break; - case NTT_FELICA_212: - case NTT_FELICA_424: + case PTT_FELICA_212: + case PTT_FELICA_424: // Set NFCID2t memcpy(abtFeliCaParams, nt.nti.nfi.abtId, 8); // Set PAD @@ -1100,9 +1100,9 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta pbtFeliCaParams = abtFeliCaParams; break; - case NTT_DEP_PASSIVE_106: - case NTT_DEP_PASSIVE_212: - case NTT_DEP_PASSIVE_424: + case PTT_DEP_PASSIVE_106: + case PTT_DEP_PASSIVE_212: + case PTT_DEP_PASSIVE_424: pbtNFCID3t = nt.nti.ndi.abtNFCID3; szGB = nt.nti.ndi.szGB; if (szGB) pbtGB = nt.nti.ndi.abtGB; diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index bab0610..346fdaf 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -105,7 +105,7 @@ bool pn53x_wrap_frame (const byte_t * pbtTx, const size_t szTxBits, const byt size_t * pszFrameBits); bool pn53x_unwrap_frame (const byte_t * pbtFrame, const size_t szFrameBits, byte_t * pbtRx, size_t * pszRxBits, byte_t * pbtRxPar); -bool pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, nfc_target_type_t ntt, +bool pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, pn53x_target_type_t ptt, nfc_target_info_t * pnti); bool pn53x_get_firmware_version (nfc_device_t * pnd); @@ -140,7 +140,7 @@ bool pn53x_InListPassiveTarget (nfc_device_t * pnd, const nfc_modulation_t nm const size_t szInitiatorDataLen, byte_t * pbtTargetsData, size_t * pszTargetsData); bool pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target); bool pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target); -bool pn53x_InAutoPoll (nfc_device_t * pnd, const nfc_target_type_t * pnttTargetTypes, const size_t szTargetTypes, +bool pn53x_InAutoPoll (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound); bool pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 15d4064..82e70d7 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -333,30 +333,30 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, // Fill the tag info struct with the values corresponding to this init modulation switch (nmInitModulation) { case NM_ISO14443A_106: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_GENERIC_PASSIVE_106, pnti)) { + if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_GENERIC_PASSIVE_106, pnti)) { return false; } break; case NM_FELICA_212: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_FELICA_212, pnti)) { + if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_212, pnti)) { return false; } break; case NM_FELICA_424: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_FELICA_424, pnti)) { + if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_424, pnti)) { return false; } break; case NM_ISO14443B_106: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_ISO14443_4B_106, pnti)) { + if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_ISO14443_4B_106, pnti)) { return false; } break; case NM_JEWEL_106: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, NTT_JEWEL_106, pnti)) { + if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_JEWEL_106, pnti)) { return false; } break; @@ -431,8 +431,8 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n * @return Returns \c true if action was successfully performed; otherwise returns \c false. * * @param pnd \a nfc_device_t struct pointer that represent currently used device - * @param pnttTargetTypes array of desired target types - * @param szTargetTypes pnttTargetTypes count + * @param ppttTargetTypes array of desired target types + * @param szTargetTypes ppttTargetTypes count * @param btPollNr specifies the number of polling * @note one polling is a polling for each desired target type * @param btPeriod indicates the polling period in units of 150 ms @@ -441,13 +441,13 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n */ bool nfc_initiator_poll_targets (nfc_device_t * pnd, - const nfc_target_type_t * pnttTargetTypes, const size_t szTargetTypes, + const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound) { pnd->iLastError = 0; - return pn53x_InAutoPoll (pnd, pnttTargetTypes, szTargetTypes, btPollNr, btPeriod, pntTargets, pszTargetFound); + return pn53x_InAutoPoll (pnd, ppttTargetTypes, szTargetTypes, btPollNr, btPeriod, pntTargets, pszTargetFound); } /** From 9020014160301c16e11636e5cf26d439724e685f Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 15:39:52 +0000 Subject: [PATCH 02/19] Rename nfc_modulation_t as pn53x_modulation_t --- examples/doc/quick_start_example1.c | 2 +- examples/nfc-dep-initiator.c | 2 +- examples/nfc-list.c | 10 ++++---- examples/nfc-mfclassic.c | 8 +++--- examples/nfc-mfultralight.c | 4 +-- examples/pn53x-sam.c | 2 +- include/nfc/nfc-types.h | 24 ++++++++--------- include/nfc/nfc.h | 6 ++--- libnfc/chips/pn53x.c | 38 +++++++++++++-------------- libnfc/chips/pn53x.h | 6 ++--- libnfc/nfc.c | 40 ++++++++++++++--------------- test/test_access_storm.c | 2 +- 12 files changed, 72 insertions(+), 72 deletions(-) diff --git a/examples/doc/quick_start_example1.c b/examples/doc/quick_start_example1.c index f8dd379..22c4cc9 100644 --- a/examples/doc/quick_start_example1.c +++ b/examples/doc/quick_start_example1.c @@ -32,7 +32,7 @@ main (int argc, const char *argv[]) printf ("Connected to NFC reader: %s\n", pnd->acName); // Poll for a ISO14443A (MIFARE) tag - if (nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { printf ("The following (NFC) ISO14443A tag was found:\n"); printf (" ATQA (SENS_RES): "); print_hex (nti.nai.abtAtqa, 2); diff --git a/examples/nfc-dep-initiator.c b/examples/nfc-dep-initiator.c index eb5f34a..b8d63b9 100644 --- a/examples/nfc-dep-initiator.c +++ b/examples/nfc-dep-initiator.c @@ -62,7 +62,7 @@ main (int argc, const char *argv[]) return EXIT_FAILURE; } - if(!nfc_initiator_select_dep_target (pnd, NM_PASSIVE_DEP, NULL, &nti)) { + if(!nfc_initiator_select_dep_target (pnd, PM_PASSIVE_DEP, NULL, &nti)) { nfc_perror(pnd, "nfc_initiator_select_dep_target"); return EXIT_FAILURE; } diff --git a/examples/nfc-list.c b/examples/nfc-list.c index e20c16c..9304cbd 100644 --- a/examples/nfc-list.c +++ b/examples/nfc-list.c @@ -142,7 +142,7 @@ main (int argc, const char *argv[]) printf ("Connected to NFC device: %s\n", pnd->acName); // List ISO14443A targets - if (nfc_initiator_list_passive_targets (pnd, NM_ISO14443A_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, PM_ISO14443A_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d ISO14443A passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); for (n = 0; n < szTargetFound; n++) { @@ -151,7 +151,7 @@ main (int argc, const char *argv[]) } } // List Felica tags - if (nfc_initiator_list_passive_targets (pnd, NM_FELICA_212, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, PM_FELICA_212, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d Felica (212 kbps) passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); @@ -160,7 +160,7 @@ main (int argc, const char *argv[]) printf ("\n"); } } - if (nfc_initiator_list_passive_targets (pnd, NM_FELICA_424, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, PM_FELICA_424, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d Felica (424 kbps) passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); @@ -170,7 +170,7 @@ main (int argc, const char *argv[]) } } // List ISO14443B targets - if (nfc_initiator_list_passive_targets (pnd, NM_ISO14443B_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, PM_ISO14443B_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d ISO14443B passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); for (n = 0; n < szTargetFound; n++) { @@ -180,7 +180,7 @@ main (int argc, const char *argv[]) } // List Jewel targets - if (nfc_initiator_list_passive_targets(pnd, NM_JEWEL_106, anti, MAX_TARGET_COUNT, &szTargetFound )) { + if (nfc_initiator_list_passive_targets(pnd, PM_JEWEL_106, anti, MAX_TARGET_COUNT, &szTargetFound )) { size_t n; printf("%d Jewel passive target(s) was found%s\n", (int)szTargetFound, (szTargetFound==0)?".\n":":"); for(n=0; nacName); // Try to find a MIFARE Classic tag - if (!nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { printf ("Error: no tag was found\n"); nfc_disconnect (pnd); exit (EXIT_FAILURE); diff --git a/examples/nfc-mfultralight.c b/examples/nfc-mfultralight.c index 3ef4db1..9076d7e 100644 --- a/examples/nfc-mfultralight.c +++ b/examples/nfc-mfultralight.c @@ -116,7 +116,7 @@ write_card (void) // Show if the readout went well if (bFailure) { // When a failure occured we need to redo the anti-collision - if (!nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { ERR ("tag was removed"); return false; } @@ -216,7 +216,7 @@ main (int argc, const char *argv[]) printf ("Connected to NFC device: %s\n", pnd->acName); // Try to find a MIFARE Ultralight tag - if (!nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { ERR ("no tag was found\n"); nfc_disconnect (pnd); return 1; diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 750e4f2..85241ec 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -181,7 +181,7 @@ main (int argc, const char *argv[]) exit (EXIT_FAILURE); } // Read the SAM's info - if (!nfc_initiator_select_passive_target (pnd, NM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { nfc_perror (pnd, "nfc_initiator_select_passive_target"); ERR ("%s", "Reading of SAM info failed."); return EXIT_FAILURE; diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index a51dbfd..eed268f 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -166,31 +166,31 @@ typedef enum { } nfc_device_option_t; /** - * @enum nfc_modulation_t + * @enum pn53x_modulation_t * @brief NFC modulation */ typedef enum { /** ISO14443-A (NXP MIFARE) http://en.wikipedia.org/wiki/MIFARE */ - NM_ISO14443A_106 = 0x00, + PM_ISO14443A_106 = 0x00, /** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ - NM_FELICA_212 = 0x01, + PM_FELICA_212 = 0x01, /** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ - NM_FELICA_424 = 0x02, + PM_FELICA_424 = 0x02, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */ - NM_ISO14443B_106 = 0x03, + PM_ISO14443B_106 = 0x03, /** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */ - NM_JEWEL_106 = 0x04, + PM_JEWEL_106 = 0x04, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - NM_ISO14443B_212 = 0x06, + PM_ISO14443B_212 = 0x06, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - NM_ISO14443B_424 = 0x07, + PM_ISO14443B_424 = 0x07, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - NM_ISO14443B_847 = 0x08, + PM_ISO14443B_847 = 0x08, /** Active DEP */ - NM_ACTIVE_DEP, + PM_ACTIVE_DEP, /** Passive DEP */ - NM_PASSIVE_DEP -} nfc_modulation_t; + PM_PASSIVE_DEP +} pn53x_modulation_t; /** * @struct nfc_dep_info_t diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index 6c5e6ba..6932465 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -68,16 +68,16 @@ extern "C" { /* NFC initiator: act as "reader" */ NFC_EXPORT bool nfc_initiator_init (nfc_device_t * pnd); - NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, + NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const byte_t * pbtInitData, const size_t szInitDataLen, nfc_target_info_t * pti); - NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, + NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, nfc_target_info_t anti[], const size_t szTargets, size_t * pszTargetFound); NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound); - NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, + NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pti); NFC_EXPORT bool nfc_initiator_deselect_target (nfc_device_t * pnd); diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 95a6069..32bac36 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -482,7 +482,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ * @return true if command is successfully sent * * @param pnd nfc_device_t struct pointer that represent currently used device - * @param nmInitModulation Desired modulation + * @param pmInitModulation Desired modulation * @param pbtInitiatorData Optional initiator data used for Felica, ISO14443B, Topaz Polling or for ISO14443A selecting a specific UID * @param szInitiatorDataLen Length of initiator data \a pbtInitiatorData * @param pbtTargetsData pointer on a pre-allocated byte array to receive TargetData[n] as described in pn53x user manual @@ -493,7 +493,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ */ bool pn53x_InListPassiveTarget (nfc_device_t * pnd, - const nfc_modulation_t nmInitModulation, const byte_t szMaxTargets, + const pn53x_modulation_t pmInitModulation, const byte_t szMaxTargets, const byte_t * pbtInitiatorData, const size_t szInitiatorDataLen, byte_t * pbtTargetsData, size_t * pszTargetsData) { @@ -504,23 +504,23 @@ pn53x_InListPassiveTarget (nfc_device_t * pnd, abtCmd[2] = szMaxTargets; // MaxTg // XXX Is there is a better way to do this ? - switch(nmInitModulation) { - case NM_ISO14443A_106: - case NM_FELICA_212: - case NM_FELICA_424: + switch(pmInitModulation) { + case PM_ISO14443A_106: + case PM_FELICA_212: + case PM_FELICA_424: // all gone fine. break; - case NM_ISO14443B_106: - case NM_JEWEL_106: + case PM_ISO14443B_106: + case PM_JEWEL_106: if(pnd->nc == NC_PN531) { // These modulations are not supported by pn531 pnd->iLastError = DENOTSUP; return false; } break; - case NM_ISO14443B_212: - case NM_ISO14443B_424: - case NM_ISO14443B_847: + case PM_ISO14443B_212: + case PM_ISO14443B_424: + case PM_ISO14443B_847: if(pnd->nc != NC_PN533) { // These modulations are not supported by pn531 neither pn532 pnd->iLastError = DENOTSUP; @@ -531,7 +531,7 @@ pn53x_InListPassiveTarget (nfc_device_t * pnd, pnd->iLastError = DENOTSUP; return false; } - abtCmd[3] = nmInitModulation; // BrTy, the type of init modulation used for polling a passive tag + abtCmd[3] = pmInitModulation; // BrTy, the type of init modulation used for polling a passive tag // Set the optional initiator data (used for Felica, ISO14443B, Topaz Polling or for ISO14443A selecting a specific UID). if (pbtInitiatorData) @@ -821,20 +821,20 @@ pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool b } bool -pn53x_initiator_select_dep_target(nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +pn53x_initiator_select_dep_target(nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) { if (pndiInitiator) { - return pn53x_InJumpForDEP (pnd, nmInitModulation, NULL, 0, pndiInitiator->abtNFCID3, pndiInitiator->abtGB, pndiInitiator->szGB, pnti); + return pn53x_InJumpForDEP (pnd, pmInitModulation, NULL, 0, pndiInitiator->abtNFCID3, pndiInitiator->abtGB, pndiInitiator->szGB, pnti); } else { - return pn53x_InJumpForDEP (pnd, nmInitModulation, NULL, 0, NULL, NULL, 0, pnti); + return pn53x_InJumpForDEP (pnd, pmInitModulation, NULL, 0, NULL, NULL, 0, pnti); } } /** * @brief Wrapper for InJumpForDEP command - * @param nmInitModulation desired initial modulation + * @param pmInitModulation desired initial modulation * @param pbtPassiveInitiatorData NFCID1 at 106kbps (see NFCIP-1: 11.2.1.26) or Polling Request Frame's payload at 212/424kbps (see NFCIP-1: 11.2.2.5) * @param szPassiveInitiatorData size of pbtPassiveInitiatorData content * @param pbtNFCID3i NFCID3 of the initiator @@ -843,7 +843,7 @@ pn53x_initiator_select_dep_target(nfc_device_t * pnd, const nfc_modulation_t nmI * @param[out] pnti nfc_target_info_t which will be filled by this function */ bool -pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +pn53x_InJumpForDEP (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const byte_t * pbtPassiveInitiatorData, const size_t szPassiveInitiatorData, const byte_t * pbtNFCID3i, const byte_t * pbtGB, const size_t szGB, @@ -856,14 +856,14 @@ pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, memcpy (abtCmd, pncmd_initiator_jump_for_dep, sizeof (pncmd_initiator_jump_for_dep)); - if (nmInitModulation == NM_ACTIVE_DEP) { + if (pmInitModulation == PM_ACTIVE_DEP) { abtCmd[2] = 0x01; /* active DEP */ } // FIXME Baud rate in D.E.P. mode is hard-wired as 106kbps abtCmd[3] = 0x00; /* baud rate = 106kbps */ offset = 5; - if (pbtPassiveInitiatorData && (nmInitModulation != NM_ACTIVE_DEP)) { /* can't have passive initiator data when using active mode */ + if (pbtPassiveInitiatorData && (pmInitModulation != PM_ACTIVE_DEP)) { /* can't have passive initiator data when using active mode */ abtCmd[4] |= 0x01; memcpy (abtCmd + offset, pbtPassiveInitiatorData, szPassiveInitiatorData); offset += szPassiveInitiatorData; diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 346fdaf..e2ad140 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -112,7 +112,7 @@ bool pn53x_get_firmware_version (nfc_device_t * pnd); bool pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool bEnable); // NFC device as Initiator functions -bool pn53x_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +bool pn53x_initiator_select_dep_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti); bool pn53x_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits, @@ -135,7 +135,7 @@ static const struct chip_callbacks pn53x_callbacks_list = { // C wrappers for PN53x commands bool pn53x_SetParameters (nfc_device_t * pnd, const uint8_t ui8Value); -bool pn53x_InListPassiveTarget (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +bool pn53x_InListPassiveTarget (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const byte_t szMaxTargets, const byte_t * pbtInitiatorData, const size_t szInitiatorDataLen, byte_t * pbtTargetsData, size_t * pszTargetsData); bool pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target); @@ -143,7 +143,7 @@ bool pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target); bool pn53x_InAutoPoll (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound); -bool pn53x_InJumpForDEP (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +bool pn53x_InJumpForDEP (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const byte_t * pbtPassiveInitiatorData, const size_t szPassiveInitiatorData, const byte_t * pbtNFCID3i, const byte_t * pbtGB, const size_t szGB, diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 82e70d7..dc38322 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -262,7 +262,7 @@ nfc_initiator_init (nfc_device_t * pnd) * @return Returns \c true if action was successfully performed; otherwise returns \c false. * * @param pnd \a nfc_device_t struct pointer that represent currently used device - * @param nmInitModulation Desired modulation + * @param pmInitModulation Desired modulation * @param pbtInitData Optional initiator data used for Felica, ISO14443B, Topaz polling or to select a specific UID in ISO14443A. * @param szInitDataLen Length of initiator data \a pbtInitData. * @param[out] pnti nfc_target_info_t struct pointer which will filled if available @@ -275,7 +275,7 @@ nfc_initiator_init (nfc_device_t * pnd) */ bool nfc_initiator_select_passive_target (nfc_device_t * pnd, - const nfc_modulation_t nmInitModulation, + const pn53x_modulation_t pmInitModulation, const byte_t * pbtInitData, const size_t szInitDataLen, nfc_target_info_t * pnti) { byte_t abtInit[MAX_FRAME_LEN]; @@ -290,8 +290,8 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, if (!pnd->bActive) return false; // TODO Put this in a function: this part is defined by ISO14443-3 (UID and Cascade levels) - switch (nmInitModulation) { - case NM_ISO14443A_106: + switch (pmInitModulation) { + case PM_ISO14443A_106: switch (szInitDataLen) { case 7: abtInit[0] = 0x88; @@ -321,7 +321,7 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, break; } - if (!pn53x_InListPassiveTarget (pnd, nmInitModulation, 1, abtInit, szInitLen, abtTargetsData, &szTargetsData)) + if (!pn53x_InListPassiveTarget (pnd, pmInitModulation, 1, abtInit, szInitLen, abtTargetsData, &szTargetsData)) return false; // Make sure one tag has been found, the PN53X returns 0x00 if none was available @@ -331,31 +331,31 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, // Is a tag info struct available if (pnti) { // Fill the tag info struct with the values corresponding to this init modulation - switch (nmInitModulation) { - case NM_ISO14443A_106: + switch (pmInitModulation) { + case PM_ISO14443A_106: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_GENERIC_PASSIVE_106, pnti)) { return false; } break; - case NM_FELICA_212: + case PM_FELICA_212: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_212, pnti)) { return false; } break; - case NM_FELICA_424: + case PM_FELICA_424: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_424, pnti)) { return false; } break; - case NM_ISO14443B_106: + case PM_ISO14443B_106: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_ISO14443_4B_106, pnti)) { return false; } break; - case NM_JEWEL_106: + case PM_JEWEL_106: if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_JEWEL_106, pnti)) { return false; } @@ -375,7 +375,7 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, * @return Returns \c true if action was successfully performed; otherwise returns \c false. * * @param pnd \a nfc_device_t struct pointer that represent currently used device - * @param nmInitModulation Desired modulation + * @param pmInitModulation Desired modulation * @param[out] anti array of \a nfc_target_info_t that will be filled with targets info * @param szTargets Size of \a anti (will be the max targets listed) * @param[out] pszTargetFound Pointer where target found counter will be stored @@ -384,7 +384,7 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, * @note For every initial modulation type there is a different collection of information returned (in \a nfc_target_info_t pointer pti) They all fit in the data-type which is called nfc_target_info_t. This is a union which contains the tag information that belongs to the according initial modulation type. */ bool -nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, +nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, nfc_target_info_t anti[], const size_t szTargets, size_t * pszTargetFound) { nfc_target_info_t nti; @@ -397,17 +397,17 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n // Let the reader only try once to find a target nfc_configure (pnd, NDO_INFINITE_SELECT, false); - if (nmInitModulation == NM_ISO14443B_106) { + if (pmInitModulation == PM_ISO14443B_106) { // Application Family Identifier (AFI) must equals 0x00 in order to wakeup all ISO14443-B PICCs (see ISO/IEC 14443-3) pbtInitData = (byte_t *) "\x00"; szInitDataLen = 1; - } else if (nmInitModulation == NM_FELICA_212 || nmInitModulation == NM_FELICA_424) { + } else if (pmInitModulation == PM_FELICA_212 || pmInitModulation == PM_FELICA_424) { // polling payload must be present (see ISO/IEC 18092 11.2.2.5) pbtInitData = (byte_t *) "\x00\xff\xff\x01\x00"; szInitDataLen = 5; } - while (nfc_initiator_select_passive_target (pnd, nmInitModulation, pbtInitData, szInitDataLen, &nti)) { + while (nfc_initiator_select_passive_target (pnd, pmInitModulation, pbtInitData, szInitDataLen, &nti)) { nfc_initiator_deselect_target (pnd); if (szTargets > szTargetFound) { @@ -417,7 +417,7 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t n } szTargetFound++; // deselect has no effect on FeliCa and Jewel cards so we'll stop after one... - if (nmInitModulation == NM_FELICA_212 || nmInitModulation == NM_FELICA_424 || nmInitModulation == NM_JEWEL_106) { + if (pmInitModulation == PM_FELICA_212 || pmInitModulation == PM_FELICA_424 || pmInitModulation == PM_JEWEL_106) { break; } } @@ -455,7 +455,7 @@ nfc_initiator_poll_targets (nfc_device_t * pnd, * @return Returns \c true if action was successfully performed; otherwise returns \c false. * * @param pnd \a nfc_device_t struct pointer that represent currently used device - * @param nmInitModulation desired modulation (\a NM_ACTIVE_DEP or \a NM_PASSIVE_DEP for active, respectively passive mode) + * @param pmInitModulation desired modulation (\a PM_ACTIVE_DEP or \a PM_PASSIVE_DEP for active, respectively passive mode) * @param ndiInitiator \a nfc_dep_info_t struct that contains NFCID3 and General Bytes to set to the initiator device * @param[out] pnti is a \a nfc_target_info_t struct pointer where target information will be put. * @@ -466,11 +466,11 @@ nfc_initiator_poll_targets (nfc_device_t * pnd, * @note \a nfc_dep_info_t will be returned when the target was acquired successfully. */ bool -nfc_initiator_select_dep_target (nfc_device_t * pnd, const nfc_modulation_t nmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) +nfc_initiator_select_dep_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) { pnd->iLastError = 0; - return pn53x_initiator_select_dep_target (pnd, nmInitModulation, pndiInitiator, pnti); + return pn53x_initiator_select_dep_target (pnd, pmInitModulation, pndiInitiator, pnti); } /** diff --git a/test/test_access_storm.c b/test/test_access_storm.c index de1e715..ddc95f8 100644 --- a/test/test_access_storm.c +++ b/test/test_access_storm.c @@ -56,7 +56,7 @@ test_access_storm (void) res = nfc_configure(device,NDO_ACTIVATE_FIELD,true); cut_assert_true (res, cut_message ("nfc_configure")); - res = nfc_initiator_list_passive_targets(device, NM_ISO14443A_106, anti, MAX_TARGET_COUNT, &target_count); + res = nfc_initiator_list_passive_targets(device, PM_ISO14443A_106, anti, MAX_TARGET_COUNT, &target_count); cut_assert_true (res, cut_message ("nfc_initiator_list_passive_targets")); nfc_disconnect (device); From d289eabc366cbb40be1a28edbe7f778a383514de Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 17:43:23 +0000 Subject: [PATCH 03/19] Attempt to provide clean types for API --- examples/nfc-dep-initiator.c | 2 +- examples/nfc-dep-target.c | 2 +- examples/nfc-emulate-forum-tag4.c | 2 +- examples/nfc-emulate-tag.c | 6 +- examples/nfc-emulate-uid.c | 2 +- examples/nfc-list.c | 24 +++- examples/nfc-mfclassic.c | 13 +- examples/nfc-mfultralight.c | 9 +- examples/nfc-poll.c | 62 ++------ examples/nfc-relay.c | 2 +- examples/nfc-utils.c | 81 ++++------- examples/nfc-utils.h | 2 - examples/pn53x-sam.c | 8 +- include/nfc/nfc-types.h | 92 ++++-------- include/nfc/nfc.h | 10 +- libnfc/chips/pn53x.c | 229 +++++++++++++++++++++++++----- libnfc/chips/pn53x.h | 81 ++++++++++- libnfc/nfc.c | 115 +++++---------- test/test_access_storm.c | 6 +- 19 files changed, 437 insertions(+), 311 deletions(-) diff --git a/examples/nfc-dep-initiator.c b/examples/nfc-dep-initiator.c index b8d63b9..039f7c2 100644 --- a/examples/nfc-dep-initiator.c +++ b/examples/nfc-dep-initiator.c @@ -62,7 +62,7 @@ main (int argc, const char *argv[]) return EXIT_FAILURE; } - if(!nfc_initiator_select_dep_target (pnd, PM_PASSIVE_DEP, NULL, &nti)) { + if(!nfc_initiator_select_dep_target (pnd, false, NULL, &nti)) { nfc_perror(pnd, "nfc_initiator_select_dep_target"); return EXIT_FAILURE; } diff --git a/examples/nfc-dep-target.c b/examples/nfc-dep-target.c index cf46d56..c140c81 100644 --- a/examples/nfc-dep-target.c +++ b/examples/nfc-dep-target.c @@ -66,7 +66,7 @@ main (int argc, const char *argv[]) } const nfc_target_t nt = { - .ptt = PTT_DEP_PASSIVE_106, + .nmt = NMT_DEP, .nti.ndi.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 }, .nti.ndi.szGB = 4, .nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 }, diff --git a/examples/nfc-emulate-forum-tag4.c b/examples/nfc-emulate-forum-tag4.c index 19b85c4..e05c6b9 100644 --- a/examples/nfc-emulate-forum-tag4.c +++ b/examples/nfc-emulate-forum-tag4.c @@ -112,7 +112,7 @@ main (int argc, char *argv[]) printf ("Emulating NDEF tag now, please touch it with a second NFC device\n"); nfc_target_t nt = { - .ptt = PTT_MIFARE, + .nmt = NMT_ISO14443A, .nti.nai.abtAtqa = { 0x00, 0x04 }, .nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index f43916c..8523947 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -173,7 +173,7 @@ main (int argc, char *argv[]) // Example of a Mifare Classic Mini // Note that crypto1 is not implemented in this example nfc_target_t nt = { - .ptt = PTT_MIFARE, + .nmt = NMT_ISO14443A, .nti.nai.abtAtqa = { 0x00, 0x04 }, .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, .nti.nai.btSak = 0x09, @@ -183,7 +183,7 @@ main (int argc, char *argv[]) /* // Example of a FeliCa nfc_target_t nt = { - .ptt = PTT_FELICA_212, + .nmt = NMT_FELICA, .nti.nfi.abtId = { 0x01, 0xFE, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF }, .nti.nfi.abtPad = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF }, .nti.nfi.abtSysCode = { 0xFF, 0xFF }, @@ -192,7 +192,7 @@ main (int argc, char *argv[]) /* // Example of a ISO14443-4 (DESfire) nfc_target_t nt = { - .ptt = PTT_MIFARE, + .nmt = NMT_ISO14443A, .nti.nai.abtAtqa = { 0x03, 0x44 }, .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-emulate-uid.c b/examples/nfc-emulate-uid.c index b5b60eb..407fad2 100644 --- a/examples/nfc-emulate-uid.c +++ b/examples/nfc-emulate-uid.c @@ -132,7 +132,7 @@ main (int argc, char *argv[]) // Note: We have to build a "fake" nfc_target_t in order to do exactly the same that was done before the new nfc_target_init() was introduced. nfc_target_t nt = { - .ptt = PTT_MIFARE, + .nmt = NMT_ISO14443A, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xaf }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-list.c b/examples/nfc-list.c index 9304cbd..bd3a9b8 100644 --- a/examples/nfc-list.c +++ b/examples/nfc-list.c @@ -142,7 +142,11 @@ main (int argc, const char *argv[]) printf ("Connected to NFC device: %s\n", pnd->acName); // List ISO14443A targets - if (nfc_initiator_list_passive_targets (pnd, PM_ISO14443A_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { + nfc_modulation_t nm = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106, + }; + if (nfc_initiator_list_passive_targets (pnd, nm, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d ISO14443A passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); for (n = 0; n < szTargetFound; n++) { @@ -150,8 +154,11 @@ main (int argc, const char *argv[]) printf ("\n"); } } + + nm.nmt = NMT_FELICA; + nm.nbr = NBR_212; // List Felica tags - if (nfc_initiator_list_passive_targets (pnd, PM_FELICA_212, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, nm, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d Felica (212 kbps) passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); @@ -160,7 +167,9 @@ main (int argc, const char *argv[]) printf ("\n"); } } - if (nfc_initiator_list_passive_targets (pnd, PM_FELICA_424, anti, MAX_TARGET_COUNT, &szTargetFound)) { + + nm.nbr = NBR_424; + if (nfc_initiator_list_passive_targets (pnd, nm, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d Felica (424 kbps) passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); @@ -169,8 +178,11 @@ main (int argc, const char *argv[]) printf ("\n"); } } + + nm.nmt = NMT_ISO14443B; + nm.nbr = NBR_106; // List ISO14443B targets - if (nfc_initiator_list_passive_targets (pnd, PM_ISO14443B_106, anti, MAX_TARGET_COUNT, &szTargetFound)) { + if (nfc_initiator_list_passive_targets (pnd, nm, anti, MAX_TARGET_COUNT, &szTargetFound)) { size_t n; printf ("%d ISO14443B passive target(s) was found%s\n", (int) szTargetFound, (szTargetFound == 0) ? ".\n" : ":"); for (n = 0; n < szTargetFound; n++) { @@ -179,8 +191,10 @@ main (int argc, const char *argv[]) } } + nm.nmt = NMT_JEWEL; + nm.nbr = NBR_106; // List Jewel targets - if (nfc_initiator_list_passive_targets(pnd, PM_JEWEL_106, anti, MAX_TARGET_COUNT, &szTargetFound )) { + if (nfc_initiator_list_passive_targets(pnd, nm, anti, MAX_TARGET_COUNT, &szTargetFound )) { size_t n; printf("%d Jewel passive target(s) was found%s\n", (int)szTargetFound, (szTargetFound==0)?".\n":":"); for(n=0; nacName); // Try to find a MIFARE Classic tag - if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nti)) { printf ("Error: no tag was found\n"); nfc_disconnect (pnd); exit (EXIT_FAILURE); diff --git a/examples/nfc-mfultralight.c b/examples/nfc-mfultralight.c index 9076d7e..c46da2b 100644 --- a/examples/nfc-mfultralight.c +++ b/examples/nfc-mfultralight.c @@ -47,6 +47,11 @@ static mifare_param mp; static mifareul_tag mtDump; static uint32_t uiBlocks = 0xF; +static const nfc_modulation_t nmMifare = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106, +}; + static void print_success_or_failure (bool bFailure, uint32_t * uiCounter) { @@ -116,7 +121,7 @@ write_card (void) // Show if the readout went well if (bFailure) { // When a failure occured we need to redo the anti-collision - if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nti)) { ERR ("tag was removed"); return false; } @@ -216,7 +221,7 @@ main (int argc, const char *argv[]) printf ("Connected to NFC device: %s\n", pnd->acName); // Try to find a MIFARE Ultralight tag - if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { + if (!nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nti)) { ERR ("no tag was found\n"); nfc_disconnect (pnd); return 1; diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index 3ac5aa8..5a22414 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -72,8 +72,14 @@ main (int argc, const char *argv[]) const byte_t btPollNr = 20; const byte_t btPeriod = 2; - const pn53x_target_type_t pttArray[5] = {PTT_GENERIC_PASSIVE_106, PTT_GENERIC_PASSIVE_212, PTT_GENERIC_PASSIVE_424, PTT_ISO14443_4B_106, PTT_JEWEL_106}; - const size_t szTargetTypes = 5; + const nfc_modulation_t nmModulations[5] = { + { .nmt = NMT_ISO14443A, .nbr = NBR_106 }, + { .nmt = NMT_ISO14443B, .nbr = NBR_106 }, + { .nmt = NMT_FELICA, .nbr = NBR_212 }, + { .nmt = NMT_FELICA, .nbr = NBR_424 }, + { .nmt = NMT_JEWEL, .nbr = NBR_106 }, + }; + const size_t szModulations = 5; nfc_target_t antTargets[2]; size_t szTargetFound; @@ -105,57 +111,15 @@ main (int argc, const char *argv[]) printf ("Connected to NFC reader: %s\n", pnd->acName); - printf ("PN532 will poll during %ld ms\n", (unsigned long) btPollNr * szTargetTypes * btPeriod * 150); - res = nfc_initiator_poll_targets (pnd, pttArray, szTargetTypes, btPollNr, btPeriod, antTargets, &szTargetFound); + printf ("PN532 will poll during %ld ms\n", (unsigned long) btPollNr * szModulations * btPeriod * 150); + res = nfc_initiator_poll_targets (pnd, nmModulations, szModulations, btPollNr, btPeriod, antTargets, &szTargetFound); if (res) { uint8_t n; printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound); for (n = 0; n < szTargetFound; n++) { - printf ("T%d: targetType=%02x ", n + 1, antTargets[n].ptt); - switch(antTargets[n].ptt) { - case PTT_JEWEL_106: - printf ("(Innovision Jewel tag), targetData:\n"); - print_nfc_jewel_info (antTargets[n].nti.nji); - break; - case PTT_MIFARE: - printf ("(Mifare card), targetData:\n"); - print_nfc_iso14443a_info (antTargets[n].nti.nai); - break; - case PTT_FELICA_212: - printf ("(FeliCa 212 kbps card), targetData:\n"); - print_nfc_felica_info (antTargets[n].nti.nfi); - break; - case PTT_FELICA_424: - printf ("(FeliCa 212 kbps card), targetData:\n"); - print_nfc_felica_info (antTargets[n].nti.nfi); - break; - case PTT_ISO14443_4A_106: - printf ("(Passive 106 kbps ISO/IEC 14443-4A card), targetData:\n"); - print_nfc_iso14443a_info (antTargets[n].nti.nai); - break; - case PTT_ISO14443_4B_TCL_106: - printf ("(Passive 106 kbps ISO/IEC 14443-4B card), targetData:\n"); - print_nfc_iso14443b_info (antTargets[n].nti.nbi); - break; - case PTT_DEP_PASSIVE_106: - printf ("(DEP passive 106 kbps)\n"); - break; - case PTT_DEP_PASSIVE_212: - printf ("(DEP passive 212 kbps)\n"); - break; - case PTT_DEP_PASSIVE_424: - printf ("(DEP passive 424 kbps)\n"); - break; - case PTT_DEP_ACTIVE_106: - printf ("(DEP active 106 kbps)\n"); - break; - case PTT_DEP_ACTIVE_212: - printf ("(DEP active 212 kbps)\n"); - break; - case PTT_DEP_ACTIVE_424: - printf ("(DEP active 424 kbps)\n"); - break; - }; + printf ("T%d: targetType=%02x ", n + 1, antTargets[n].nmt); + print_nfc_target ( antTargets[n] ); + } } else { nfc_perror (pnd, "nfc_initiator_poll_targets"); diff --git a/examples/nfc-relay.c b/examples/nfc-relay.c index fb2d9b1..64e1c8f 100644 --- a/examples/nfc-relay.c +++ b/examples/nfc-relay.c @@ -127,7 +127,7 @@ main (int argc, char *argv[]) printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n"); nfc_target_t nt = { - .ptt = PTT_MIFARE, + .nmt = NMT_ISO14443A, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-utils.c b/examples/nfc-utils.c index 6dfacd8..4ec7804 100644 --- a/examples/nfc-utils.c +++ b/examples/nfc-utils.c @@ -212,60 +212,6 @@ print_nfc_dep_info (const nfc_dep_info_t ndi) } } -void print_nfc_target_type( const pn53x_target_type_t ptt ) -{ - switch (ptt) { - case PTT_GENERIC_PASSIVE_106: - printf ("Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP)\n"); - break; - case PTT_GENERIC_PASSIVE_212: - printf ("Generic passive 212 kbps (FeliCa, DEP)\n"); - break; - case PTT_GENERIC_PASSIVE_424: - printf ("Generic passive 424 kbps (FeliCa, DEP)\n"); - break; - case PTT_ISO14443_4B_106: - printf ("Passive 106 kbps ISO/IEC14443-4B\n"); - break; - case PTT_JEWEL_106: - printf ("Innovision Jewel tag\n"); - break; - case PTT_MIFARE: - printf ("mifare card\n"); - break; - case PTT_FELICA_212: - printf ("FeliCa 212 kbps card\n"); - break; - case PTT_FELICA_424: - printf ("FeliCa 424 kbps card\n"); - break; - case PTT_ISO14443_4A_106: - printf ("Passive 106 kbps ISO/IEC14443-4A\n"); - break; - case PTT_ISO14443_4B_TCL_106: - printf ("Passive 106 kbps ISO/IEC14443-4B with TCL flag\n"); - break; - case PTT_DEP_PASSIVE_106: - printf ("DEP passive 106 kbps\n"); - break; - case PTT_DEP_PASSIVE_212: - printf ("DEP passive 212 kbps\n"); - break; - case PTT_DEP_PASSIVE_424: - printf ("DEP passive 424 kbps\n"); - break; - case PTT_DEP_ACTIVE_106: - printf ("DEP active 106 kbps\n"); - break; - case PTT_DEP_ACTIVE_212: - printf ("DEP active 212 kbps\n"); - break; - case PTT_DEP_ACTIVE_424: - printf ("DEP active 424 kbps\n"); - break; - } -} - /** * @brief Tries to parse arguments to find device descriptions. * @return Returns the list of found device descriptions. @@ -308,3 +254,30 @@ parse_device_desc (int argc, const char *argv[], size_t * szFound) return pndd; } + +void +print_nfc_target (const nfc_target_t nt) +{ + switch(nt.nmt) { + case NMT_ISO14443A: + printf ("ISO/IEC 14443A target:\n"); + print_nfc_iso14443a_info (nt.nti.nai); + break; + case NMT_JEWEL: + printf ("Innovision Jewel target:\n"); + print_nfc_jewel_info (nt.nti.nji); + break; + case NMT_FELICA: + printf ("FeliCa target:\n"); + print_nfc_felica_info (nt.nti.nfi); + break; + case NMT_ISO14443B: + printf ("ISO/IEC 14443-4B target:\n"); + print_nfc_iso14443b_info (nt.nti.nbi); + break; + case NMT_DEP: + printf ("D.E.P. target:\n"); + print_nfc_dep_info (nt.nti.ndi); + break; + } +}; diff --git a/examples/nfc-utils.h b/examples/nfc-utils.h index 83c5de4..46472f3 100644 --- a/examples/nfc-utils.h +++ b/examples/nfc-utils.h @@ -40,8 +40,6 @@ void print_nfc_felica_info (const nfc_felica_info_t nfi); void print_nfc_jewel_info (const nfc_jewel_info_t nji); void print_nfc_dep_info (const nfc_dep_info_t ndi); -void print_nfc_target_type( const pn53x_target_type_t ptt ); - nfc_device_desc_t *parse_device_desc (int argc, const char *argv[], size_t * szFound); #endif diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 85241ec..6b245b5 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -181,7 +181,11 @@ main (int argc, const char *argv[]) exit (EXIT_FAILURE); } // Read the SAM's info - if (!nfc_initiator_select_passive_target (pnd, PM_ISO14443A_106, NULL, 0, &nti)) { + const nfc_modulation_t nmSAM = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106, + }; + if (!nfc_initiator_select_passive_target (pnd, nmSAM, NULL, 0, &nti)) { nfc_perror (pnd, "nfc_initiator_select_passive_target"); ERR ("%s", "Reading of SAM info failed."); return EXIT_FAILURE; @@ -198,7 +202,7 @@ main (int argc, const char *argv[]) size_t szRx; nfc_target_t nt = { - .ptt = PTT_MIFARE, + .nmt = NMT_ISO14443A, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xaf }, .nti.nai.btSak = 0x20, diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index eed268f..0b3a0d0 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -165,33 +165,6 @@ typedef enum { NDO_FORCE_ISO14443_A = 0x42, } nfc_device_option_t; -/** - * @enum pn53x_modulation_t - * @brief NFC modulation - */ -typedef enum { -/** ISO14443-A (NXP MIFARE) http://en.wikipedia.org/wiki/MIFARE */ - PM_ISO14443A_106 = 0x00, -/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ - PM_FELICA_212 = 0x01, -/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ - PM_FELICA_424 = 0x02, -/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */ - PM_ISO14443B_106 = 0x03, -/** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */ - PM_JEWEL_106 = 0x04, -/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - PM_ISO14443B_212 = 0x06, -/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - PM_ISO14443B_424 = 0x07, -/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ - PM_ISO14443B_847 = 0x08, -/** Active DEP */ - PM_ACTIVE_DEP, -/** Passive DEP */ - PM_PASSIVE_DEP -} pn53x_modulation_t; - /** * @struct nfc_dep_info_t * @brief NFC tag information in D.E.P. (Data Exchange Protocol) see ISO/IEC 18092 @@ -291,43 +264,36 @@ typedef enum { } nfc_target_mode_t; /** - * @enum pn53x_target_type_t - * @brief NFC target type enumeration + * @enum nfc_baud_rate_t + * @brief NFC baud rate enumeration */ typedef enum { - /** Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP) */ - PTT_GENERIC_PASSIVE_106 = 0x00, - /** Generic passive 212 kbps (FeliCa, DEP) */ - PTT_GENERIC_PASSIVE_212 = 0x01, - /** Generic passive 424 kbps (FeliCa, DEP) */ - PTT_GENERIC_PASSIVE_424 = 0x02, - /** Passive 106 kbps ISO/IEC14443-4B */ - PTT_ISO14443_4B_106 = 0x03, - /** Innovision Jewel tag */ - PTT_JEWEL_106 = 0x04, - /** Mifare card */ - PTT_MIFARE = 0x10, - /** FeliCa 212 kbps card */ - PTT_FELICA_212 = 0x11, - /** FeliCa 424 kbps card */ - PTT_FELICA_424 = 0x12, - /** Passive 106 kbps ISO/IEC 14443-4A */ - PTT_ISO14443_4A_106 = 0x20, - /** Passive 106 kbps ISO/IEC 14443-4B with TCL flag */ - PTT_ISO14443_4B_TCL_106 = 0x23, - /** DEP passive 106 kbps */ - PTT_DEP_PASSIVE_106 = 0x40, - /** DEP passive 212 kbps */ - PTT_DEP_PASSIVE_212 = 0x41, - /** DEP passive 424 kbps */ - PTT_DEP_PASSIVE_424 = 0x42, - /** DEP active 106 kbps */ - PTT_DEP_ACTIVE_106 = 0x80, - /** DEP active 212 kbps */ - PTT_DEP_ACTIVE_212 = 0x81, - /** DEP active 424 kbps */ - PTT_DEP_ACTIVE_424 = 0x82, -} pn53x_target_type_t; + NBR_106, + NBR_212, + NBR_424, +} nfc_baud_rate_t; + +/** + * @enum nfc_modulation_type_t + * @brief NFC modulation type enumeration + */ +typedef enum { + NMT_UNKNOWN, + NMT_ISO14443A, + NMT_ISO14443B, + NMT_FELICA, + NMT_JEWEL, + NMT_DEP, +} nfc_modulation_type_t; + +/** + * @struct nfc_modulation_t + * @brief NFC modulation structure + */ +typedef struct { + nfc_modulation_type_t nmt; + nfc_baud_rate_t nbr; +} nfc_modulation_t; /** * @struct nfc_target_t @@ -335,7 +301,7 @@ typedef enum { */ typedef struct { nfc_target_info_t nti; - pn53x_target_type_t ptt; + nfc_modulation_type_t nmt; } nfc_target_t; // Reset struct alignment to default diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index 6932465..dff698b 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -68,16 +68,16 @@ extern "C" { /* NFC initiator: act as "reader" */ NFC_EXPORT bool nfc_initiator_init (nfc_device_t * pnd); - NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, - const byte_t * pbtInitData, const size_t szInitDataLen, + NFC_EXPORT bool nfc_initiator_select_passive_target (nfc_device_t * pnd, const nfc_modulation_t nm, + const byte_t * pbtInitData, const size_t szInitData, nfc_target_info_t * pti); - NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, + NFC_EXPORT bool nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nm, nfc_target_info_t anti[], const size_t szTargets, size_t * pszTargetFound); - NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes, + NFC_EXPORT bool nfc_initiator_poll_targets (nfc_device_t * pnd, const nfc_modulation_t * pnmTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound); - NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, + NFC_EXPORT bool nfc_initiator_select_dep_target (nfc_device_t * pnd, const bool bActiveDep, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pti); NFC_EXPORT bool nfc_initiator_deselect_target (nfc_device_t * pnd); diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 32bac36..3ccfd94 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -81,6 +81,11 @@ static const byte_t pn53x_ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 }; static const byte_t pn53x_nack_frame[] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 }; static const byte_t pn53x_error_frame[] = { 0x00, 0x00, 0xff, 0x01, 0xff, 0x7f, 0x81, 0x00 }; +/* prototypes */ +const nfc_modulation_type_t pn53x_ptt_to_nmt( const pn53x_target_type_t ptt ); +const pn53x_modulation_t pn53x_nm_to_pm(const nfc_modulation_t nm); +const pn53x_target_type_t pn53x_nm_to_ptt(const nfc_modulation_t nm); + bool pn53x_init(nfc_device_t * pnd) { @@ -369,15 +374,13 @@ pn53x_unwrap_frame (const byte_t * pbtFrame, const size_t szFrameBits, byte_t * } bool -pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, pn53x_target_type_t ptt, +pn53x_decode_target_data (const byte_t * pbtRawData, size_t szRawData, nfc_chip_t nc, nfc_modulation_type_t nmt, nfc_target_info_t * pnti) { uint8_t szAttribRes; - switch (ptt) { - case PTT_MIFARE: - case PTT_GENERIC_PASSIVE_106: - case PTT_ISO14443_4A_106: + switch (nmt) { + case NMT_ISO14443A: // We skip the first byte: its the target number (Tg) pbtRawData++; @@ -396,7 +399,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ pbtRawData += pnti->nai.szUidLen; // Did we received an optional ATS (Smardcard ATR) - if (szDataLen > (pnti->nai.szUidLen + 5)) { + if (szRawData > (pnti->nai.szUidLen + 5)) { pnti->nai.szAtsLen = ((*(pbtRawData++)) - 1); // In pbtRawData, ATS Length byte is counted in ATS Frame. memcpy (pnti->nai.abtAts, pbtRawData, pnti->nai.szAtsLen); } else { @@ -415,8 +418,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ } break; - case PTT_ISO14443_4B_106: - case PTT_ISO14443_4B_TCL_106: + case NMT_ISO14443B: // We skip the first byte: its the target number (Tg) pbtRawData++; @@ -442,8 +444,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ } break; - case PTT_FELICA_212: - case PTT_FELICA_424: + case NMT_FELICA: // We skip the first byte: its the target number (Tg) pbtRawData++; @@ -461,7 +462,7 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ memcpy (pnti->nfi.abtSysCode, pbtRawData, 2); } break; - case PTT_JEWEL_106: + case NMT_JEWEL: // We skip the first byte: its the target number (Tg) pbtRawData++; @@ -477,6 +478,49 @@ pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_ return true; } +bool +pn53x_initiator_select_passive_target (nfc_device_t * pnd, + const nfc_modulation_t nm, + const byte_t * pbtInitData, const size_t szInitData, + nfc_target_info_t * pnti) +{ + size_t szTargetsData; + byte_t abtTargetsData[MAX_FRAME_LEN]; + + pn53x_modulation_t pm = pn53x_nm_to_pm(nm); + if (!pn53x_InListPassiveTarget (pnd, pm, 1, pbtInitData, szInitData, abtTargetsData, &szTargetsData)) + return false; + + // Make sure one tag has been found, the PN53X returns 0x00 if none was available + if (abtTargetsData[0] == 0) + return false; + + // Is a tag info struct available + if (pnti) { + // Fill the tag info struct with the values corresponding to this init modulation + if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, nm.nmt, pnti)) { + return false; + } + } + return true; +} + +bool +pn53x_initiator_poll_targets (nfc_device_t * pnd, + const nfc_modulation_t * pnmModulations, const size_t szModulations, + const byte_t btPollNr, const byte_t btPeriod, + nfc_target_t * pntTargets, size_t * pszTargetFound) +{ + const size_t szTargetTypes = szModulations; + pn53x_target_type_t apttTargetTypes[32]; + for (size_t n=0; nnc, pntTargets[0].ptt, &(pntTargets[0].nti)); + pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[0].nti)); pbt += ln; if (abtRx[0] > 1) { /* 2nd target */ // Target type - pntTargets[1].ptt = *(pbt++); + ptt = *(pbt++); + pntTargets[1].nmt = pn53x_ptt_to_nmt(*(pbt++)); // AutoPollTargetData length ln = *(pbt++); - pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[1].ptt, &(pntTargets[1].nti)); + pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[1].nti)); } } } @@ -821,14 +867,14 @@ pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool b } bool -pn53x_initiator_select_dep_target(nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, +pn53x_initiator_select_dep_target(nfc_device_t * pnd, const bool bActiveDep, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) { if (pndiInitiator) { - return pn53x_InJumpForDEP (pnd, pmInitModulation, NULL, 0, pndiInitiator->abtNFCID3, pndiInitiator->abtGB, pndiInitiator->szGB, pnti); + return pn53x_InJumpForDEP (pnd, bActiveDep, NULL, 0, pndiInitiator->abtNFCID3, pndiInitiator->abtGB, pndiInitiator->szGB, pnti); } else { - return pn53x_InJumpForDEP (pnd, pmInitModulation, NULL, 0, NULL, NULL, 0, pnti); + return pn53x_InJumpForDEP (pnd, bActiveDep, NULL, 0, NULL, NULL, 0, pnti); } } @@ -843,7 +889,7 @@ pn53x_initiator_select_dep_target(nfc_device_t * pnd, const pn53x_modulation_t p * @param[out] pnti nfc_target_info_t which will be filled by this function */ bool -pn53x_InJumpForDEP (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, +pn53x_InJumpForDEP (nfc_device_t * pnd, const bool bActiveDep, const byte_t * pbtPassiveInitiatorData, const size_t szPassiveInitiatorData, const byte_t * pbtNFCID3i, const byte_t * pbtGB, const size_t szGB, @@ -856,14 +902,13 @@ pn53x_InJumpForDEP (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulatio memcpy (abtCmd, pncmd_initiator_jump_for_dep, sizeof (pncmd_initiator_jump_for_dep)); - if (pmInitModulation == PM_ACTIVE_DEP) { - abtCmd[2] = 0x01; /* active DEP */ - } + abtCmd[2] = (bActiveDep) ? 0x01 : 0x00; + // FIXME Baud rate in D.E.P. mode is hard-wired as 106kbps abtCmd[3] = 0x00; /* baud rate = 106kbps */ offset = 5; - if (pbtPassiveInitiatorData && (pmInitModulation != PM_ACTIVE_DEP)) { /* can't have passive initiator data when using active mode */ + if (pbtPassiveInitiatorData && bActiveDep) { /* can't have passive initiator data when using active mode */ abtCmd[4] |= 0x01; memcpy (abtCmd + offset, pbtPassiveInitiatorData, szPassiveInitiatorData); offset += szPassiveInitiatorData; @@ -1070,10 +1115,8 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta const byte_t * pbtGB = NULL; size_t szGB = 0; - switch(nt.ptt) { - case PTT_MIFARE: - case PTT_GENERIC_PASSIVE_106: - case PTT_ISO14443_4A_106: { + switch(nt.nmt) { + case NMT_ISO14443A: { // Set ATQA (SENS_RES) abtMifareParams[0] = nt.nti.nai.abtAtqa[1]; abtMifareParams[1] = nt.nti.nai.abtAtqa[0]; @@ -1089,8 +1132,7 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta } break; - case PTT_FELICA_212: - case PTT_FELICA_424: + case NMT_FELICA: // Set NFCID2t memcpy(abtFeliCaParams, nt.nti.nfi.abtId, 8); // Set PAD @@ -1100,9 +1142,7 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta pbtFeliCaParams = abtFeliCaParams; break; - case PTT_DEP_PASSIVE_106: - case PTT_DEP_PASSIVE_212: - case PTT_DEP_PASSIVE_424: + case NMT_DEP: pbtNFCID3t = nt.nti.ndi.abtNFCID3; szGB = nt.nti.ndi.szGB; if (szGB) pbtGB = nt.nti.ndi.abtGB; @@ -1314,3 +1354,120 @@ pn53x_target_send_bytes (nfc_device_t * pnd, const byte_t * pbtTx, const size_t // Everyting seems ok, return true return true; } + +// FIXME How to handle conner case ? +const pn53x_modulation_t +pn53x_nm_to_pm(const nfc_modulation_t nm) +{ + switch(nm.nmt) { + case NMT_ISO14443A: + return PM_ISO14443A_106; + break; + + case NMT_ISO14443B: + switch(nm.nbr) { + case NBR_106: + return PM_ISO14443B_106; + break; + case NBR_212: + return PM_ISO14443B_212; + break; + case NBR_424: + return PM_ISO14443B_424; + break; + } + break; + + case NMT_JEWEL: + return PM_JEWEL_106; + break; + + case NMT_FELICA: + switch(nm.nbr) { + case NBR_212: + return PM_FELICA_212; + break; + case NBR_424: + return PM_FELICA_424; + break; + } + break; + } +} + +// FIXME How to handle conner case ? +const nfc_modulation_type_t +pn53x_ptt_to_nmt( const pn53x_target_type_t ptt ) +{ + switch (ptt) { + case PTT_GENERIC_PASSIVE_106: + case PTT_GENERIC_PASSIVE_212: + case PTT_GENERIC_PASSIVE_424: + // XXX This should not happend, how handle it cleanly ? + return NMT_UNKNOWN; + break; + + case PTT_MIFARE: + case PTT_ISO14443_4A_106: + return NMT_ISO14443B; + break; + + case PTT_ISO14443_4B_106: + case PTT_ISO14443_4B_TCL_106: + return NMT_ISO14443B; + break; + + case PTT_JEWEL_106: + return NMT_JEWEL; + break; + + case PTT_FELICA_212: + case PTT_FELICA_424: + return NMT_FELICA; + break; + + case PTT_DEP_PASSIVE_106: + case PTT_DEP_PASSIVE_212: + case PTT_DEP_PASSIVE_424: + case PTT_DEP_ACTIVE_106: + case PTT_DEP_ACTIVE_212: + case PTT_DEP_ACTIVE_424: + return NMT_DEP; + break; + } +} + +// FIXME How to handle conner case ? +const pn53x_target_type_t +pn53x_nm_to_ptt(const nfc_modulation_t nm) +{ + switch(nm.nmt) { + case NMT_ISO14443A: + return PTT_MIFARE; + break; + + case NMT_ISO14443B: + switch(nm.nbr) { + case NBR_106: + return PTT_ISO14443_4B_106; + break; + } + break; + + case NMT_JEWEL: + return PTT_JEWEL_106; + break; + + case NMT_FELICA: + switch(nm.nbr) { + case NBR_212: + return PTT_FELICA_212; + break; + case NBR_424: + return PTT_FELICA_424; + break; + } + break; + } +} + diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index e2ad140..f3bf011 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -90,6 +90,73 @@ # define DEISERRFRAME 0x0300/* Error frame */ # define DENOTSUP 0x0400/* Not supported */ +/* PN53x specific types */ +/** + * @enum pn53x_modulation_t + * @brief NFC modulation + */ +typedef enum { +/** ISO14443-A (NXP MIFARE) http://en.wikipedia.org/wiki/MIFARE */ + PM_ISO14443A_106 = 0x00, +/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ + PM_FELICA_212 = 0x01, +/** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ + PM_FELICA_424 = 0x02, +/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */ + PM_ISO14443B_106 = 0x03, +/** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */ + PM_JEWEL_106 = 0x04, +/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ + PM_ISO14443B_212 = 0x06, +/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ + PM_ISO14443B_424 = 0x07, +/** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ + PM_ISO14443B_847 = 0x08, +/** Active DEP */ + PM_ACTIVE_DEP, +/** Passive DEP */ + PM_PASSIVE_DEP +} pn53x_modulation_t; + +/** + * @enum pn53x_target_type_t + * @brief NFC target type enumeration + */ +typedef enum { + /** Generic passive 106 kbps (ISO/IEC14443-4A, mifare, DEP) */ + PTT_GENERIC_PASSIVE_106 = 0x00, + /** Generic passive 212 kbps (FeliCa, DEP) */ + PTT_GENERIC_PASSIVE_212 = 0x01, + /** Generic passive 424 kbps (FeliCa, DEP) */ + PTT_GENERIC_PASSIVE_424 = 0x02, + /** Passive 106 kbps ISO/IEC14443-4B */ + PTT_ISO14443_4B_106 = 0x03, + /** Innovision Jewel tag */ + PTT_JEWEL_106 = 0x04, + /** Mifare card */ + PTT_MIFARE = 0x10, + /** FeliCa 212 kbps card */ + PTT_FELICA_212 = 0x11, + /** FeliCa 424 kbps card */ + PTT_FELICA_424 = 0x12, + /** Passive 106 kbps ISO/IEC 14443-4A */ + PTT_ISO14443_4A_106 = 0x20, + /** Passive 106 kbps ISO/IEC 14443-4B with TCL flag */ + PTT_ISO14443_4B_TCL_106 = 0x23, + /** DEP passive 106 kbps */ + PTT_DEP_PASSIVE_106 = 0x40, + /** DEP passive 212 kbps */ + PTT_DEP_PASSIVE_212 = 0x41, + /** DEP passive 424 kbps */ + PTT_DEP_PASSIVE_424 = 0x42, + /** DEP active 106 kbps */ + PTT_DEP_ACTIVE_106 = 0x80, + /** DEP active 212 kbps */ + PTT_DEP_ACTIVE_212 = 0x81, + /** DEP active 424 kbps */ + PTT_DEP_ACTIVE_424 = 0x82, +} pn53x_target_type_t; + bool pn53x_init(nfc_device_t * pnd); bool pn53x_transceive_check_ack_frame_callback (nfc_device_t * pnd, const byte_t * pbtRxFrame, const size_t szRxFrameLen); @@ -105,14 +172,22 @@ bool pn53x_wrap_frame (const byte_t * pbtTx, const size_t szTxBits, const byt size_t * pszFrameBits); bool pn53x_unwrap_frame (const byte_t * pbtFrame, const size_t szFrameBits, byte_t * pbtRx, size_t * pszRxBits, byte_t * pbtRxPar); -bool pn53x_decode_target_data (const byte_t * pbtRawData, size_t szDataLen, nfc_chip_t nc, pn53x_target_type_t ptt, +bool pn53x_decode_target_data (const byte_t * pbtRawData, size_t szRawData, nfc_chip_t nc, nfc_modulation_type_t nmt, nfc_target_info_t * pnti); bool pn53x_get_firmware_version (nfc_device_t * pnd); bool pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool bEnable); // NFC device as Initiator functions -bool pn53x_initiator_select_dep_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, +bool pn53x_initiator_select_passive_target (nfc_device_t * pnd, + const nfc_modulation_t nm, + const byte_t * pbtInitData, const size_t szInitData, + nfc_target_info_t * pnti); +bool pn53x_initiator_poll_targets (nfc_device_t * pnd, + const nfc_modulation_t * pnmModulations, const size_t szModulations, + const byte_t btPollNr, const byte_t btPeriod, + nfc_target_t * pntTargets, size_t * pszTargetFound); +bool pn53x_initiator_select_dep_target (nfc_device_t * pnd, const bool bActiveDep, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti); bool pn53x_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits, @@ -143,7 +218,7 @@ bool pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target); bool pn53x_InAutoPoll (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound); -bool pn53x_InJumpForDEP (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, +bool pn53x_InJumpForDEP (nfc_device_t * pnd, const bool bActiveDep, const byte_t * pbtPassiveInitiatorData, const size_t szPassiveInitiatorData, const byte_t * pbtNFCID3i, const byte_t * pbtGB, const size_t szGB, diff --git a/libnfc/nfc.c b/libnfc/nfc.c index dc38322..ea11d44 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -275,14 +275,12 @@ nfc_initiator_init (nfc_device_t * pnd) */ bool nfc_initiator_select_passive_target (nfc_device_t * pnd, - const pn53x_modulation_t pmInitModulation, - const byte_t * pbtInitData, const size_t szInitDataLen, nfc_target_info_t * pnti) + const nfc_modulation_t nm, + const byte_t * pbtInitData, const size_t szInitData, + nfc_target_info_t * pnti) { byte_t abtInit[MAX_FRAME_LEN]; - size_t szInitLen; - - size_t szTargetsData; - byte_t abtTargetsData[MAX_FRAME_LEN]; + size_t szInit; pnd->iLastError = 0; @@ -290,13 +288,13 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, if (!pnd->bActive) return false; // TODO Put this in a function: this part is defined by ISO14443-3 (UID and Cascade levels) - switch (pmInitModulation) { - case PM_ISO14443A_106: - switch (szInitDataLen) { + switch (nm.nmt) { + case NMT_ISO14443A: + switch (szInitData) { case 7: abtInit[0] = 0x88; memcpy (abtInit + 1, pbtInitData, 7); - szInitLen = 8; + szInit = 8; break; case 10: @@ -304,72 +302,26 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, memcpy (abtInit + 1, pbtInitData, 3); abtInit[4] = 0x88; memcpy (abtInit + 5, pbtInitData + 3, 7); - szInitLen = 12; + szInit = 12; break; case 4: default: - memcpy (abtInit, pbtInitData, szInitDataLen); - szInitLen = szInitDataLen; + memcpy (abtInit, pbtInitData, szInitData); + szInit = szInitData; break; } break; default: - memcpy (abtInit, pbtInitData, szInitDataLen); - szInitLen = szInitDataLen; + memcpy (abtInit, pbtInitData, szInitData); + szInit = szInitData; break; } - if (!pn53x_InListPassiveTarget (pnd, pmInitModulation, 1, abtInit, szInitLen, abtTargetsData, &szTargetsData)) - return false; - - // Make sure one tag has been found, the PN53X returns 0x00 if none was available - if (abtTargetsData[0] == 0) - return false; - - // Is a tag info struct available - if (pnti) { - // Fill the tag info struct with the values corresponding to this init modulation - switch (pmInitModulation) { - case PM_ISO14443A_106: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_GENERIC_PASSIVE_106, pnti)) { - return false; - } - break; - - case PM_FELICA_212: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_212, pnti)) { - return false; - } - break; - case PM_FELICA_424: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_FELICA_424, pnti)) { - return false; - } - break; - - case PM_ISO14443B_106: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_ISO14443_4B_106, pnti)) { - return false; - } - break; - - case PM_JEWEL_106: - if (!pn53x_decode_target_data (abtTargetsData + 1, szTargetsData - 1, pnd->nc, PTT_JEWEL_106, pnti)) { - return false; - } - break; - - default: - // Should not be possible, so whatever... - break; - } - } - return true; + return pn53x_initiator_select_passive_target (pnd, nm, abtInit, szInit, pnti); } - /** * @brief List passive or emulated tags * @return Returns \c true if action was successfully performed; otherwise returns \c false. @@ -384,7 +336,7 @@ nfc_initiator_select_passive_target (nfc_device_t * pnd, * @note For every initial modulation type there is a different collection of information returned (in \a nfc_target_info_t pointer pti) They all fit in the data-type which is called nfc_target_info_t. This is a union which contains the tag information that belongs to the according initial modulation type. */ bool -nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, +nfc_initiator_list_passive_targets (nfc_device_t * pnd, const nfc_modulation_t nm, nfc_target_info_t anti[], const size_t szTargets, size_t * pszTargetFound) { nfc_target_info_t nti; @@ -397,17 +349,25 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t // Let the reader only try once to find a target nfc_configure (pnd, NDO_INFINITE_SELECT, false); - if (pmInitModulation == PM_ISO14443B_106) { - // Application Family Identifier (AFI) must equals 0x00 in order to wakeup all ISO14443-B PICCs (see ISO/IEC 14443-3) - pbtInitData = (byte_t *) "\x00"; - szInitDataLen = 1; - } else if (pmInitModulation == PM_FELICA_212 || pmInitModulation == PM_FELICA_424) { - // polling payload must be present (see ISO/IEC 18092 11.2.2.5) - pbtInitData = (byte_t *) "\x00\xff\xff\x01\x00"; - szInitDataLen = 5; + switch (nm.nmt) { + case NMT_ISO14443B: { + // Application Family Identifier (AFI) must equals 0x00 in order to wakeup all ISO14443-B PICCs (see ISO/IEC 14443-3) + pbtInitData = (byte_t *) "\x00"; + szInitDataLen = 1; + } + break; + case NMT_FELICA: { + // polling payload must be present (see ISO/IEC 18092 11.2.2.5) + pbtInitData = (byte_t *) "\x00\xff\xff\x01\x00"; + szInitDataLen = 5; + } + break; + default: + // nothing to do + break; } - while (nfc_initiator_select_passive_target (pnd, pmInitModulation, pbtInitData, szInitDataLen, &nti)) { + while (nfc_initiator_select_passive_target (pnd, nm, pbtInitData, szInitDataLen, &nti)) { nfc_initiator_deselect_target (pnd); if (szTargets > szTargetFound) { @@ -417,7 +377,7 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t } szTargetFound++; // deselect has no effect on FeliCa and Jewel cards so we'll stop after one... - if (pmInitModulation == PM_FELICA_212 || pmInitModulation == PM_FELICA_424 || pmInitModulation == PM_JEWEL_106) { + if ((nm.nmt == NMT_FELICA) || (nm.nmt == NMT_JEWEL)) { break; } } @@ -441,15 +401,16 @@ nfc_initiator_list_passive_targets (nfc_device_t * pnd, const pn53x_modulation_t */ bool nfc_initiator_poll_targets (nfc_device_t * pnd, - const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, + const nfc_modulation_t * pnmModulations, const size_t szModulations, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound) { pnd->iLastError = 0; - return pn53x_InAutoPoll (pnd, ppttTargetTypes, szTargetTypes, btPollNr, btPeriod, pntTargets, pszTargetFound); + return pn53x_initiator_poll_targets (pnd, pnmModulations, szModulations, btPollNr, btPeriod, pntTargets, pszTargetFound); } + /** * @brief Select a target and request active or passive mode for DEP (Data Exchange Protocol) * @return Returns \c true if action was successfully performed; otherwise returns \c false. @@ -466,11 +427,11 @@ nfc_initiator_poll_targets (nfc_device_t * pnd, * @note \a nfc_dep_info_t will be returned when the target was acquired successfully. */ bool -nfc_initiator_select_dep_target (nfc_device_t * pnd, const pn53x_modulation_t pmInitModulation, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) +nfc_initiator_select_dep_target (nfc_device_t * pnd, const bool bActiveDep, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) { pnd->iLastError = 0; - return pn53x_initiator_select_dep_target (pnd, pmInitModulation, pndiInitiator, pnti); + return pn53x_initiator_select_dep_target (pnd, bActiveDep, pndiInitiator, pnti); } /** diff --git a/test/test_access_storm.c b/test/test_access_storm.c index ddc95f8..b093aa9 100644 --- a/test/test_access_storm.c +++ b/test/test_access_storm.c @@ -56,7 +56,11 @@ test_access_storm (void) res = nfc_configure(device,NDO_ACTIVATE_FIELD,true); cut_assert_true (res, cut_message ("nfc_configure")); - res = nfc_initiator_list_passive_targets(device, PM_ISO14443A_106, anti, MAX_TARGET_COUNT, &target_count); + const nfc_modulation_t nm = { + .nmt = NMT_ISO14443A, + .nbr = NBR_106, + }; + res = nfc_initiator_list_passive_targets(device, nm, anti, MAX_TARGET_COUNT, &target_count); cut_assert_true (res, cut_message ("nfc_initiator_list_passive_targets")); nfc_disconnect (device); From 584a18ec1181dca688a32bb36edba1f8ca9842ef Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 18:41:48 +0000 Subject: [PATCH 04/19] Remove unused pn53x_modulations --- libnfc/chips/pn53x.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index f3bf011..9df0c75 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -112,10 +112,6 @@ typedef enum { PM_ISO14443B_424 = 0x07, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ PM_ISO14443B_847 = 0x08, -/** Active DEP */ - PM_ACTIVE_DEP, -/** Passive DEP */ - PM_PASSIVE_DEP } pn53x_modulation_t; /** From 979430ecd1989911e854c6441a87cefbd292a0d2 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 19:17:51 +0000 Subject: [PATCH 05/19] nfc_target_t have now nfc_modulation_t instead of nfc_modulatation_type_t --- examples/nfc-dep-target.c | 3 ++- examples/nfc-emulate-forum-tag4.c | 3 ++- examples/nfc-emulate-tag.c | 9 ++++++--- examples/nfc-emulate-uid.c | 3 ++- examples/nfc-poll.c | 2 +- examples/nfc-relay.c | 3 ++- examples/nfc-utils.c | 31 +++++++++++++++++++++++++------ examples/pn53x-sam.c | 3 ++- include/nfc/nfc-types.h | 3 ++- libnfc/chips/pn53x.c | 6 +++--- 10 files changed, 47 insertions(+), 19 deletions(-) diff --git a/examples/nfc-dep-target.c b/examples/nfc-dep-target.c index c140c81..1af716e 100644 --- a/examples/nfc-dep-target.c +++ b/examples/nfc-dep-target.c @@ -66,7 +66,8 @@ main (int argc, const char *argv[]) } const nfc_target_t nt = { - .nmt = NMT_DEP, + .nm.nmt = NMT_DEP, + .nm.nbr = NBR_UNDEFINED, .nti.ndi.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 }, .nti.ndi.szGB = 4, .nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 }, diff --git a/examples/nfc-emulate-forum-tag4.c b/examples/nfc-emulate-forum-tag4.c index e05c6b9..11b3c50 100644 --- a/examples/nfc-emulate-forum-tag4.c +++ b/examples/nfc-emulate-forum-tag4.c @@ -112,7 +112,8 @@ main (int argc, char *argv[]) printf ("Emulating NDEF tag now, please touch it with a second NFC device\n"); nfc_target_t nt = { - .nmt = NMT_ISO14443A, + .nm.nmt = NMT_ISO14443A, + .nm.nbr = NBR_UNDEFINED, .nti.nai.abtAtqa = { 0x00, 0x04 }, .nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index 8523947..7ea2cff 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -173,7 +173,8 @@ main (int argc, char *argv[]) // Example of a Mifare Classic Mini // Note that crypto1 is not implemented in this example nfc_target_t nt = { - .nmt = NMT_ISO14443A, + .nm.nmt = NMT_ISO14443A, + .nm.nbr = NBR_UNDEFINED, .nti.nai.abtAtqa = { 0x00, 0x04 }, .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, .nti.nai.btSak = 0x09, @@ -183,7 +184,8 @@ main (int argc, char *argv[]) /* // Example of a FeliCa nfc_target_t nt = { - .nmt = NMT_FELICA, + .nm.nmt = NMT_FELICA, + .nm.nbr = NBR_UNDEFINED, .nti.nfi.abtId = { 0x01, 0xFE, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF }, .nti.nfi.abtPad = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF }, .nti.nfi.abtSysCode = { 0xFF, 0xFF }, @@ -192,7 +194,8 @@ main (int argc, char *argv[]) /* // Example of a ISO14443-4 (DESfire) nfc_target_t nt = { - .nmt = NMT_ISO14443A, + .nm.nmt = NMT_ISO14443A, + .nm.nbr = NBR_UNDEFINED, .nti.nai.abtAtqa = { 0x03, 0x44 }, .nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-emulate-uid.c b/examples/nfc-emulate-uid.c index 407fad2..be56d0c 100644 --- a/examples/nfc-emulate-uid.c +++ b/examples/nfc-emulate-uid.c @@ -132,7 +132,8 @@ main (int argc, char *argv[]) // Note: We have to build a "fake" nfc_target_t in order to do exactly the same that was done before the new nfc_target_init() was introduced. nfc_target_t nt = { - .nmt = NMT_ISO14443A, + .nm.nmt = NMT_ISO14443A, + .nm.nbr = NBR_UNDEFINED, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xaf }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index 5a22414..81e4443 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -117,7 +117,7 @@ main (int argc, const char *argv[]) uint8_t n; printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound); for (n = 0; n < szTargetFound; n++) { - printf ("T%d: targetType=%02x ", n + 1, antTargets[n].nmt); + printf ("T%d: ", n + 1); print_nfc_target ( antTargets[n] ); } diff --git a/examples/nfc-relay.c b/examples/nfc-relay.c index 64e1c8f..4550633 100644 --- a/examples/nfc-relay.c +++ b/examples/nfc-relay.c @@ -127,7 +127,8 @@ main (int argc, char *argv[]) printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n"); nfc_target_t nt = { - .nmt = NMT_ISO14443A, + .nm.nmt = NMT_ISO14443A, + .nm.nbr = NBR_UNDEFINED, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef }, .nti.nai.btSak = 0x20, diff --git a/examples/nfc-utils.c b/examples/nfc-utils.c index 4ec7804..dfcea21 100644 --- a/examples/nfc-utils.c +++ b/examples/nfc-utils.c @@ -255,28 +255,47 @@ parse_device_desc (int argc, const char *argv[], size_t * szFound) return pndd; } +const char * +str_nfc_baud_rate (const nfc_baud_rate_t nbr) +{ + switch(nbr) { + case NBR_UNDEFINED: + return "undefined baud rate"; + break; + case NBR_106: + return "106 kbps"; + break; + case NBR_212: + return "212 kbps"; + break; + case NBR_424: + return "424 kbps"; + break; + } +} + void print_nfc_target (const nfc_target_t nt) { - switch(nt.nmt) { + switch(nt.nm.nmt) { case NMT_ISO14443A: - printf ("ISO/IEC 14443A target:\n"); + printf ("ISO/IEC 14443A (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); print_nfc_iso14443a_info (nt.nti.nai); break; case NMT_JEWEL: - printf ("Innovision Jewel target:\n"); + printf ("Innovision Jewel (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); print_nfc_jewel_info (nt.nti.nji); break; case NMT_FELICA: - printf ("FeliCa target:\n"); + printf ("FeliCa (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); print_nfc_felica_info (nt.nti.nfi); break; case NMT_ISO14443B: - printf ("ISO/IEC 14443-4B target:\n"); + printf ("ISO/IEC 14443-4B (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); print_nfc_iso14443b_info (nt.nti.nbi); break; case NMT_DEP: - printf ("D.E.P. target:\n"); + printf ("D.E.P. (%s) target:\n", str_nfc_baud_rate(nt.nm.nbr)); print_nfc_dep_info (nt.nti.ndi); break; } diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 6b245b5..1f3dee4 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -202,7 +202,8 @@ main (int argc, const char *argv[]) size_t szRx; nfc_target_t nt = { - .nmt = NMT_ISO14443A, + .nm.nmt = NMT_ISO14443A, + .nm.nbr = NBR_UNDEFINED, .nti.nai.abtAtqa = { 0x04, 0x00 }, .nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xaf }, .nti.nai.btSak = 0x20, diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index 0b3a0d0..51d7628 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -268,6 +268,7 @@ typedef enum { * @brief NFC baud rate enumeration */ typedef enum { + NBR_UNDEFINED = 0, NBR_106, NBR_212, NBR_424, @@ -301,7 +302,7 @@ typedef struct { */ typedef struct { nfc_target_info_t nti; - nfc_modulation_type_t nmt; + nfc_modulation_t nm; } nfc_target_t; // Reset struct alignment to default diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 3ccfd94..6a43ce5 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -652,7 +652,7 @@ pn53x_InAutoPoll (nfc_device_t * pnd, /* 1st target */ // Target type pn53x_target_type_t ptt = *(pbt++); - pntTargets[0].nmt = pn53x_ptt_to_nmt(ptt); + pntTargets[0].nm.nmt = pn53x_ptt_to_nmt(ptt); // AutoPollTargetData length ln = *(pbt++); pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[0].nti)); @@ -662,7 +662,7 @@ pn53x_InAutoPoll (nfc_device_t * pnd, /* 2nd target */ // Target type ptt = *(pbt++); - pntTargets[1].nmt = pn53x_ptt_to_nmt(*(pbt++)); + pntTargets[1].nm.nmt = pn53x_ptt_to_nmt(*(pbt++)); // AutoPollTargetData length ln = *(pbt++); pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[1].nti)); @@ -1115,7 +1115,7 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta const byte_t * pbtGB = NULL; size_t szGB = 0; - switch(nt.nmt) { + switch(nt.nm.nmt) { case NMT_ISO14443A: { // Set ATQA (SENS_RES) abtMifareParams[0] = nt.nti.nai.abtAtqa[1]; From d67527932cfb82890df93ac001a006c144f7e5a8 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 19:24:24 +0000 Subject: [PATCH 06/19] Add some FIXME/TODO about PN532 that does not supported B type (ISO14443) --- libnfc/chips/pn53x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 6a43ce5..444534a 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -555,6 +555,7 @@ pn53x_InListPassiveTarget (nfc_device_t * pnd, // all gone fine. break; case PM_ISO14443B_106: + // FIXME Some PN532 doesn't support type B ! case PM_JEWEL_106: if(pnd->nc == NC_PN531) { // These modulations are not supported by pn531 @@ -746,7 +747,7 @@ pn53x_get_firmware_version (nfc_device_t * pnd) byte_t abtFw[4]; size_t szFwLen = sizeof (abtFw); char *pcName; - + // TODO Read more info here: there are modulation capabilities info to know if ISO14443B is supported if (!pn53x_transceive (pnd, pncmd_get_firmware_version, 2, abtFw, &szFwLen)) { // Failed to get firmware revision??, whatever...let's disconnect and clean up and return err DBG ("Failed to get firmware revision for: %s", pnd->acName); From ec601f6a003c2ed09bb6bd097c43aae3bb03a0e1 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 19:31:02 +0000 Subject: [PATCH 07/19] Fix two bugs introduced in r729, typo. --- libnfc/chips/pn53x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 444534a..a4d0e0d 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -663,7 +663,7 @@ pn53x_InAutoPoll (nfc_device_t * pnd, /* 2nd target */ // Target type ptt = *(pbt++); - pntTargets[1].nm.nmt = pn53x_ptt_to_nmt(*(pbt++)); + pntTargets[1].nm.nmt = pn53x_ptt_to_nmt(ptt); // AutoPollTargetData length ln = *(pbt++); pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[1].nti)); @@ -909,7 +909,7 @@ pn53x_InJumpForDEP (nfc_device_t * pnd, const bool bActiveDep, abtCmd[3] = 0x00; /* baud rate = 106kbps */ offset = 5; - if (pbtPassiveInitiatorData && bActiveDep) { /* can't have passive initiator data when using active mode */ + if (pbtPassiveInitiatorData && !bActiveDep) { /* can't have passive initiator data when using active mode */ abtCmd[4] |= 0x01; memcpy (abtCmd + offset, pbtPassiveInitiatorData, szPassiveInitiatorData); offset += szPassiveInitiatorData; @@ -1356,7 +1356,7 @@ pn53x_target_send_bytes (nfc_device_t * pnd, const byte_t * pbtTx, const size_t return true; } -// FIXME How to handle conner case ? +// FIXME How to handle corner case ? const pn53x_modulation_t pn53x_nm_to_pm(const nfc_modulation_t nm) { @@ -1396,7 +1396,7 @@ pn53x_nm_to_pm(const nfc_modulation_t nm) } } -// FIXME How to handle conner case ? +// FIXME How to handle corner case ? const nfc_modulation_type_t pn53x_ptt_to_nmt( const pn53x_target_type_t ptt ) { From f2a3d510371dfab49aea405b2ea644522a63c581 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 19:50:43 +0000 Subject: [PATCH 08/19] Fix a bug introduce in r729, fix a compilation warning --- examples/nfc-utils.h | 2 ++ libnfc/chips/pn53x.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/nfc-utils.h b/examples/nfc-utils.h index 46472f3..1497bbe 100644 --- a/examples/nfc-utils.h +++ b/examples/nfc-utils.h @@ -40,6 +40,8 @@ void print_nfc_felica_info (const nfc_felica_info_t nfi); void print_nfc_jewel_info (const nfc_jewel_info_t nji); void print_nfc_dep_info (const nfc_dep_info_t ndi); +void print_nfc_target (const nfc_target_t nt); + nfc_device_desc_t *parse_device_desc (int argc, const char *argv[], size_t * szFound); #endif diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index a4d0e0d..2be4b53 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1410,7 +1410,7 @@ pn53x_ptt_to_nmt( const pn53x_target_type_t ptt ) case PTT_MIFARE: case PTT_ISO14443_4A_106: - return NMT_ISO14443B; + return NMT_ISO14443A; break; case PTT_ISO14443_4B_106: From 124cc28bacfcb405db4c48156a92b691d673aa58 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 19:51:21 +0000 Subject: [PATCH 09/19] Typo --- libnfc/chips/pn53x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 2be4b53..e93c428 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1438,7 +1438,7 @@ pn53x_ptt_to_nmt( const pn53x_target_type_t ptt ) } } -// FIXME How to handle conner case ? +// FIXME How to handle corner case ? const pn53x_target_type_t pn53x_nm_to_ptt(const nfc_modulation_t nm) { From adba90684dfce4b6134e9b9f0019a1f6391aeb79 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 19:59:39 +0000 Subject: [PATCH 10/19] introduce nfc_dep_mode_t type instead of bool in nfc_initiator_select_dep_target() --- examples/nfc-dep-initiator.c | 2 +- include/nfc/nfc-types.h | 11 ++++++++++- libnfc/chips/pn53x.c | 13 +++++++------ libnfc/chips/pn53x.h | 4 ++-- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/examples/nfc-dep-initiator.c b/examples/nfc-dep-initiator.c index 039f7c2..b21f83c 100644 --- a/examples/nfc-dep-initiator.c +++ b/examples/nfc-dep-initiator.c @@ -62,7 +62,7 @@ main (int argc, const char *argv[]) return EXIT_FAILURE; } - if(!nfc_initiator_select_dep_target (pnd, false, NULL, &nti)) { + if(!nfc_initiator_select_dep_target (pnd, NDM_PASSIVE, NULL, &nti)) { nfc_perror(pnd, "nfc_initiator_select_dep_target"); return EXIT_FAILURE; } diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index 51d7628..b8c41e7 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -167,7 +167,7 @@ typedef enum { /** * @struct nfc_dep_info_t - * @brief NFC tag information in D.E.P. (Data Exchange Protocol) see ISO/IEC 18092 + * @brief NFC target information in D.E.P. (Data Exchange Protocol) see ISO/IEC 18092 (NFCIP-1) */ typedef struct { /** NFCID3 */ @@ -187,6 +187,15 @@ typedef struct { size_t szGB; } nfc_dep_info_t; +/** + * @enum nfc_dep_mode_t + * @brief NFC D.E.P. (Data Exchange Protocol) active/passive mode + */ +typedef enum { + NDM_PASSIVE, + NDM_ACTIVE, +} nfc_dep_mode_t; + /** * @struct nfc_iso14443a_info_t * @brief NFC ISO14443A tag (MIFARE) information diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index e93c428..7c42ab4 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -868,14 +868,14 @@ pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool b } bool -pn53x_initiator_select_dep_target(nfc_device_t * pnd, const bool bActiveDep, +pn53x_initiator_select_dep_target(nfc_device_t * pnd, const nfc_dep_mode_t ndm, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti) { if (pndiInitiator) { - return pn53x_InJumpForDEP (pnd, bActiveDep, NULL, 0, pndiInitiator->abtNFCID3, pndiInitiator->abtGB, pndiInitiator->szGB, pnti); + return pn53x_InJumpForDEP (pnd, ndm, NULL, 0, pndiInitiator->abtNFCID3, pndiInitiator->abtGB, pndiInitiator->szGB, pnti); } else { - return pn53x_InJumpForDEP (pnd, bActiveDep, NULL, 0, NULL, NULL, 0, pnti); + return pn53x_InJumpForDEP (pnd, ndm, NULL, 0, NULL, NULL, 0, pnti); } } @@ -890,7 +890,8 @@ pn53x_initiator_select_dep_target(nfc_device_t * pnd, const bool bActiveDep, * @param[out] pnti nfc_target_info_t which will be filled by this function */ bool -pn53x_InJumpForDEP (nfc_device_t * pnd, const bool bActiveDep, +pn53x_InJumpForDEP (nfc_device_t * pnd, + const nfc_dep_mode_t ndm, const byte_t * pbtPassiveInitiatorData, const size_t szPassiveInitiatorData, const byte_t * pbtNFCID3i, const byte_t * pbtGB, const size_t szGB, @@ -903,13 +904,13 @@ pn53x_InJumpForDEP (nfc_device_t * pnd, const bool bActiveDep, memcpy (abtCmd, pncmd_initiator_jump_for_dep, sizeof (pncmd_initiator_jump_for_dep)); - abtCmd[2] = (bActiveDep) ? 0x01 : 0x00; + abtCmd[2] = (ndm == NDM_ACTIVE) ? 0x01 : 0x00; // FIXME Baud rate in D.E.P. mode is hard-wired as 106kbps abtCmd[3] = 0x00; /* baud rate = 106kbps */ offset = 5; - if (pbtPassiveInitiatorData && !bActiveDep) { /* can't have passive initiator data when using active mode */ + if (pbtPassiveInitiatorData && (ndm == NDM_PASSIVE)) { /* can't have passive initiator data when using active mode */ abtCmd[4] |= 0x01; memcpy (abtCmd + offset, pbtPassiveInitiatorData, szPassiveInitiatorData); offset += szPassiveInitiatorData; diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index 9df0c75..9990d8f 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -183,7 +183,7 @@ bool pn53x_initiator_poll_targets (nfc_device_t * pnd, const nfc_modulation_t * pnmModulations, const size_t szModulations, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound); -bool pn53x_initiator_select_dep_target (nfc_device_t * pnd, const bool bActiveDep, +bool pn53x_initiator_select_dep_target (nfc_device_t * pnd, nfc_dep_mode_t ndm, const nfc_dep_info_t * pndiInitiator, nfc_target_info_t * pnti); bool pn53x_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTxBits, @@ -214,7 +214,7 @@ bool pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target); bool pn53x_InAutoPoll (nfc_device_t * pnd, const pn53x_target_type_t * ppttTargetTypes, const size_t szTargetTypes, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound); -bool pn53x_InJumpForDEP (nfc_device_t * pnd, const bool bActiveDep, +bool pn53x_InJumpForDEP (nfc_device_t * pnd, nfc_dep_mode_t ndm, const byte_t * pbtPassiveInitiatorData, const size_t szPassiveInitiatorData, const byte_t * pbtNFCID3i, const byte_t * pbtGB, const size_t szGB, From 9d9b5a629ee3b9becd3aacc8c43e758021f3d9b9 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 21:40:54 +0000 Subject: [PATCH 11/19] Fix nfc-poll, improve pn53x_target_type_t decoding --- examples/nfc-utils.c | 4 +++- include/nfc/nfc-types.h | 1 - libnfc/chips/pn53x.c | 47 ++++++++++++++++++++++++++++------------- 3 files changed, 35 insertions(+), 17 deletions(-) diff --git a/examples/nfc-utils.c b/examples/nfc-utils.c index dfcea21..b2d681e 100644 --- a/examples/nfc-utils.c +++ b/examples/nfc-utils.c @@ -272,6 +272,7 @@ str_nfc_baud_rate (const nfc_baud_rate_t nbr) return "424 kbps"; break; } + return ""; } void @@ -299,4 +300,5 @@ print_nfc_target (const nfc_target_t nt) print_nfc_dep_info (nt.nti.ndi); break; } -}; +} + diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index b8c41e7..06cf9cf 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -288,7 +288,6 @@ typedef enum { * @brief NFC modulation type enumeration */ typedef enum { - NMT_UNKNOWN, NMT_ISO14443A, NMT_ISO14443B, NMT_FELICA, diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 7c42ab4..d9c8a91 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -82,7 +82,7 @@ static const byte_t pn53x_nack_frame[] = { 0x00, 0x00, 0xff, 0xff, 0x00, 0x00 }; static const byte_t pn53x_error_frame[] = { 0x00, 0x00, 0xff, 0x01, 0xff, 0x7f, 0x81, 0x00 }; /* prototypes */ -const nfc_modulation_type_t pn53x_ptt_to_nmt( const pn53x_target_type_t ptt ); +const nfc_modulation_t pn53x_ptt_to_nm( const pn53x_target_type_t ptt ); const pn53x_modulation_t pn53x_nm_to_pm(const nfc_modulation_t nm); const pn53x_target_type_t pn53x_nm_to_ptt(const nfc_modulation_t nm); @@ -653,20 +653,20 @@ pn53x_InAutoPoll (nfc_device_t * pnd, /* 1st target */ // Target type pn53x_target_type_t ptt = *(pbt++); - pntTargets[0].nm.nmt = pn53x_ptt_to_nmt(ptt); + pntTargets[0].nm = pn53x_ptt_to_nm(ptt); // AutoPollTargetData length ln = *(pbt++); - pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[0].nti)); + pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[0].nm.nmt, &(pntTargets[0].nti)); pbt += ln; if (abtRx[0] > 1) { /* 2nd target */ // Target type ptt = *(pbt++); - pntTargets[1].nm.nmt = pn53x_ptt_to_nmt(ptt); + pntTargets[1].nm = pn53x_ptt_to_nm(ptt); // AutoPollTargetData length ln = *(pbt++); - pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[1].nti)); + pn53x_decode_target_data (pbt, ln, pnd->nc, pntTargets[1].nm.nmt, &(pntTargets[1].nti)); } } } @@ -1149,6 +1149,11 @@ pn53x_target_init (nfc_device_t * pnd, const nfc_target_mode_t ntm, const nfc_ta szGB = nt.nti.ndi.szGB; if (szGB) pbtGB = nt.nti.ndi.abtGB; break; + case NMT_ISO14443B: + case NMT_JEWEL: + pnd->iLastError = DENOTSUP; + return false; + break; } if(!pn53x_TgInitAsTarget(pnd, ntm, pbtMifareParams, pbtFeliCaParams, pbtNFCID3t, pbtGB, szGB, pbtRx, pszRx, NULL)) { @@ -1377,6 +1382,9 @@ pn53x_nm_to_pm(const nfc_modulation_t nm) case NBR_424: return PM_ISO14443B_424; break; + case NBR_UNDEFINED: + // XXX What to do ? + break; } break; @@ -1392,49 +1400,58 @@ pn53x_nm_to_pm(const nfc_modulation_t nm) case NBR_424: return PM_FELICA_424; break; + case NBR_106: + case NBR_UNDEFINED: + // XXX What to do ? + break; } break; } } // FIXME How to handle corner case ? -const nfc_modulation_type_t -pn53x_ptt_to_nmt( const pn53x_target_type_t ptt ) +const nfc_modulation_t +pn53x_ptt_to_nm( const pn53x_target_type_t ptt ) { switch (ptt) { case PTT_GENERIC_PASSIVE_106: case PTT_GENERIC_PASSIVE_212: case PTT_GENERIC_PASSIVE_424: // XXX This should not happend, how handle it cleanly ? - return NMT_UNKNOWN; break; case PTT_MIFARE: case PTT_ISO14443_4A_106: - return NMT_ISO14443A; + return (const nfc_modulation_t){ .nmt = NMT_ISO14443A, .nbr = NBR_106 }; break; case PTT_ISO14443_4B_106: case PTT_ISO14443_4B_TCL_106: - return NMT_ISO14443B; + return (const nfc_modulation_t){ .nmt = NMT_ISO14443B, .nbr = NBR_106 }; break; case PTT_JEWEL_106: - return NMT_JEWEL; + return (const nfc_modulation_t){ .nmt = NMT_JEWEL, .nbr = NBR_106 }; break; case PTT_FELICA_212: + return (const nfc_modulation_t){ .nmt = NMT_FELICA, .nbr = NBR_212 }; + break; case PTT_FELICA_424: - return NMT_FELICA; + return (const nfc_modulation_t){ .nmt = NMT_FELICA, .nbr = NBR_424 }; break; case PTT_DEP_PASSIVE_106: - case PTT_DEP_PASSIVE_212: - case PTT_DEP_PASSIVE_424: case PTT_DEP_ACTIVE_106: + return (const nfc_modulation_t){ .nmt = NMT_DEP, .nbr = NBR_106 }; + break; + case PTT_DEP_PASSIVE_212: case PTT_DEP_ACTIVE_212: + return (const nfc_modulation_t){ .nmt = NMT_DEP, .nbr = NBR_212 }; + break; + case PTT_DEP_PASSIVE_424: case PTT_DEP_ACTIVE_424: - return NMT_DEP; + return (const nfc_modulation_t){ .nmt = NMT_DEP, .nbr = NBR_424 }; break; } } From 3c4972b9a31dee7105aa2393f7dc8ac8ee77ca6e Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 22:26:17 +0000 Subject: [PATCH 12/19] Add TODO --- examples/nfc-list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nfc-list.c b/examples/nfc-list.c index bd3a9b8..16afeae 100644 --- a/examples/nfc-list.c +++ b/examples/nfc-list.c @@ -111,13 +111,13 @@ main (int argc, const char *argv[]) nfc_target_info_t anti[MAX_TARGET_COUNT]; pnd = nfc_connect (&(pnddDevices[i])); - if (pnd == NULL) { ERR ("%s", "Unable to connect to NFC device."); return EXIT_FAILURE; } nfc_initiator_init (pnd); + // TODO move these conf in nfc_initiator_list_passive_targets() (without them it will not work correctly) // Drop the field for a while if (!nfc_configure (pnd, NDO_ACTIVATE_FIELD, false)) { nfc_perror (pnd, "nfc_configure"); From d41e7f2ca0751161275d154011e094019c90c79e Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 22:28:29 +0000 Subject: [PATCH 13/19] Hack polling modulations in order to have ISO14443-4 with ATS and ISO14443-3 targets --- libnfc/chips/pn53x.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index d9c8a91..ee310c7 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -511,10 +511,16 @@ pn53x_initiator_poll_targets (nfc_device_t * pnd, const byte_t btPollNr, const byte_t btPeriod, nfc_target_t * pntTargets, size_t * pszTargetFound) { - const size_t szTargetTypes = szModulations; + size_t szTargetTypes = 0; pn53x_target_type_t apttTargetTypes[32]; - for (size_t n=0; n Date: Wed, 13 Oct 2010 22:40:42 +0000 Subject: [PATCH 14/19] Add manually done test results. --- manual-test-results.txt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 manual-test-results.txt diff --git a/manual-test-results.txt b/manual-test-results.txt new file mode 100644 index 0000000..07411fa --- /dev/null +++ b/manual-test-results.txt @@ -0,0 +1,8 @@ +# rev, program, local device, distant device, status +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, DESFire, OK +r736, nfc-list, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, DESFire, OK +r736, nfc-dep-target, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK +r736, nfc-dep-initiator, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, OK +r736, pn53x-diagnose, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, N/A, OK +r736, pn53x-diagnose, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, N/A, OK +r736, nfc-emulate-forum-tag4, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, Nokia 6212 Classic, OK From 2db760a2c41942efc79082ab6d720f194b2d7915 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 13 Oct 2010 22:49:15 +0000 Subject: [PATCH 15/19] Manual tests: some more results... --- manual-test-results.txt | 47 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/manual-test-results.txt b/manual-test-results.txt index 07411fa..c637ec9 100644 --- a/manual-test-results.txt +++ b/manual-test-results.txt @@ -1,8 +1,49 @@ # rev, program, local device, distant device, status -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, DESFire, OK +r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, UL, OK +r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK +r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, DESfire, OK +r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK +r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK +r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, DESfire, OK r736, nfc-list, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, DESFire, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, topaz, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, typeB Calypso, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, DESFire, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, topaz, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, 2 UL, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, JCOP, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, 2 DESfire, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ULC, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, typeB Calypso, OK r736, nfc-dep-target, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK r736, nfc-dep-initiator, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, OK -r736, pn53x-diagnose, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, N/A, OK -r736, pn53x-diagnose, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, N/A, OK r736, nfc-emulate-forum-tag4, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, Nokia 6212 Classic, OK +r736, nfc-emulate-forum-tag4, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL +r736, nfc-emulate-tag, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL +r736, nfc-emulate-tag, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK +r736, nfc-emulate-uid, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL +r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK +r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, touchatag nfc-anticol 2x, OK +r736, nfc-mfclassic r a foo, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK +r736, nfc-mfclassic r a foo, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK +r736, nfc-mfultralight r foo, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, UL, OK +r736, nfc-mfultralight r foo, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, topaz, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, typeB Calypso, OK +r736, pn53x-diagnose, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, N/A, OK +r736, pn53x-diagnose, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, N/A, OK +r736, pn53x-diagnose, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, N/A, OK +r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ultralight, OK +r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK + From 7703c9672dd0768ca788cb89f5b2ff6f3fd87e89 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 22:54:17 +0000 Subject: [PATCH 16/19] sort manual-test-results.txt --- manual-test-results.txt | 57 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/manual-test-results.txt b/manual-test-results.txt index c637ec9..9c1a4b6 100644 --- a/manual-test-results.txt +++ b/manual-test-results.txt @@ -1,28 +1,12 @@ # rev, program, local device, distant device, status -r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, UL, OK -r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, DESfire, OK -r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK -r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK +r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK +r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, UL, OK r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, DESfire, OK -r736, nfc-list, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, DESFire, OK -r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, topaz, OK -r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK -r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK -r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK -r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK -r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK -r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, typeB Calypso, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, DESFire, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, topaz, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, 2 UL, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, JCOP, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, 2 DESfire, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ULC, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, typeB Calypso, OK -r736, nfc-dep-target, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK +r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK +r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK r736, nfc-dep-initiator, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, OK +r736, nfc-dep-target, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK r736, nfc-emulate-forum-tag4, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, Nokia 6212 Classic, OK r736, nfc-emulate-forum-tag4, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL r736, nfc-emulate-tag, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL @@ -30,20 +14,35 @@ r736, nfc-emulate-tag, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK r736, nfc-emulate-uid, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, touchatag nfc-anticol 2x, OK +r736, nfc-list, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, DESFire, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, topaz, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, typeB Calypso, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, 2 DESfire, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, 2 UL, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, DESFire, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, JCOP, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ULC, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, topaz, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, typeB Calypso, OK r736, nfc-mfclassic r a foo, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK r736, nfc-mfclassic r a foo, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK r736, nfc-mfultralight r foo, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, UL, OK r736, nfc-mfultralight r foo, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK -r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, topaz, OK -r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK -r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK -r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK -r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK -r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK -r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, typeB Calypso, OK r736, pn53x-diagnose, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, N/A, OK r736, pn53x-diagnose, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, N/A, OK r736, pn53x-diagnose, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, N/A, OK r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ultralight, OK r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK - +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, topaz, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, typeB Calypso, OK From 3146c4c15033f2aac8e5ae9e9b48e60452575abd Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 13 Oct 2010 22:56:29 +0000 Subject: [PATCH 17/19] update manual-test-results.txt --- manual-test-results.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manual-test-results.txt b/manual-test-results.txt index 9c1a4b6..5334233 100644 --- a/manual-test-results.txt +++ b/manual-test-results.txt @@ -9,7 +9,9 @@ r736, nfc-dep-initiator, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CC r736, nfc-dep-target, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK r736, nfc-emulate-forum-tag4, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, Nokia 6212 Classic, OK r736, nfc-emulate-forum-tag4, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL +r736, nfc-emulate-tag, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK r736, nfc-emulate-tag, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL +r736, nfc-emulate-tag, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, OK r736, nfc-emulate-tag, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK r736, nfc-emulate-uid, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK From 9c23fc1dea1d26487cc9778331cd6f8c88e8f88c Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 13 Oct 2010 23:22:21 +0000 Subject: [PATCH 18/19] Manual tests: doc command to sort easily --- manual-test-results.txt | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/manual-test-results.txt b/manual-test-results.txt index 5334233..587c3da 100644 --- a/manual-test-results.txt +++ b/manual-test-results.txt @@ -1,4 +1,6 @@ -# rev, program, local device, distant device, status +#,0# rev, program, local device, distant device, status +#,1# (to sort easily: sort -k2 -t, manual-test-results.txt) +#,2###################################################### r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, DESfire, OK r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK r736, nfc-anticol, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, UL, OK @@ -7,44 +9,44 @@ r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK r736, nfc-dep-initiator, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, OK r736, nfc-dep-target, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK -r736, nfc-emulate-forum-tag4, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, Nokia 6212 Classic, OK r736, nfc-emulate-forum-tag4, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL -r736, nfc-emulate-tag, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK +r736, nfc-emulate-forum-tag4, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, Nokia 6212 Classic, OK r736, nfc-emulate-tag, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL +r736, nfc-emulate-tag, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK r736, nfc-emulate-tag, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, OK r736, nfc-emulate-tag, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK r736, nfc-emulate-uid, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, touchatag nfc-anticol 2x, OK -r736, nfc-list, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, DESFire, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK -r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, topaz, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, typeB Calypso, OK +r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK +r736, nfc-list, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, DESFire, OK r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, 2 DESfire, OK r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, 2 UL, OK r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, DESFire, OK r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, JCOP, OK r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK -r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ULC, OK r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, topaz, OK r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, typeB Calypso, OK +r736, nfc-list, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ULC, OK r736, nfc-mfclassic r a foo, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK r736, nfc-mfclassic r a foo, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, MFC, OK r736, nfc-mfultralight r foo, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, UL, OK r736, nfc-mfultralight r foo, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK -r736, pn53x-diagnose, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, N/A, OK -r736, pn53x-diagnose, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, N/A, OK -r736, pn53x-diagnose, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, N/A, OK -r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ultralight, OK -r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, MFC, OK -r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, topaz, OK r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, typeB Calypso, OK +r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, OK +r736, pn53x-diagnose, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, N/A, OK +r736, pn53x-diagnose, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, N/A, OK +r736, pn53x-diagnose, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, N/A, OK +r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ultralight, OK +r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK From dccaaa383f08cd3bee3e4292246b5d6dc6437c46 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 14 Oct 2010 08:59:49 +0000 Subject: [PATCH 19/19] update manual-test-results.txt --- manual-test-results.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manual-test-results.txt b/manual-test-results.txt index 587c3da..0ea0fe7 100644 --- a/manual-test-results.txt +++ b/manual-test-results.txt @@ -10,14 +10,18 @@ r736, nfc-anticol, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK r736, nfc-dep-initiator, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, OK r736, nfc-dep-target, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK r736, nfc-emulate-forum-tag4, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL +r744, nfc-emulate-forum-tag4, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, Nokia 6131 NFC, OK r736, nfc-emulate-forum-tag4, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, Nokia 6212 Classic, OK +r744, nfc-emulate-tag, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, Cardman 5321, OK +r744, nfc-emulate-tag, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, CardMan 5321, OK r736, nfc-emulate-tag, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL r736, nfc-emulate-tag, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, OK r736, nfc-emulate-tag, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, OK r736, nfc-emulate-tag, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK r736, nfc-emulate-uid, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ctrl-c & use, FAIL +r744, nfc-emulate-uid, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, emulate + ctrl-c & use, FAIL +r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4 + nfc-anticol 2x, OK r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, ctrl-c & use, OK -r736, nfc-emulate-uid, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, touchatag nfc-anticol 2x, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 DESfire, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, 2 UL, OK r736, nfc-list, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, JCOP, OK @@ -48,5 +52,6 @@ r739, nfc-poll, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ULC, r736, pn53x-diagnose, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, N/A, OK r736, pn53x-diagnose, ACS ACR 38U-CCID 00 00 / ACR122U102 - PN532 v1.4, N/A, OK r736, pn53x-diagnose, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, N/A, OK +r744, pn53x-sam (mode 1), Philips / PN531 - PN531 v4.2 + SAM, CardMan 5321, OK r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, ACS ACR122U PICC Interface 00 00 / ACR122U102 - PN532 v1.4, ultralight, OK r736, pn53x-tamashell < pn53x-tamashell-scripts/UltraLightRead.cmd, SCM Micro / SCL3711-NFC&RW - PN533 v2.7, UL, OK