From 5a1f0c2115a3612841fb649ccf7295786a0acba6 Mon Sep 17 00:00:00 2001 From: Audrey Diacre Date: Thu, 5 Jan 2012 10:33:50 +0000 Subject: [PATCH] check result of nfc_initiator_init() function in examples/ and utils/ --- examples/doc/quick_start_example1.c | 5 ++++- examples/nfc-anticol.c | 5 ++++- examples/nfc-poll.c | 5 ++++- examples/nfc-relay.c | 6 +++++- examples/pn53x-sam.c | 5 ++++- examples/pn53x-tamashell.c | 5 ++++- utils/nfc-list.c | 5 ++++- utils/nfc-mfclassic.c | 5 ++++- utils/nfc-mfsetuid.c | 5 ++++- utils/nfc-mfultralight.c | 5 ++++- utils/nfc-read-forum-tag3.c | 5 ++++- 11 files changed, 45 insertions(+), 11 deletions(-) diff --git a/examples/doc/quick_start_example1.c b/examples/doc/quick_start_example1.c index 448a8aa..0f88896 100644 --- a/examples/doc/quick_start_example1.c +++ b/examples/doc/quick_start_example1.c @@ -26,7 +26,10 @@ main (int argc, const char *argv[]) return EXIT_FAILURE; } // Set connected NFC device to initiator mode - nfc_initiator_init (pnd); + if (nfc_initiator_init (pnd) < 0) { + nfc_perror (pnd, "nfc_initiator_init"); + exit (EXIT_FAILURE); + } printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd)); diff --git a/examples/nfc-anticol.c b/examples/nfc-anticol.c index 3ab2c78..30e8aa3 100644 --- a/examples/nfc-anticol.c +++ b/examples/nfc-anticol.c @@ -157,7 +157,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) { diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index ded0705..c9bd62b 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -110,7 +110,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); + } printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd)); printf ("NFC device will poll during %ld ms (%u pollings of %lu ms for %zd modulations)\n", (unsigned long) uiPollNr * szModulations * uiPeriod * 150, uiPollNr, (unsigned long) uiPeriod * 150, szModulations); diff --git a/examples/nfc-relay.c b/examples/nfc-relay.c index 4402fa2..677e8d9 100644 --- a/examples/nfc-relay.c +++ b/examples/nfc-relay.c @@ -164,7 +164,11 @@ main (int argc, char *argv[]) printf ("Connected to the NFC reader device: %s", nfc_device_get_name (pndReader)); printf ("%s", "Configuring NFC reader settings..."); - nfc_initiator_init (pndReader); + + if (nfc_initiator_init (pndReader) < 0) { + nfc_perror (pndReader, "nfc_initiator_init"); + exit (EXIT_FAILURE); + } if ((nfc_device_set_property_bool (pndReader, NP_HANDLE_CRC, false) < 0) || (nfc_device_set_property_bool (pndReader, NP_HANDLE_PARITY, false) < 0) || (nfc_device_set_property_bool (pndReader, NP_ACCEPT_INVALID_FRAMES, true)) < 0) { diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 09b67d7..713cb58 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -128,7 +128,10 @@ main (int argc, const char *argv[]) nfc_target nt; // Set connected NFC device to initiator mode - 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) { diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index 87cff6f..e06e9a0 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -95,7 +95,10 @@ int main(int argc, const char* argv[]) } printf ("Connected to NFC reader: %s\n", nfc_device_get_name (pnd)); - nfc_initiator_init(pnd); + if (nfc_initiator_init (pnd) < 0) { + nfc_perror (pnd, "nfc_initiator_init"); + exit (EXIT_FAILURE); + } char *cmd; char *prompt = "> "; diff --git a/utils/nfc-list.c b/utils/nfc-list.c index fbf8f94..9fee2bb 100644 --- a/utils/nfc-list.c +++ b/utils/nfc-list.c @@ -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)); diff --git a/utils/nfc-mfclassic.c b/utils/nfc-mfclassic.c index c784a7c..e89a19b 100644 --- a/utils/nfc-mfclassic.c +++ b/utils/nfc-mfclassic.c @@ -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) { diff --git a/utils/nfc-mfsetuid.c b/utils/nfc-mfsetuid.c index 5ef33e4..7927536 100644 --- a/utils/nfc-mfsetuid.c +++ b/utils/nfc-mfsetuid.c @@ -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) { diff --git a/utils/nfc-mfultralight.c b/utils/nfc-mfultralight.c index 3027a18..8bc32a7 100644 --- a/utils/nfc-mfultralight.c +++ b/utils/nfc-mfultralight.c @@ -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) { diff --git a/utils/nfc-read-forum-tag3.c b/utils/nfc-read-forum-tag3.c index 5b3db96..69af3d5 100644 --- a/utils/nfc-read-forum-tag3.c +++ b/utils/nfc-read-forum-tag3.c @@ -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;