check result of nfc_initiator_init() function in examples/ and utils/

This commit is contained in:
Audrey Diacre 2012-01-05 10:33:50 +00:00
parent 331234713d
commit 5a1f0c2115
11 changed files with 45 additions and 11 deletions

View file

@ -130,7 +130,10 @@ main (int argc, const char *argv[])
ERR ("%s", "Unable to connect to NFC device.");
return EXIT_FAILURE;
}
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
printf ("Connected to NFC device: %s\n", nfc_device_get_name (pnd));

View file

@ -544,7 +544,10 @@ main (int argc, const char *argv[])
exit (EXIT_FAILURE);
}
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
};
// Let the reader only try once to find a tag
if (nfc_device_set_property_bool (pnd, NP_INFINITE_SELECT, false) < 0) {

View file

@ -186,7 +186,10 @@ main (int argc, char *argv[])
}
// Initialise NFC device as "initiator"
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
// Configure the CRC
if (nfc_device_set_property_bool (pnd, NP_HANDLE_CRC, false) < 0) {

View file

@ -211,7 +211,10 @@ main (int argc, const char *argv[])
return 1;
}
nfc_initiator_init (pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
// Let the device only try once to find a tag
if (nfc_device_set_property_bool (pnd, NP_INFINITE_SELECT, false) < 0) {

View file

@ -213,7 +213,10 @@ main(int argc, char *argv[])
nfc_target nt;
nfc_initiator_init(pnd);
if (nfc_initiator_init (pnd) < 0) {
nfc_perror (pnd, "nfc_initiator_init");
exit (EXIT_FAILURE);
}
fprintf (message_stream, "Place your NFC Forum Tag Type 3 in the field...\n");
int error = EXIT_SUCCESS;