examples, test and utils use now nfc_init() function.

This commit is contained in:
Audrey Diacre
2012-01-18 11:09:01 +00:00
parent d1b0e93e8e
commit 1d55b6f8c6
26 changed files with 51 additions and 7 deletions

View File

@@ -13,12 +13,14 @@ main (int argc, const char *argv[])
{
nfc_device *pnd;
nfc_target nt;
nfc_init();
// Display libnfc version
const char *acLibnfcVersion = nfc_version ();
printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
// Ope, using the first available NFC device
// Open, using the first available NFC device
pnd = nfc_open (NULL);
if (pnd == NULL) {

View File

@@ -148,6 +148,8 @@ main (int argc, char *argv[])
}
}
nfc_init();
// Try to open the NFC reader
pnd = nfc_open (NULL);

View File

@@ -71,6 +71,8 @@ main (int argc, const char *argv[])
printf ("Usage: %s\n", argv[0]);
return EXIT_FAILURE;
}
nfc_init();
pnd = nfc_open (NULL);
if (!pnd) {

View File

@@ -71,6 +71,7 @@ main (int argc, const char *argv[])
// the same machine: if there is more than one readers opened
// nfc-dep-target will open the second reader
// (we hope they're always detected in the same order)
nfc_init ();
if (szDeviceFound == 1) {
pnd = nfc_open (connstrings[0]);
} else if (szDeviceFound > 1) {

View File

@@ -182,6 +182,7 @@ main(int argc, char *argv[])
};
signal (SIGINT, stop_emulation);
nfc_init ();
pnd = nfc_open (NULL);
if (pnd == NULL) {

View File

@@ -179,6 +179,8 @@ main (int argc, char *argv[])
signal (SIGINT, (void (*)()) intr_hdlr);
#endif
nfc_init();
// Try to open the NFC reader
pnd = nfc_open (NULL);

View File

@@ -125,6 +125,8 @@ main (int argc, char *argv[])
signal (SIGINT, (void (*)()) intr_hdlr);
#endif
nfc_init ();
// Try to open the NFC device
pnd = nfc_open (NULL);

View File

@@ -102,6 +102,8 @@ main (int argc, const char *argv[])
nfc_target nt;
int res = 0;
nfc_init ();
pnd = nfc_open (NULL);

View File

@@ -115,6 +115,9 @@ main (int argc, char *argv[])
ERR ("%zd device found but two opened devices are needed to relay NFC.", szFound);
return EXIT_FAILURE;
}
nfc_init ();
// Try to open the NFC emulator device
pndTag = nfc_open (connstrings[0]);
if (pndTag == NULL) {

View File

@@ -67,6 +67,9 @@ main (int argc, const char *argv[])
if (argc > 1) {
errx (1, "usage: %s", argv[0]);
}
nfc_init();
// Display libnfc version
acLibnfcVersion = nfc_version ();
printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion);

View File

@@ -77,6 +77,8 @@ main (int argc, const char *argv[])
(void) argc;
(void) argv;
nfc_init ();
// Display libnfc version
const char *acLibnfcVersion = nfc_version ();
printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion);

View File

@@ -86,6 +86,8 @@ int main(int argc, const char* argv[])
}
}
nfc_init ();
// Try to open the NFC reader
pnd = nfc_open(NULL);