rename nfc_disconnect() function to nfc_close().
This commit is contained in:
parent
9d3ca39a44
commit
9eb37b3eee
35 changed files with 80 additions and 80 deletions
|
|
@ -363,7 +363,7 @@ main (int argc, char *argv[])
|
|||
nfc_perror (pnd, "nfc_emulate_target");
|
||||
}
|
||||
|
||||
nfc_disconnect(pnd);
|
||||
nfc_close(pnd);
|
||||
|
||||
if (argc == 3) {
|
||||
if (!(ndef_message_save (argv[2], &nfcforum_tag4_data))) {
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ main (int argc, const char *argv[])
|
|||
printf("\n");
|
||||
}
|
||||
}
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -562,7 +562,7 @@ main (int argc, const char *argv[])
|
|||
// Try to find a MIFARE Classic tag
|
||||
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {
|
||||
printf ("Error: no tag was found\n");
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
// Test if we are dealing with a MIFARE compatible tag
|
||||
|
|
@ -618,7 +618,7 @@ main (int argc, const char *argv[])
|
|||
write_card (unlock);
|
||||
}
|
||||
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
break;
|
||||
|
||||
case ACTION_EXTRACT:{
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ main (int argc, char *argv[])
|
|||
// Send the 7 bits request command specified in ISO 14443A (0x26)
|
||||
if (!transmit_bits (abtReqa, 7)) {
|
||||
printf ("Error: No tag available\n");
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
return 1;
|
||||
}
|
||||
memcpy (abtAtqa, abtRx, 2);
|
||||
|
|
@ -350,6 +350,6 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -227,14 +227,14 @@ main (int argc, const char *argv[])
|
|||
// Try to find a MIFARE Ultralight tag
|
||||
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {
|
||||
ERR ("no tag was found\n");
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
return 1;
|
||||
}
|
||||
// Test if we are dealing with a MIFARE compatible tag
|
||||
|
||||
if (nt.nti.nai.abtAtqa[1] != 0x44) {
|
||||
ERR ("tag is not a MIFARE Ultralight card\n");
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
// Get the info from the current tag
|
||||
|
|
@ -265,7 +265,7 @@ main (int argc, const char *argv[])
|
|||
write_card ();
|
||||
}
|
||||
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ main(int argc, char *argv[])
|
|||
error:
|
||||
fclose (ndef_stream);
|
||||
if (pnd) {
|
||||
nfc_disconnect (pnd);
|
||||
nfc_close (pnd);
|
||||
}
|
||||
exit (error);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ main (int argc, char *argv[])
|
|||
|
||||
if (nfc_initiator_init (pndInitiator) < 0) {
|
||||
printf ("Error: fail initializing initiator\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ main (int argc, char *argv[])
|
|||
};
|
||||
if (nfc_initiator_select_passive_target (pndInitiator, nm, NULL, 0, &ntRealTarget) < 0) {
|
||||
printf ("Error: no tag was found\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -250,22 +250,22 @@ main (int argc, char *argv[])
|
|||
if (initiator_only_mode) {
|
||||
if (print_hex_fd4(ntRealTarget.nti.nai.abtUid, ntRealTarget.nti.nai.szUidLen, "UID") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while printing UID to FD4\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (print_hex_fd4(ntRealTarget.nti.nai.abtAtqa, 2, "ATQA") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while printing ATQA to FD4\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (print_hex_fd4(&(ntRealTarget.nti.nai.btSak), 1, "SAK") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while printing SAK to FD4\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (print_hex_fd4(ntRealTarget.nti.nai.abtAts, ntRealTarget.nti.nai.szAtsLen, "ATS") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while printing ATS to FD4\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
@ -288,22 +288,22 @@ main (int argc, char *argv[])
|
|||
size_t foo;
|
||||
if (scan_hex_fd3(ntEmulatedTarget.nti.nai.abtUid, &(ntEmulatedTarget.nti.nai.szUidLen), "UID") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while scanning UID from FD3\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (scan_hex_fd3(ntEmulatedTarget.nti.nai.abtAtqa, &foo, "ATQA") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while scanning ATQA from FD3\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (scan_hex_fd3(&(ntEmulatedTarget.nti.nai.btSak), &foo, "SAK") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while scanning SAK from FD3\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (scan_hex_fd3(ntEmulatedTarget.nti.nai.abtAts, &(ntEmulatedTarget.nti.nai.szAtsLen), "ATS") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while scanning ATS from FD3\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -346,7 +346,7 @@ main (int argc, char *argv[])
|
|||
if (pndTarget == NULL) {
|
||||
printf ("Error connecting NFC emulator device\n");
|
||||
if (!target_only_mode) {
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
}
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -357,9 +357,9 @@ main (int argc, char *argv[])
|
|||
if (nfc_target_init (pndTarget, &ntEmulatedTarget, abtCapdu, szCapduLen, 0) < 0) {
|
||||
ERR ("%s", "Initialization of NFC emulator failed");
|
||||
if (!target_only_mode) {
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
}
|
||||
nfc_disconnect (pndTarget);
|
||||
nfc_close (pndTarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf ("%s\n", "Done, relaying frames now!");
|
||||
|
|
@ -374,23 +374,23 @@ main (int argc, char *argv[])
|
|||
if ((res = nfc_target_receive_bytes(pndTarget, abtCapdu, sizeof (abtCapdu), 0)) < 0) {
|
||||
nfc_perror (pndTarget, "nfc_target_receive_bytes");
|
||||
if (!target_only_mode) {
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
}
|
||||
nfc_disconnect (pndTarget);
|
||||
nfc_close (pndTarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
szCapduLen = (size_t) res;
|
||||
if (target_only_mode) {
|
||||
if (print_hex_fd4(abtCapdu, szCapduLen, "C-APDU") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while printing C-APDU to FD4\n");
|
||||
nfc_disconnect (pndTarget);
|
||||
nfc_close (pndTarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (scan_hex_fd3(abtCapdu, &szCapduLen, "C-APDU") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while scanning C-APDU from FD3\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
@ -407,7 +407,7 @@ main (int argc, char *argv[])
|
|||
} else {
|
||||
if (scan_hex_fd3(abtRapdu, &szRapduLen, "R-APDU") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while scanning R-APDU from FD3\n");
|
||||
nfc_disconnect (pndTarget);
|
||||
nfc_close (pndTarget);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
ret = true;
|
||||
|
|
@ -430,17 +430,17 @@ main (int argc, char *argv[])
|
|||
if (nfc_target_send_bytes(pndTarget, abtRapdu, szRapduLen, 0) < 0) {
|
||||
nfc_perror (pndTarget, "nfc_target_send_bytes");
|
||||
if (!target_only_mode) {
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
}
|
||||
if (!initiator_only_mode) {
|
||||
nfc_disconnect (pndTarget);
|
||||
nfc_close (pndTarget);
|
||||
}
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
} else {
|
||||
if (print_hex_fd4(abtRapdu, szRapduLen, "R-APDU") != EXIT_SUCCESS) {
|
||||
fprintf (stderr, "Error while printing R-APDU to FD4\n");
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
@ -448,10 +448,10 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
if (!target_only_mode) {
|
||||
nfc_disconnect (pndInitiator);
|
||||
nfc_close (pndInitiator);
|
||||
}
|
||||
if (!initiator_only_mode) {
|
||||
nfc_disconnect (pndTarget);
|
||||
nfc_close (pndTarget);
|
||||
}
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue