examples: silent some compilation warnings.
This commit is contained in:
parent
dbe59f83d9
commit
4384d27f3e
11 changed files with 98 additions and 56 deletions
|
@ -76,17 +76,23 @@ main (int argc, const char *argv[])
|
|||
}
|
||||
|
||||
nfc_target_t nt = {
|
||||
.nm.nmt = NMT_DEP,
|
||||
.nm.nbr = NBR_UNDEFINED, // Will be updated by nfc_target_init
|
||||
.nti.ndi.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 },
|
||||
.nti.ndi.szGB = 4,
|
||||
.nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 },
|
||||
/* These bytes are not used by nfc_target_init: the chip will provide them automatically to the initiator */
|
||||
.nti.ndi.btDID = 0x00,
|
||||
.nti.ndi.btBS = 0x00,
|
||||
.nti.ndi.btBR = 0x00,
|
||||
.nti.ndi.btTO = 0x00,
|
||||
.nti.ndi.btPP = 0x01,
|
||||
.nm = {
|
||||
.nmt = NMT_DEP,
|
||||
.nbr = NBR_UNDEFINED
|
||||
},
|
||||
.nti = {
|
||||
.ndi = {
|
||||
.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 },
|
||||
.szGB = 4,
|
||||
.abtGB = { 0x12, 0x34, 0x56, 0x78 },
|
||||
/* These bytes are not used by nfc_target_init: the chip will provide them automatically to the initiator */
|
||||
.btDID = 0x00,
|
||||
.btBS = 0x00,
|
||||
.btBR = 0x00,
|
||||
.btTO = 0x00,
|
||||
.btPP = 0x01,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
if (!pnd) {
|
||||
|
|
|
@ -108,7 +108,7 @@ bool receive_bytes (void)
|
|||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
main (void)
|
||||
{
|
||||
// Try to open the NFC reader
|
||||
pnd = nfc_connect (NULL);
|
||||
|
@ -122,13 +122,19 @@ main (int argc, char *argv[])
|
|||
printf ("Emulating NDEF tag now, please touch it with a second NFC device\n");
|
||||
|
||||
nfc_target_t nt = {
|
||||
.nm.nmt = NMT_ISO14443A,
|
||||
.nm.nbr = NBR_UNDEFINED, // Will be updated by nfc_target_init()
|
||||
.nti.nai.abtAtqa = { 0x00, 0x04 },
|
||||
.nti.nai.abtUid = { 0x08, 0x00, 0xb0, 0x0b },
|
||||
.nti.nai.btSak = 0x20,
|
||||
.nti.nai.szUidLen = 4,
|
||||
.nti.nai.szAtsLen = 0,
|
||||
.nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_UNDEFINED, // Will be updated by nfc_target_init()
|
||||
},
|
||||
.nti = {
|
||||
.nai = {
|
||||
.abtAtqa = { 0x00, 0x04 },
|
||||
.abtUid = { 0x08, 0x00, 0xb0, 0x0b },
|
||||
.btSak = 0x20,
|
||||
.szUidLen = 4,
|
||||
.szAtsLen = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
if (!nfc_target_init (pnd, &nt, abtRx, &szRx)) {
|
||||
|
|
|
@ -171,6 +171,7 @@ nfc_target_emulate_tag(nfc_device_t* pnd, nfc_target_t * pnt)
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
(void) argc;
|
||||
const char *acLibnfcVersion;
|
||||
|
||||
#ifdef WIN32
|
||||
|
@ -204,13 +205,19 @@ main (int argc, char *argv[])
|
|||
// Example of a Mifare Classic Mini
|
||||
// Note that crypto1 is not implemented in this example
|
||||
nfc_target_t nt = {
|
||||
.nm.nmt = NMT_ISO14443A,
|
||||
.nm.nbr = NBR_UNDEFINED,
|
||||
.nti.nai.abtAtqa = { 0x00, 0x04 },
|
||||
.nti.nai.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
||||
.nti.nai.btSak = 0x09,
|
||||
.nti.nai.szUidLen = 4,
|
||||
.nti.nai.szAtsLen = 0,
|
||||
.nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_UNDEFINED,
|
||||
},
|
||||
.nti = {
|
||||
.nai = {
|
||||
.abtAtqa = { 0x00, 0x04 },
|
||||
.abtUid = { 0x08, 0xab, 0xcd, 0xef },
|
||||
.btSak = 0x09,
|
||||
.szUidLen = 4,
|
||||
.szAtsLen = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
/*
|
||||
// Example of a FeliCa
|
||||
|
|
|
@ -143,13 +143,19 @@ 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 = {
|
||||
.nm.nmt = NMT_ISO14443A,
|
||||
.nm.nbr = NBR_UNDEFINED,
|
||||
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
||||
.nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xef },
|
||||
.nti.nai.btSak = 0x20,
|
||||
.nti.nai.szUidLen = 4,
|
||||
.nti.nai.szAtsLen = 0,
|
||||
.nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_UNDEFINED,
|
||||
},
|
||||
.nti = {
|
||||
.nai = {
|
||||
.abtAtqa = { 0x04, 0x00 },
|
||||
.abtUid = { 0x08, 0xad, 0xbe, 0xef },
|
||||
.btSak = 0x20,
|
||||
.szUidLen = 4,
|
||||
.szAtsLen = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
if (!nfc_target_init (pnd, &nt, abtRecv, &szRecvBits)) {
|
||||
nfc_perror (pnd, "nfc_target_init");
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file nfc-mfultool.c
|
||||
* @file nfc-mfultralight.c
|
||||
* @brief MIFARE Ultralight dump/restore tool
|
||||
*/
|
||||
|
||||
|
|
|
@ -292,8 +292,10 @@ main (int argc, char *argv[])
|
|||
}
|
||||
if (!initiator_only_mode) {
|
||||
nfc_target_t ntEmulatedTarget = {
|
||||
.nm.nmt = NMT_ISO14443A,
|
||||
.nm.nbr = NBR_106,
|
||||
.nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_106,
|
||||
},
|
||||
};
|
||||
if (target_only_mode) {
|
||||
size_t foo;
|
||||
|
|
|
@ -137,13 +137,19 @@ main (int argc, char *argv[])
|
|||
printf ("[+] For example, send a RATS command or use the \"nfc-anticol\" tool\n");
|
||||
|
||||
nfc_target_t nt = {
|
||||
.nm.nmt = NMT_ISO14443A,
|
||||
.nm.nbr = NBR_UNDEFINED,
|
||||
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
||||
.nti.nai.abtUid = { 0xde, 0xad, 0xbe, 0xef },
|
||||
.nti.nai.btSak = 0x20,
|
||||
.nti.nai.szUidLen = 4,
|
||||
.nti.nai.szAtsLen = 0,
|
||||
.nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_UNDEFINED,
|
||||
},
|
||||
.nti = {
|
||||
.nai = {
|
||||
.abtAtqa = { 0x04, 0x00 },
|
||||
.abtUid = { 0xde, 0xad, 0xbe, 0xef },
|
||||
.btSak = 0x20,
|
||||
.szUidLen = 4,
|
||||
.szAtsLen = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
if (!nfc_target_init (pndTag, &nt, abtReaderRx, &szReaderRxBits)) {
|
||||
|
|
|
@ -532,6 +532,7 @@ print_nfc_iso14443a_info (const nfc_iso14443a_info_t nai, bool verbose)
|
|||
void
|
||||
print_nfc_felica_info (const nfc_felica_info_t nfi, bool verbose)
|
||||
{
|
||||
(void) verbose;
|
||||
printf (" ID (NFCID2): ");
|
||||
print_hex (nfi.abtId, 8);
|
||||
printf (" Parameter (PAD): ");
|
||||
|
@ -541,6 +542,7 @@ print_nfc_felica_info (const nfc_felica_info_t nfi, bool verbose)
|
|||
void
|
||||
print_nfc_jewel_info (const nfc_jewel_info_t nji, bool verbose)
|
||||
{
|
||||
(void) verbose;
|
||||
printf (" ATQA (SENS_RES): ");
|
||||
print_hex (nji.btSensRes, 2);
|
||||
printf (" 4-LSB JEWELID: ");
|
||||
|
@ -608,6 +610,7 @@ print_nfc_iso14443b_info (const nfc_iso14443b_info_t nbi, bool verbose)
|
|||
void
|
||||
print_nfc_dep_info (const nfc_dep_info_t ndi, bool verbose)
|
||||
{
|
||||
(void) verbose;
|
||||
printf (" NFCID3: ");
|
||||
print_hex (ndi.abtNFCID3, 10);
|
||||
printf (" BS: %02x\n", ndi.btBS);
|
||||
|
|
|
@ -88,19 +88,19 @@ main (int argc, const char *argv[])
|
|||
|
||||
printf ("NFC device [%s] connected.\n", pnd->acName);
|
||||
|
||||
result = pn53x_transceive (pnd, pncmd_diagnose_communication_line_test, sizeof (pncmd_diagnose_communication_line_test), abtRx, &szRx);
|
||||
result = pn53x_transceive (pnd, pncmd_diagnose_communication_line_test, sizeof (pncmd_diagnose_communication_line_test), abtRx, &szRx, false);
|
||||
if (result) {
|
||||
result = (memcmp (pncmd_diagnose_communication_line_test + 2, abtRx, sizeof (pncmd_diagnose_communication_line_test) - 2) == 0);
|
||||
}
|
||||
printf (" Communication line test: %s\n", result ? "OK" : "Failed");
|
||||
|
||||
result = pn53x_transceive (pnd, pncmd_diagnose_rom_test, sizeof (pncmd_diagnose_rom_test), abtRx, &szRx);
|
||||
result = pn53x_transceive (pnd, pncmd_diagnose_rom_test, sizeof (pncmd_diagnose_rom_test), abtRx, &szRx, false);
|
||||
if (result) {
|
||||
result = ((szRx == 1) && (abtRx[0] == 0x00));
|
||||
}
|
||||
printf (" ROM test: %s\n", result ? "OK" : "Failed");
|
||||
|
||||
result = pn53x_transceive (pnd, pncmd_diagnose_ram_test, sizeof (pncmd_diagnose_ram_test), abtRx, &szRx);
|
||||
result = pn53x_transceive (pnd, pncmd_diagnose_ram_test, sizeof (pncmd_diagnose_ram_test), abtRx, &szRx, false);
|
||||
if (result) {
|
||||
result = ((szRx == 1) && (abtRx[0] == 0x00));
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ sam_connection (nfc_device_t * pnd, int mode)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!pn53x_transceive (pnd, pncmd_sam_config, szCmd, abtRx, &szRx)) {
|
||||
if (!pn53x_transceive (pnd, pncmd_sam_config, szCmd, abtRx, &szRx, false)) {
|
||||
nfc_perror(pnd, "pn53x_transceive");
|
||||
ERR ("%s %d", "Unable to execute SAMConfiguration command with mode byte:", mode);
|
||||
return false;
|
||||
|
@ -213,13 +213,19 @@ main (int argc, const char *argv[])
|
|||
size_t szRx;
|
||||
|
||||
nfc_target_t nt = {
|
||||
.nm.nmt = NMT_ISO14443A,
|
||||
.nm.nbr = NBR_UNDEFINED,
|
||||
.nti.nai.abtAtqa = { 0x04, 0x00 },
|
||||
.nti.nai.abtUid = { 0x08, 0xad, 0xbe, 0xef },
|
||||
.nti.nai.btSak = 0x20,
|
||||
.nti.nai.szUidLen = 4,
|
||||
.nti.nai.szAtsLen = 0,
|
||||
.nm = {
|
||||
.nmt = NMT_ISO14443A,
|
||||
.nbr = NBR_UNDEFINED,
|
||||
},
|
||||
.nti = {
|
||||
.nai = {
|
||||
.abtAtqa = { 0x04, 0x00 },
|
||||
.abtUid = { 0x08, 0xad, 0xbe, 0xef },
|
||||
.btSak = 0x20,
|
||||
.szUidLen = 4,
|
||||
.szAtsLen = 0,
|
||||
},
|
||||
},
|
||||
};
|
||||
printf ("Now both, NFC device (configured as target) and SAM are readables from an external NFC initiator.\n");
|
||||
printf ("Please note that NFC device (configured as target) stay in target mode until it receive RATS, ATR_REQ or proprietary command.\n");
|
||||
|
|
|
@ -132,7 +132,7 @@ int main(int argc, const char* argv[])
|
|||
while (isspace(cmd[offset])) {
|
||||
offset++;
|
||||
}
|
||||
sscanf(cmd+offset, "%u", &s);
|
||||
sscanf(cmd+offset, "%d", &s);
|
||||
printf("Pause for %i secs\n", s);
|
||||
if (s>0) {
|
||||
sleep(s);
|
||||
|
@ -167,7 +167,7 @@ int main(int argc, const char* argv[])
|
|||
printf("Tx: ");
|
||||
print_hex((byte_t*)abtTx+1,szTx-1);
|
||||
|
||||
if (!pn53x_transceive (pnd, abtTx, szTx, abtRx, &szRx)) {
|
||||
if (!pn53x_transceive (pnd, abtTx, szTx, abtRx, &szRx, false)) {
|
||||
free(cmd);
|
||||
nfc_perror (pnd, "Rx");
|
||||
continue;
|
||||
|
|
Loading…
Reference in a new issue