From 9eb37b3eeeabadb5731ddf20edf385ff5f9541df Mon Sep 17 00:00:00 2001 From: Audrey Diacre Date: Tue, 17 Jan 2012 14:52:39 +0000 Subject: [PATCH] rename nfc_disconnect() function to nfc_close(). --- examples/doc/quick_start_example1.c | 2 +- examples/nfc-anticol.c | 4 +-- examples/nfc-dep-initiator.c | 2 +- examples/nfc-dep-target.c | 2 +- examples/nfc-emulate-forum-tag2.c | 4 +-- examples/nfc-emulate-tag.c | 4 +-- examples/nfc-emulate-uid.c | 4 +-- examples/nfc-poll.c | 4 +-- examples/nfc-relay.c | 6 ++-- examples/pn53x-sam.c | 2 +- examples/pn53x-tamashell.c | 2 +- include/nfc/nfc.h | 2 +- libnfc/drivers/acr122.c | 4 +-- libnfc/drivers/acr122.h | 2 +- libnfc/drivers/arygon.c | 6 ++-- libnfc/drivers/arygon.h | 2 +- libnfc/drivers/pn532_uart.c | 6 ++-- libnfc/drivers/pn532_uart.h | 2 +- libnfc/drivers/pn53x_usb.c | 4 +-- libnfc/drivers/pn53x_usb.h | 2 +- libnfc/nfc-internal.h | 2 +- libnfc/nfc.c | 8 ++--- test/test_access_storm.c | 2 +- test/test_dep_active.c | 4 +-- test/test_dep_passive.c | 4 +-- test/test_device_modes_as_dep.c | 4 +-- test/test_register_access.c | 2 +- test/test_register_endianness.c | 2 +- utils/nfc-emulate-forum-tag4.c | 2 +- utils/nfc-list.c | 2 +- utils/nfc-mfclassic.c | 4 +-- utils/nfc-mfsetuid.c | 4 +-- utils/nfc-mfultralight.c | 6 ++-- utils/nfc-read-forum-tag3.c | 2 +- utils/nfc-relay-picc.c | 46 ++++++++++++++--------------- 35 files changed, 80 insertions(+), 80 deletions(-) diff --git a/examples/doc/quick_start_example1.c b/examples/doc/quick_start_example1.c index 0f88896..2273618 100644 --- a/examples/doc/quick_start_example1.c +++ b/examples/doc/quick_start_example1.c @@ -52,6 +52,6 @@ main (int argc, const char *argv[]) } } // Disconnect from NFC device - nfc_disconnect (pnd); + nfc_close (pnd); return EXIT_SUCCESS; } diff --git a/examples/nfc-anticol.c b/examples/nfc-anticol.c index 30e8aa3..f211931 100644 --- a/examples/nfc-anticol.c +++ b/examples/nfc-anticol.c @@ -183,7 +183,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); @@ -312,6 +312,6 @@ main (int argc, char *argv[]) print_hex (abtAts, szAts); } - nfc_disconnect (pnd); + nfc_close (pnd); return 0; } diff --git a/examples/nfc-dep-initiator.c b/examples/nfc-dep-initiator.c index 92cf7ac..7e4c4da 100644 --- a/examples/nfc-dep-initiator.c +++ b/examples/nfc-dep-initiator.c @@ -107,6 +107,6 @@ main (int argc, const char *argv[]) } error: - nfc_disconnect (pnd); + nfc_close (pnd); return EXIT_SUCCESS; } diff --git a/examples/nfc-dep-target.c b/examples/nfc-dep-target.c index aa19ef2..ceff103 100644 --- a/examples/nfc-dep-target.c +++ b/examples/nfc-dep-target.c @@ -139,6 +139,6 @@ main (int argc, const char *argv[]) printf("Data sent.\n"); error: - nfc_disconnect (pnd); + nfc_close (pnd); return EXIT_SUCCESS; } diff --git a/examples/nfc-emulate-forum-tag2.c b/examples/nfc-emulate-forum-tag2.c index c682eb7..feacba5 100644 --- a/examples/nfc-emulate-forum-tag2.c +++ b/examples/nfc-emulate-forum-tag2.c @@ -196,13 +196,13 @@ main(int argc, char *argv[]) goto error; } - nfc_disconnect(pnd); + nfc_close(pnd); exit (EXIT_SUCCESS); error: if (pnd) { nfc_perror (pnd, argv[0]); - nfc_disconnect (pnd); + nfc_close (pnd); } } diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index e0dc77c..25bbb67 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -65,7 +65,7 @@ intr_hdlr (void) { printf ("\nQuitting...\n"); if (pnd != NULL) { - nfc_disconnect(pnd); + nfc_close(pnd); } exit (EXIT_FAILURE); } @@ -265,7 +265,7 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } - nfc_disconnect(pnd); + nfc_close(pnd); exit (EXIT_SUCCESS); } diff --git a/examples/nfc-emulate-uid.c b/examples/nfc-emulate-uid.c index 9baac45..5609fd0 100644 --- a/examples/nfc-emulate-uid.c +++ b/examples/nfc-emulate-uid.c @@ -216,10 +216,10 @@ main (int argc, char *argv[]) } } } - nfc_disconnect (pnd); + nfc_close (pnd); exit (EXIT_SUCCESS); error: - nfc_disconnect (pnd); + nfc_close (pnd); exit (EXIT_FAILURE); } diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index 88c51c7..8ebe9c4 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -119,7 +119,7 @@ main (int argc, const char *argv[]) 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); if ((res = nfc_initiator_poll_target (pnd, nmModulations, szModulations, uiPollNr, uiPeriod, &nt)) < 0) { nfc_perror (pnd, "nfc_initiator_poll_target"); - nfc_disconnect (pnd); + nfc_close (pnd); exit (EXIT_FAILURE); } @@ -128,6 +128,6 @@ main (int argc, const char *argv[]) } else { printf ("No target found.\n"); } - nfc_disconnect (pnd); + nfc_close (pnd); exit (EXIT_SUCCESS); } diff --git a/examples/nfc-relay.c b/examples/nfc-relay.c index 9cb7a54..8be7b29 100644 --- a/examples/nfc-relay.c +++ b/examples/nfc-relay.c @@ -147,7 +147,7 @@ main (int argc, char *argv[]) if ((szReaderRxBits = nfc_target_init (pndTag, &nt, abtReaderRx, sizeof (abtReaderRx), 0)) < 0) { ERR ("%s", "Initialization of NFC emulator failed"); - nfc_disconnect (pndTag); + nfc_close (pndTag); return EXIT_FAILURE; } printf ("%s", "Configuring emulator settings..."); @@ -215,7 +215,7 @@ main (int argc, char *argv[]) } } - nfc_disconnect (pndTag); - nfc_disconnect (pndReader); + nfc_close (pndTag); + nfc_close (pndReader); exit (EXIT_SUCCESS); } diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 8757624..085b9ed 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -190,7 +190,7 @@ main (int argc, const char *argv[]) pn53x_SAMConfiguration (pnd, PSM_NORMAL, 0); // Disconnect from NFC device - nfc_disconnect (pnd); + nfc_close (pnd); exit (EXIT_SUCCESS); } diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index ac0bb8f..7f5937d 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -197,6 +197,6 @@ int main(int argc, const char* argv[]) if (input != NULL) { fclose(input); } - nfc_disconnect(pnd); + nfc_close(pnd); return 1; } diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index b5fec58..762316b 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -65,7 +65,7 @@ extern "C" { /* NFC Device/Hardware manipulation */ NFC_EXPORT bool nfc_get_default_device (nfc_connstring *connstring); NFC_EXPORT nfc_device *nfc_connect (const nfc_connstring connstring); - NFC_EXPORT void nfc_disconnect (nfc_device *pnd); + NFC_EXPORT void nfc_close (nfc_device *pnd); NFC_EXPORT int nfc_abort_command (nfc_device *pnd); NFC_EXPORT size_t nfc_list_devices (nfc_connstring connstrings[], size_t connstrings_len); NFC_EXPORT int nfc_idle (nfc_device *pnd); diff --git a/libnfc/drivers/acr122.c b/libnfc/drivers/acr122.c index cc70465..9dc688b 100644 --- a/libnfc/drivers/acr122.c +++ b/libnfc/drivers/acr122.c @@ -301,7 +301,7 @@ error: } void -acr122_disconnect (nfc_device *pnd) +acr122_close (nfc_device *pnd) { SCardDisconnect (DRIVER_DATA (pnd)->hCard, SCARD_LEAVE_CARD); acr122_free_scardcontext (); @@ -467,7 +467,7 @@ const struct nfc_driver acr122_driver = { .name = ACR122_DRIVER_NAME, .probe = acr122_probe, .connect = acr122_connect, - .disconnect = acr122_disconnect, + .close = acr122_close, .strerror = pn53x_strerror, .initiator_init = pn53x_initiator_init, diff --git a/libnfc/drivers/acr122.h b/libnfc/drivers/acr122.h index fb8e2b0..98c2c1c 100644 --- a/libnfc/drivers/acr122.h +++ b/libnfc/drivers/acr122.h @@ -32,7 +32,7 @@ bool acr122_probe (nfc_connstring connstrings[], size_t connstrings_len, size nfc_device *acr122_connect (const nfc_connstring connstring); int acr122_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); int acr122_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout); -void acr122_disconnect (nfc_device *pnd); +void acr122_close (nfc_device *pnd); extern const struct nfc_driver acr122_driver; diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index ad563c9..c6694a6 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -270,7 +270,7 @@ arygon_connect (const nfc_connstring connstring) // Check communication using "Reset TAMA" command if (arygon_reset_tama(pnd) < 0) { - arygon_disconnect (pnd); + arygon_close (pnd); return NULL; } @@ -286,7 +286,7 @@ arygon_connect (const nfc_connstring connstring) } void -arygon_disconnect (nfc_device *pnd) +arygon_close (nfc_device *pnd) { // Release UART port uart_close (DRIVER_DATA (pnd)->port); @@ -561,7 +561,7 @@ const struct nfc_driver arygon_driver = { .name = ARYGON_DRIVER_NAME, .probe = arygon_probe, .connect = arygon_connect, - .disconnect = arygon_disconnect, + .close = arygon_close, .strerror = pn53x_strerror, .initiator_init = pn53x_initiator_init, diff --git a/libnfc/drivers/arygon.h b/libnfc/drivers/arygon.h index 9873366..c324e93 100644 --- a/libnfc/drivers/arygon.h +++ b/libnfc/drivers/arygon.h @@ -33,7 +33,7 @@ bool arygon_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound); nfc_device *arygon_connect (const nfc_connstring connstring); -void arygon_disconnect (nfc_device *pnd); +void arygon_close (nfc_device *pnd); int arygon_tama_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); int arygon_tama_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szDat, int timeouta); diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index ec7e95a..7c4cad9 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -250,7 +250,7 @@ pn532_uart_connect (const nfc_connstring connstring) // Check communication using "Diagnose" command, with "Communication test" (0x00) if (pn53x_check_communication (pnd) < 0) { nfc_perror (pnd, "pn53x_check_communication"); - pn532_uart_disconnect (pnd); + pn532_uart_close (pnd); return NULL; } @@ -259,7 +259,7 @@ pn532_uart_connect (const nfc_connstring connstring) } void -pn532_uart_disconnect (nfc_device *pnd) +pn532_uart_close (nfc_device *pnd) { // Release UART port uart_close (DRIVER_DATA(pnd)->port); @@ -504,7 +504,7 @@ const struct nfc_driver pn532_uart_driver = { .name = PN532_UART_DRIVER_NAME, .probe = pn532_uart_probe, .connect = pn532_uart_connect, - .disconnect = pn532_uart_disconnect, + .close = pn532_uart_close, .strerror = pn53x_strerror, .initiator_init = pn53x_initiator_init, diff --git a/libnfc/drivers/pn532_uart.h b/libnfc/drivers/pn532_uart.h index 9f9f7c7..9b55347 100644 --- a/libnfc/drivers/pn532_uart.h +++ b/libnfc/drivers/pn532_uart.h @@ -32,7 +32,7 @@ bool pn532_uart_probe (nfc_connstring connstrings[], size_t connstrings_len, size_t *pszDeviceFound); nfc_device *pn532_uart_connect (const nfc_connstring connstring); -void pn532_uart_disconnect (nfc_device *pnd); +void pn532_uart_close (nfc_device *pnd); int pn532_uart_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); int pn532_uart_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout); diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 1873819..d42849e 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -479,7 +479,7 @@ error: } void -pn53x_usb_disconnect (nfc_device *pnd) +pn53x_usb_close (nfc_device *pnd) { pn53x_usb_ack (pnd); @@ -794,7 +794,7 @@ const struct nfc_driver pn53x_usb_driver = { .name = PN53X_USB_DRIVER_NAME, .probe = pn53x_usb_probe, .connect = pn53x_usb_connect, - .disconnect = pn53x_usb_disconnect, + .close = pn53x_usb_close, .strerror = pn53x_strerror, .initiator_init = pn53x_initiator_init, diff --git a/libnfc/drivers/pn53x_usb.h b/libnfc/drivers/pn53x_usb.h index 3f617a7..0827016 100644 --- a/libnfc/drivers/pn53x_usb.h +++ b/libnfc/drivers/pn53x_usb.h @@ -33,7 +33,7 @@ bool pn53x_usb_probe (nfc_connstring connstrings[], size_t connstrings_len, s nfc_device *pn53x_usb_connect (const nfc_connstring connstring); int pn53x_usb_send (nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout); int pn53x_usb_receive (nfc_device *pnd, uint8_t *pbtData, const size_t szData, int timeout); -void pn53x_usb_disconnect (nfc_device *pnd); +void pn53x_usb_close (nfc_device *pnd); extern const struct nfc_driver pn53x_usb_driver; diff --git a/libnfc/nfc-internal.h b/libnfc/nfc-internal.h index 04add92..76f2731 100644 --- a/libnfc/nfc-internal.h +++ b/libnfc/nfc-internal.h @@ -129,7 +129,7 @@ struct nfc_driver { const char *name; bool (*probe)(nfc_connstring connstrings[], size_t connstrings_len, size_t * pszDeviceFound); struct nfc_device *(*connect) (const nfc_connstring connstring); - void (*disconnect) (struct nfc_device *pnd); + void (*close) (struct nfc_device *pnd); const char *(*strerror) (const struct nfc_device *pnd); int (*initiator_init) (struct nfc_device *pnd); diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 2809577..d97a9e3 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -156,19 +156,19 @@ nfc_connect (const nfc_connstring connstring) } /** - * @brief Disconnect from a NFC device + * @brief Close from a NFC device * @param pnd \a nfc_device struct pointer that represent currently used device * - * Initiator's selected tag is disconnected and the device, including allocated \a nfc_device struct, is released. + * Initiator's selected tag is closed and the device, including allocated \a nfc_device struct, is released. */ void -nfc_disconnect (nfc_device *pnd) +nfc_close (nfc_device *pnd) { if (pnd) { // Go in idle mode nfc_idle (pnd); // Disconnect, clean up and release the device - pnd->driver->disconnect (pnd); + pnd->driver->close (pnd); log_fini (); } diff --git a/test/test_access_storm.c b/test/test_access_storm.c index 94a671a..b80b6d0 100644 --- a/test/test_access_storm.c +++ b/test/test_access_storm.c @@ -44,7 +44,7 @@ test_access_storm (void) res = nfc_initiator_list_passive_targets(device, nm, ant, MAX_TARGET_COUNT); cut_assert_operator_int (res, >=, 0, cut_message ("nfc_initiator_list_passive_targets")); - nfc_disconnect (device); + nfc_close (device); } n--; diff --git a/test/test_dep_active.c b/test/test_dep_active.c index 4a984fd..a419044 100644 --- a/test/test_dep_active.c +++ b/test/test_dep_active.c @@ -41,8 +41,8 @@ cut_setup (void) void cut_teardown (void) { - nfc_disconnect (devices[TARGET]); - nfc_disconnect (devices[INITIATOR]); + nfc_close (devices[TARGET]); + nfc_close (devices[INITIATOR]); } struct thread_data { diff --git a/test/test_dep_passive.c b/test/test_dep_passive.c index b300594..6e55200 100644 --- a/test/test_dep_passive.c +++ b/test/test_dep_passive.c @@ -40,8 +40,8 @@ cut_setup (void) void cut_teardown (void) { - nfc_disconnect (devices[TARGET]); - nfc_disconnect (devices[INITIATOR]); + nfc_close (devices[TARGET]); + nfc_close (devices[INITIATOR]); } struct thread_data { diff --git a/test/test_device_modes_as_dep.c b/test/test_device_modes_as_dep.c index 5ac9ce5..3f5a297 100644 --- a/test/test_device_modes_as_dep.c +++ b/test/test_device_modes_as_dep.c @@ -38,8 +38,8 @@ cut_setup (void) void cut_teardown (void) { - nfc_disconnect (second_device); - nfc_disconnect (first_device); + nfc_close (second_device); + nfc_close (first_device); } struct thread_data { diff --git a/test/test_register_access.c b/test/test_register_access.c index bf72375..aa37994 100644 --- a/test/test_register_access.c +++ b/test/test_register_access.c @@ -41,5 +41,5 @@ test_register_endianness (void) cut_assert_equal_int (0, res, cut_message ("read register value")); cut_assert_equal_uint (0x55, value, cut_message ("check register value")); - nfc_disconnect (device); + nfc_close (device); } diff --git a/test/test_register_endianness.c b/test/test_register_endianness.c index b82b9fb..6c7ce7e 100644 --- a/test/test_register_endianness.c +++ b/test/test_register_endianness.c @@ -32,5 +32,5 @@ test_register_endianness (void) res = pn53x_read_register (device, 0xFFF0, &value); cut_assert_equal_int (0, res, cut_message ("read register 0xFFF0")); - nfc_disconnect (device); + nfc_close (device); } diff --git a/utils/nfc-emulate-forum-tag4.c b/utils/nfc-emulate-forum-tag4.c index 8f633f7..321b601 100644 --- a/utils/nfc-emulate-forum-tag4.c +++ b/utils/nfc-emulate-forum-tag4.c @@ -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))) { diff --git a/utils/nfc-list.c b/utils/nfc-list.c index d8acd07..48c2466 100644 --- a/utils/nfc-list.c +++ b/utils/nfc-list.c @@ -247,7 +247,7 @@ main (int argc, const char *argv[]) printf("\n"); } } - nfc_disconnect (pnd); + nfc_close (pnd); } return 0; diff --git a/utils/nfc-mfclassic.c b/utils/nfc-mfclassic.c index 94d939b..91efcd4 100644 --- a/utils/nfc-mfclassic.c +++ b/utils/nfc-mfclassic.c @@ -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:{ diff --git a/utils/nfc-mfsetuid.c b/utils/nfc-mfsetuid.c index 7927536..7304b27 100644 --- a/utils/nfc-mfsetuid.c +++ b/utils/nfc-mfsetuid.c @@ -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; } diff --git a/utils/nfc-mfultralight.c b/utils/nfc-mfultralight.c index 8bc32a7..e37646a 100644 --- a/utils/nfc-mfultralight.c +++ b/utils/nfc-mfultralight.c @@ -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; } diff --git a/utils/nfc-read-forum-tag3.c b/utils/nfc-read-forum-tag3.c index 69af3d5..6eda7da 100644 --- a/utils/nfc-read-forum-tag3.c +++ b/utils/nfc-read-forum-tag3.c @@ -313,7 +313,7 @@ main(int argc, char *argv[]) error: fclose (ndef_stream); if (pnd) { - nfc_disconnect (pnd); + nfc_close (pnd); } exit (error); } diff --git a/utils/nfc-relay-picc.c b/utils/nfc-relay-picc.c index 932ad84..4dcf884 100644 --- a/utils/nfc-relay-picc.c +++ b/utils/nfc-relay-picc.c @@ -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); }