nfc_target_t have now nfc_modulation_t instead of nfc_modulatation_type_t
This commit is contained in:
parent
584a18ec11
commit
979430ecd1
10 changed files with 47 additions and 19 deletions
|
@ -66,7 +66,8 @@ main (int argc, const char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
const nfc_target_t nt = {
|
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.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 },
|
||||||
.nti.ndi.szGB = 4,
|
.nti.ndi.szGB = 4,
|
||||||
.nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 },
|
.nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 },
|
||||||
|
|
|
@ -112,7 +112,8 @@ main (int argc, char *argv[])
|
||||||
printf ("Emulating NDEF tag now, please touch it with a second NFC device\n");
|
printf ("Emulating NDEF tag now, please touch it with a second NFC device\n");
|
||||||
|
|
||||||
nfc_target_t nt = {
|
nfc_target_t nt = {
|
||||||
.nmt = NMT_ISO14443A,
|
.nm.nmt = NMT_ISO14443A,
|
||||||
|
.nm.nbr = NBR_UNDEFINED,
|
||||||
.nti.nai.abtAtqa = { 0x00, 0x04 },
|
.nti.nai.abtAtqa = { 0x00, 0x04 },
|
||||||
.nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b },
|
.nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b },
|
||||||
.nti.nai.btSak = 0x20,
|
.nti.nai.btSak = 0x20,
|
||||||
|
|
|
@ -173,7 +173,8 @@ main (int argc, char *argv[])
|
||||||
// Example of a Mifare Classic Mini
|
// Example of a Mifare Classic Mini
|
||||||
// Note that crypto1 is not implemented in this example
|
// Note that crypto1 is not implemented in this example
|
||||||
nfc_target_t nt = {
|
nfc_target_t nt = {
|
||||||
.nmt = NMT_ISO14443A,
|
.nm.nmt = NMT_ISO14443A,
|
||||||
|
.nm.nbr = NBR_UNDEFINED,
|
||||||
.nti.nai.abtAtqa = { 0x00, 0x04 },
|
.nti.nai.abtAtqa = { 0x00, 0x04 },
|
||||||
.nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
.nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
||||||
.nti.nai.btSak = 0x09,
|
.nti.nai.btSak = 0x09,
|
||||||
|
@ -183,7 +184,8 @@ main (int argc, char *argv[])
|
||||||
/*
|
/*
|
||||||
// Example of a FeliCa
|
// Example of a FeliCa
|
||||||
nfc_target_t nt = {
|
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.abtId = { 0x01, 0xFE, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF },
|
||||||
.nti.nfi.abtPad = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF },
|
.nti.nfi.abtPad = { 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xFF },
|
||||||
.nti.nfi.abtSysCode = { 0xFF, 0xFF },
|
.nti.nfi.abtSysCode = { 0xFF, 0xFF },
|
||||||
|
@ -192,7 +194,8 @@ main (int argc, char *argv[])
|
||||||
/*
|
/*
|
||||||
// Example of a ISO14443-4 (DESfire)
|
// Example of a ISO14443-4 (DESfire)
|
||||||
nfc_target_t nt = {
|
nfc_target_t nt = {
|
||||||
.nmt = NMT_ISO14443A,
|
.nm.nmt = NMT_ISO14443A,
|
||||||
|
.nm.nbr = NBR_UNDEFINED,
|
||||||
.nti.nai.abtAtqa = { 0x03, 0x44 },
|
.nti.nai.abtAtqa = { 0x03, 0x44 },
|
||||||
.nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
.nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
||||||
.nti.nai.btSak = 0x20,
|
.nti.nai.btSak = 0x20,
|
||||||
|
|
|
@ -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.
|
// 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 = {
|
nfc_target_t nt = {
|
||||||
.nmt = NMT_ISO14443A,
|
.nm.nmt = NMT_ISO14443A,
|
||||||
|
.nm.nbr = NBR_UNDEFINED,
|
||||||
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
||||||
.nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xaf },
|
.nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xaf },
|
||||||
.nti.nai.btSak = 0x20,
|
.nti.nai.btSak = 0x20,
|
||||||
|
|
|
@ -117,7 +117,7 @@ main (int argc, const char *argv[])
|
||||||
uint8_t n;
|
uint8_t n;
|
||||||
printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound);
|
printf ("%ld target(s) have been found.\n", (unsigned long) szTargetFound);
|
||||||
for (n = 0; n < szTargetFound; n++) {
|
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] );
|
print_nfc_target ( antTargets[n] );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,8 @@ main (int argc, char *argv[])
|
||||||
printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n");
|
printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n");
|
||||||
|
|
||||||
nfc_target_t nt = {
|
nfc_target_t nt = {
|
||||||
.nmt = NMT_ISO14443A,
|
.nm.nmt = NMT_ISO14443A,
|
||||||
|
.nm.nbr = NBR_UNDEFINED,
|
||||||
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
||||||
.nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef },
|
.nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef },
|
||||||
.nti.nai.btSak = 0x20,
|
.nti.nai.btSak = 0x20,
|
||||||
|
|
|
@ -255,28 +255,47 @@ parse_device_desc (int argc, const char *argv[], size_t * szFound)
|
||||||
return pndd;
|
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
|
void
|
||||||
print_nfc_target (const nfc_target_t nt)
|
print_nfc_target (const nfc_target_t nt)
|
||||||
{
|
{
|
||||||
switch(nt.nmt) {
|
switch(nt.nm.nmt) {
|
||||||
case NMT_ISO14443A:
|
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);
|
print_nfc_iso14443a_info (nt.nti.nai);
|
||||||
break;
|
break;
|
||||||
case NMT_JEWEL:
|
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);
|
print_nfc_jewel_info (nt.nti.nji);
|
||||||
break;
|
break;
|
||||||
case NMT_FELICA:
|
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);
|
print_nfc_felica_info (nt.nti.nfi);
|
||||||
break;
|
break;
|
||||||
case NMT_ISO14443B:
|
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);
|
print_nfc_iso14443b_info (nt.nti.nbi);
|
||||||
break;
|
break;
|
||||||
case NMT_DEP:
|
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);
|
print_nfc_dep_info (nt.nti.ndi);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,8 @@ main (int argc, const char *argv[])
|
||||||
size_t szRx;
|
size_t szRx;
|
||||||
|
|
||||||
nfc_target_t nt = {
|
nfc_target_t nt = {
|
||||||
.nmt = NMT_ISO14443A,
|
.nm.nmt = NMT_ISO14443A,
|
||||||
|
.nm.nbr = NBR_UNDEFINED,
|
||||||
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
||||||
.nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xaf },
|
.nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xaf },
|
||||||
.nti.nai.btSak = 0x20,
|
.nti.nai.btSak = 0x20,
|
||||||
|
|
|
@ -268,6 +268,7 @@ typedef enum {
|
||||||
* @brief NFC baud rate enumeration
|
* @brief NFC baud rate enumeration
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
NBR_UNDEFINED = 0,
|
||||||
NBR_106,
|
NBR_106,
|
||||||
NBR_212,
|
NBR_212,
|
||||||
NBR_424,
|
NBR_424,
|
||||||
|
@ -301,7 +302,7 @@ typedef struct {
|
||||||
*/
|
*/
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nfc_target_info_t nti;
|
nfc_target_info_t nti;
|
||||||
nfc_modulation_type_t nmt;
|
nfc_modulation_t nm;
|
||||||
} nfc_target_t;
|
} nfc_target_t;
|
||||||
|
|
||||||
// Reset struct alignment to default
|
// Reset struct alignment to default
|
||||||
|
|
|
@ -652,7 +652,7 @@ pn53x_InAutoPoll (nfc_device_t * pnd,
|
||||||
/* 1st target */
|
/* 1st target */
|
||||||
// Target type
|
// Target type
|
||||||
pn53x_target_type_t ptt = *(pbt++);
|
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
|
// AutoPollTargetData length
|
||||||
ln = *(pbt++);
|
ln = *(pbt++);
|
||||||
pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[0].nti));
|
pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[0].nti));
|
||||||
|
@ -662,7 +662,7 @@ pn53x_InAutoPoll (nfc_device_t * pnd,
|
||||||
/* 2nd target */
|
/* 2nd target */
|
||||||
// Target type
|
// Target type
|
||||||
ptt = *(pbt++);
|
ptt = *(pbt++);
|
||||||
pntTargets[1].nmt = pn53x_ptt_to_nmt(*(pbt++));
|
pntTargets[1].nm.nmt = pn53x_ptt_to_nmt(*(pbt++));
|
||||||
// AutoPollTargetData length
|
// AutoPollTargetData length
|
||||||
ln = *(pbt++);
|
ln = *(pbt++);
|
||||||
pn53x_decode_target_data (pbt, ln, pnd->nc, ptt, &(pntTargets[1].nti));
|
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;
|
const byte_t * pbtGB = NULL;
|
||||||
size_t szGB = 0;
|
size_t szGB = 0;
|
||||||
|
|
||||||
switch(nt.nmt) {
|
switch(nt.nm.nmt) {
|
||||||
case NMT_ISO14443A: {
|
case NMT_ISO14443A: {
|
||||||
// Set ATQA (SENS_RES)
|
// Set ATQA (SENS_RES)
|
||||||
abtMifareParams[0] = nt.nti.nai.abtAtqa[1];
|
abtMifareParams[0] = nt.nti.nai.abtAtqa[1];
|
||||||
|
|
Loading…
Add table
Reference in a new issue