rename nfc_connect() function to nfc_open().

This commit is contained in:
Audrey Diacre 2012-01-17 15:21:56 +00:00
parent 9eb37b3eee
commit 324af418db
36 changed files with 117 additions and 117 deletions

View file

@ -347,16 +347,16 @@ main (int argc, char *argv[])
}
// Try to open the NFC reader
pnd = nfc_connect (NULL);
pnd = nfc_open (NULL);
if (pnd == NULL) {
ERR("Unable to connect to NFC device");
ERR("Unable to open NFC device");
exit (EXIT_FAILURE);
}
signal (SIGINT, stop_emulation);
printf ("Connected to NFC device: %s\n", nfc_device_get_name(pnd));
printf ("NFC device: %s opened\n", nfc_device_get_name(pnd));
printf ("Emulating NDEF tag now, please touch it with a second NFC device\n");
if (0 != nfc_emulate_target (pnd, &emulator)) { // contains already nfc_target_init() call

View file

@ -95,7 +95,7 @@ main (int argc, const char *argv[])
/* Lazy way to open an NFC device */
#if 0
pnd = nfc_connect (NULL);
pnd = nfc_open (NULL);
#endif
/* If specific device is wanted, i.e. an ARYGON device on /dev/ttyUSB0 */
@ -104,7 +104,7 @@ main (int argc, const char *argv[])
ndd.pcDriver = "ARYGON";
ndd.pcPort = "/dev/ttyUSB0";
ndd.uiSpeed = 115200;
pnd = nfc_connect (&ndd);
pnd = nfc_open (&ndd);
#endif
/* If specific device is wanted, i.e. a SCL3711 on USB */
@ -112,7 +112,7 @@ main (int argc, const char *argv[])
nfc_device_desc_t ndd;
ndd.pcDriver = "PN533_USB";
strcpy(ndd.acDevice, "SCM Micro / SCL3711-NFC&RW");
pnd = nfc_connect (&ndd);
pnd = nfc_open (&ndd);
#endif
nfc_connstring connstrings[MAX_DEVICE_COUNT];
size_t szDeviceFound = nfc_list_devices (connstrings, MAX_DEVICE_COUNT);
@ -123,10 +123,10 @@ main (int argc, const char *argv[])
for (i = 0; i < szDeviceFound; i++) {
nfc_target ant[MAX_TARGET_COUNT];
pnd = nfc_connect (connstrings[i]);
pnd = nfc_open (connstrings[i]);
if (pnd == NULL) {
ERR ("%s", "Unable to connect to NFC device.");
ERR ("%s", "Unable to open NFC device.");
return EXIT_FAILURE;
}
if (nfc_initiator_init (pnd) < 0) {
@ -134,7 +134,7 @@ main (int argc, const char *argv[])
exit (EXIT_FAILURE);
}
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
printf ("NFC device: %s opened\n", nfc_device_get_name (pnd));
nfc_modulation nm;

View file

@ -538,9 +538,9 @@ main (int argc, const char *argv[])
// printf("Successfully opened required files\n");
// Try to open the NFC reader
pnd = nfc_connect (NULL);
pnd = nfc_open (NULL);
if (pnd == NULL) {
printf ("Error connecting NFC reader\n");
printf ("Error opening NFC reader\n");
exit (EXIT_FAILURE);
}
@ -557,7 +557,7 @@ main (int argc, const char *argv[])
// Disable ISO14443-4 switching in order to read devices that emulate Mifare Classic with ISO14443-4 compliance.
nfc_device_set_property_bool (pnd, NP_AUTO_ISO14443_4, false);
printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd));
printf ("NFC reader: %s opened\n", nfc_device_get_name (pnd));
// Try to find a MIFARE Classic tag
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {

View file

@ -178,10 +178,10 @@ main (int argc, char *argv[])
}
// Try to open the NFC reader
pnd = nfc_connect (NULL);
pnd = nfc_open (NULL);
if (!pnd) {
printf ("Error connecting NFC reader\n");
printf ("Error opening NFC reader\n");
exit(EXIT_FAILURE);
}
@ -207,7 +207,7 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd));
printf ("NFC reader: %s opened\n", nfc_device_get_name (pnd));
// Send the 7 bits request command specified in ISO 14443A (0x26)
if (!transmit_bits (abtReqa, 7)) {

View file

@ -205,9 +205,9 @@ main (int argc, const char *argv[])
DBG ("Successfully opened the dump file\n");
// Try to open the NFC device
pnd = nfc_connect (NULL);
pnd = nfc_open (NULL);
if (pnd == NULL) {
ERR ("Error connecting NFC device\n");
ERR ("Error opening NFC device\n");
return 1;
}
@ -222,7 +222,7 @@ main (int argc, const char *argv[])
exit (EXIT_FAILURE);
}
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));
printf ("NFC device: %s opened\n", nfc_device_get_name (pnd));
// Try to find a MIFARE Ultralight tag
if (nfc_initiator_select_passive_target (pnd, nmMifare, NULL, 0, &nt) < 0) {

View file

@ -195,14 +195,14 @@ main(int argc, char *argv[])
}
}
pnd = nfc_connect (NULL);
pnd = nfc_open (NULL);
if (pnd == NULL) {
ERR("Unable to connect to NFC device");
ERR("Unable to open NFC device");
exit (EXIT_FAILURE);
}
fprintf (message_stream, "Connected to NFC device: %s\n", nfc_device_get_name (pnd));
fprintf (message_stream, "NFC device: %s opened\n", nfc_device_get_name (pnd));
nfc_modulation nm = {
.nmt = NMT_FELICA,

View file

@ -204,7 +204,7 @@ main (int argc, char *argv[])
}
else {
if (szFound < 2) {
ERR ("%zd device found but two connected devices are needed to relay NFC.", szFound);
ERR ("%zd device found but two opened devices are needed to relay NFC.", szFound);
return EXIT_FAILURE;
}
}
@ -213,20 +213,20 @@ main (int argc, char *argv[])
// Try to open the NFC reader used as initiator
// Little hack to allow using initiator no matter if
// there is already a target used locally or not on the same machine:
// if there is more than one readers connected we connect to the second reader
// if there is more than one readers opened we open the second reader
// (we hope they're always detected in the same order)
if (szFound == 1) {
pndInitiator = nfc_connect (connstrings[0]);
pndInitiator = nfc_open (connstrings[0]);
} else {
pndInitiator = nfc_connect (connstrings[1]);
pndInitiator = nfc_open (connstrings[1]);
}
if (!pndInitiator) {
printf ("Error connecting NFC reader\n");
printf ("Error opening NFC reader\n");
exit(EXIT_FAILURE);
}
printf ("Connected to the NFC reader device: %s\n", nfc_device_get_name (pndInitiator));
printf ("NFC reader device: %s opened\n", nfc_device_get_name (pndInitiator));
if (nfc_initiator_init (pndInitiator) < 0) {
printf ("Error: fail initializing initiator\n");
@ -342,16 +342,16 @@ main (int argc, char *argv[])
print_nfc_iso14443a_info (ntEmulatedTarget.nti.nai, false);
// Try to open the NFC emulator device
pndTarget = nfc_connect (connstrings[0]);
pndTarget = nfc_open (connstrings[0]);
if (pndTarget == NULL) {
printf ("Error connecting NFC emulator device\n");
printf ("Error opening NFC emulator device\n");
if (!target_only_mode) {
nfc_close (pndInitiator);
}
return EXIT_FAILURE;
}
printf ("Connected to the NFC emulator device: %s\n", nfc_device_get_name (pndTarget));
printf ("NFC emulator device: %s opened\n", nfc_device_get_name (pndTarget));
szCapduLen = sizeof (abtCapdu);
if (nfc_target_init (pndTarget, &ntEmulatedTarget, abtCapdu, szCapduLen, 0) < 0) {