From 26865bbc19b4afba9520de95a279ffeaa9e4b01e Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Tue, 29 May 2012 00:33:22 +0000 Subject: [PATCH] Remove extra whitespaces/tabs before EOL. find . -name '*.[ch]' | xargs perl -pi -e 's/\t+$//; s/ +$//' Thanks to Ludovic. --- contrib/win32/sys/select.h | 6 +- contrib/win32/unistd.h | 6 +- contrib/windows.h | 8 +-- examples/doc/quick_start_example1.c | 6 +- examples/nfc-anticol.c | 14 ++--- examples/nfc-dep-initiator.c | 10 +-- examples/nfc-dep-target.c | 8 +-- examples/nfc-emulate-forum-tag2.c | 18 +++--- examples/nfc-emulate-tag.c | 14 ++--- examples/nfc-emulate-uid.c | 12 ++-- examples/nfc-mfsetuid.c | 14 ++--- examples/nfc-poll.c | 12 ++-- examples/nfc-relay.c | 18 +++--- examples/pn53x-diagnose.c | 14 ++--- examples/pn53x-sam.c | 12 ++-- examples/pn53x-tamashell.c | 12 ++-- include/nfc/nfc-emulation.h | 8 +-- include/nfc/nfc-types.h | 12 ++-- include/nfc/nfc.h | 28 ++++----- libnfc/buses/uart.c | 6 +- libnfc/buses/uart.h | 6 +- libnfc/buses/uart_posix.c | 12 ++-- libnfc/buses/uart_win32.c | 10 +-- libnfc/chips/pn53x-internal.h | 18 +++--- libnfc/chips/pn53x.c | 68 ++++++++++---------- libnfc/chips/pn53x.h | 16 ++--- libnfc/drivers.h | 6 +- libnfc/drivers/acr122_pcsc.c | 8 +-- libnfc/drivers/acr122_pcsc.h | 10 +-- libnfc/drivers/acr122_usb.c | 10 +-- libnfc/drivers/acr122_usb.h | 10 +-- libnfc/drivers/acr122s.c | 12 ++-- libnfc/drivers/arygon.c | 14 ++--- libnfc/drivers/arygon.h | 10 +-- libnfc/drivers/pn532_uart.c | 8 +-- libnfc/drivers/pn532_uart.h | 10 +-- libnfc/drivers/pn53x_usb.c | 14 ++--- libnfc/drivers/pn53x_usb.h | 10 +-- libnfc/iso14443-subr.c | 50 +++++++-------- libnfc/iso7816.h | 6 +- libnfc/log.h | 6 +- libnfc/mirror-subr.c | 6 +- libnfc/mirror-subr.h | 10 +-- libnfc/nfc-device.c | 6 +- libnfc/nfc-emulation.c | 6 +- libnfc/nfc-internal.c | 8 +-- libnfc/nfc-internal.h | 8 +-- libnfc/nfc.c | 90 +++++++++++++-------------- test/test_access_storm.c | 2 +- test/test_dep_active.c | 12 ++-- test/test_dep_passive.c | 16 ++--- test/test_device_modes_as_dep.c | 22 +++---- test/test_register_access.c | 2 +- test/test_register_endianness.c | 2 +- utils/mifare.c | 12 ++-- utils/mifare.h | 8 +-- utils/nfc-emulate-forum-tag4.c | 14 ++--- utils/nfc-list.c | 12 ++-- utils/nfc-mfclassic.c | 14 ++--- utils/nfc-mfultralight.c | 14 ++--- utils/nfc-probe.c | 10 +-- utils/nfc-read-forum-tag3.c | 96 ++++++++++++++--------------- utils/nfc-relay-picc.c | 14 ++--- utils/nfc-utils.c | 8 +-- utils/nfc-utils.h | 8 +-- windows/usb/include/usb.h | 14 ++--- 66 files changed, 483 insertions(+), 483 deletions(-) diff --git a/contrib/win32/sys/select.h b/contrib/win32/sys/select.h index 2f29770..d339c78 100644 --- a/contrib/win32/sys/select.h +++ b/contrib/win32/sys/select.h @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/contrib/win32/unistd.h b/contrib/win32/unistd.h index 52250f8..83207f5 100644 --- a/contrib/win32/unistd.h +++ b/contrib/win32/unistd.h @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/contrib/windows.h b/contrib/windows.h index 02ca926..1af76f4 100644 --- a/contrib/windows.h +++ b/contrib/windows.h @@ -1,14 +1,14 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2010, Romuald Conty * Copyright (C) 2011, Glenn Ergeerts - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -18,7 +18,7 @@ * along with this program. If not, see */ -/** +/** * @file windows.h * @brief Provide some windows related hacks due to lack of POSIX compat */ diff --git a/examples/doc/quick_start_example1.c b/examples/doc/quick_start_example1.c index bc5663f..83e0539 100644 --- a/examples/doc/quick_start_example1.c +++ b/examples/doc/quick_start_example1.c @@ -1,4 +1,4 @@ -/** +/** * @file quick_start_example1.c * @brief Quick start example that presents how to use libnfc */ @@ -18,7 +18,7 @@ main (int argc, const char *argv[]) { nfc_device *pnd; nfc_target nt; - + nfc_init (NULL); // Display libnfc version @@ -35,7 +35,7 @@ main (int argc, const char *argv[]) // Set opened NFC device to initiator mode if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } printf ("NFC reader: %s opened\n", nfc_device_get_name (pnd)); diff --git a/examples/nfc-anticol.c b/examples/nfc-anticol.c index 9a947c6..e299121 100644 --- a/examples/nfc-anticol.c +++ b/examples/nfc-anticol.c @@ -1,12 +1,12 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -22,12 +22,12 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ -/** +/** * @file nfc-anticol.c * @brief Generates one ISO14443-A anti-collision process "by-hand" */ @@ -150,7 +150,7 @@ main (int argc, char *argv[]) } nfc_init (NULL); - + // Try to open the NFC reader pnd = nfc_open (NULL, NULL); @@ -162,7 +162,7 @@ main (int argc, char *argv[]) // Initialise NFC device as "initiator" if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } // Configure the CRC diff --git a/examples/nfc-dep-initiator.c b/examples/nfc-dep-initiator.c index 0bc622f..1a12c3a 100644 --- a/examples/nfc-dep-initiator.c +++ b/examples/nfc-dep-initiator.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -70,7 +70,7 @@ main (int argc, const char *argv[]) printf ("Usage: %s\n", argv[0]); return EXIT_FAILURE; } - + nfc_init (NULL); pnd = nfc_open (NULL, NULL); diff --git a/examples/nfc-dep-target.c b/examples/nfc-dep-target.c index 37440f6..ecbbd3c 100644 --- a/examples/nfc-dep-target.c +++ b/examples/nfc-dep-target.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ diff --git a/examples/nfc-emulate-forum-tag2.c b/examples/nfc-emulate-forum-tag2.c index 4e3a25f..621833c 100644 --- a/examples/nfc-emulate-forum-tag2.c +++ b/examples/nfc-emulate-forum-tag2.c @@ -1,12 +1,12 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2011, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -22,7 +22,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -31,7 +31,7 @@ * @file nfc-emulate-forum-tag2.c * @brief Emulates a NFC Forum Tag Type 2 with a NDEF message * This example allow to emulate an NFC Forum Tag Type 2 that contains a read-only NDEF message. - * + * * It have been developed using PN533 USB hardware as target and Google Nexus S phone as initiator. * * This is know to NOT work with Nokia 6212 Classic and could not work with @@ -51,8 +51,8 @@ * NFC Forum Type 2 Tag Operation * Technical Specification * NFCForum-TS-Type-2-Tag_1.0 - 2007-07-09 - * - * ISO/IEC 14443-3 + * + * ISO/IEC 14443-3 * First edition - 2001-02-01 * Identification cards — Contactless integrated circuit(s) cards — Proximity cards * Part 3: Initialization and anticollision @@ -86,7 +86,7 @@ stop_emulation (int sig) static uint8_t __nfcforum_tag2_memory_area[] = { 0x00, 0x00, 0x00, 0x00, // Block 0 - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, // Block 2 (Static lock bytes: CC area and data area are read-only locked) 0xE1, 0x10, 0x06, 0x0F, // Block 3 (CC - NFC-Forum Tag Type 2 version 1.0, Data area (from block 4 to the end) is 48 bytes, Read-only mode) @@ -182,7 +182,7 @@ main(int argc, char *argv[]) }; signal (SIGINT, stop_emulation); - nfc_init (NULL); + nfc_init (NULL); pnd = nfc_open (NULL, NULL); if (pnd == NULL) { diff --git a/examples/nfc-emulate-tag.c b/examples/nfc-emulate-tag.c index 803f017..62e30a7 100644 --- a/examples/nfc-emulate-tag.c +++ b/examples/nfc-emulate-tag.c @@ -1,12 +1,12 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -22,7 +22,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -66,13 +66,13 @@ intr_hdlr (int sig) (void) sig; printf ("\nQuitting...\n"); if (pnd != NULL) { - nfc_close(pnd); + nfc_close(pnd); } nfc_exit (NULL); exit (EXIT_FAILURE); } -static bool +static bool target_io( nfc_target *pnt, const uint8_t *pbtInput, const size_t szInput, uint8_t *pbtOutput, size_t *pszOutput ) { bool loop = true; @@ -182,7 +182,7 @@ main (int argc, char *argv[]) #endif nfc_init (NULL); - + // Try to open the NFC reader pnd = nfc_open (NULL, NULL); diff --git a/examples/nfc-emulate-uid.c b/examples/nfc-emulate-uid.c index e15c868..93ee0f5 100644 --- a/examples/nfc-emulate-uid.c +++ b/examples/nfc-emulate-uid.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -31,7 +31,7 @@ /** * @file nfc-emulate-uid.c * @brief Emulates a tag which which have a "really" custom UID - * + * * NFC devices are able to emulate passive tags but manufacturers restrict the * customization of UID. With PN53x, UID is only 4-byte long and the first * byte of emulated UID is hard-wired to 0x08 which is the standard way to say @@ -127,7 +127,7 @@ main (int argc, char *argv[]) #endif nfc_init (NULL); - + // Try to open the NFC device pnd = nfc_open (NULL, NULL); diff --git a/examples/nfc-mfsetuid.c b/examples/nfc-mfsetuid.c index 137445e..0fa64f7 100644 --- a/examples/nfc-mfsetuid.c +++ b/examples/nfc-mfsetuid.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2011, Adam Laurie - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,12 +23,12 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ -/** +/** * @file nfc-mfsetuid.c * @brief Set UID of special Mifare cards */ @@ -178,7 +178,7 @@ main (int argc, char *argv[]) } nfc_init (NULL); - + // Try to open the NFC reader pnd = nfc_open (NULL, NULL); @@ -190,7 +190,7 @@ main (int argc, char *argv[]) // Initialise NFC device as "initiator" if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } // Configure the CRC diff --git a/examples/nfc-poll.c b/examples/nfc-poll.c index c9f95f4..94bf7ae 100644 --- a/examples/nfc-poll.c +++ b/examples/nfc-poll.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2010, Romuald Conty * Copyright (C) 2011, Romain Tartiere, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -102,7 +102,7 @@ main (int argc, const char *argv[]) nfc_target nt; int res = 0; - + nfc_init (NULL); pnd = nfc_open (NULL, NULL); @@ -114,7 +114,7 @@ main (int argc, const char *argv[]) if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } printf ("NFC reader: %s opened\n", nfc_device_get_name (pnd)); diff --git a/examples/nfc-relay.c b/examples/nfc-relay.c index 760d6a9..77ee043 100644 --- a/examples/nfc-relay.c +++ b/examples/nfc-relay.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -116,9 +116,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 (NULL); - + // Try to open the NFC emulator device pndTag = nfc_open (NULL, connstrings[0]); if (pndTag == NULL) { @@ -168,10 +168,10 @@ main (int argc, char *argv[]) printf ("NFC reader device: %s opened", nfc_device_get_name (pndReader)); printf ("%s", "Configuring NFC reader settings..."); - + if (nfc_initiator_init (pndReader) < 0) { nfc_perror (pndReader, "nfc_initiator_init"); - exit (EXIT_FAILURE); + 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) || @@ -220,7 +220,7 @@ main (int argc, char *argv[]) } } - nfc_close (pndTag); + nfc_close (pndTag); nfc_close (pndReader); nfc_exit (NULL); exit (EXIT_SUCCESS); diff --git a/examples/pn53x-diagnose.c b/examples/pn53x-diagnose.c index 9cbe906..820258e 100644 --- a/examples/pn53x-diagnose.c +++ b/examples/pn53x-diagnose.c @@ -1,12 +1,12 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -22,12 +22,12 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ -/** +/** * @file pn53x-diagnose.c * @brief Small application to diagnose PN53x using dedicated commands */ @@ -67,9 +67,9 @@ main (int argc, const char *argv[]) if (argc > 1) { errx (1, "usage: %s", argv[0]); } - + nfc_init (NULL); - + // Display libnfc version acLibnfcVersion = nfc_version (); printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion); diff --git a/examples/pn53x-sam.c b/examples/pn53x-sam.c index 0f5c4ce..4a8e24d 100644 --- a/examples/pn53x-sam.c +++ b/examples/pn53x-sam.c @@ -1,12 +1,12 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2010, Emanuele Bertoldi - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -22,7 +22,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -74,11 +74,11 @@ main (int argc, const char *argv[]) { (void) argc; (void) argv; - + int ret = EXIT_FAILURE; nfc_init (NULL); - + // Display libnfc version const char *acLibnfcVersion = nfc_version (); printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion); diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index c545e0c..8e8e496 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -1,12 +1,12 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -22,7 +22,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -84,7 +84,7 @@ int main(int argc, const char* argv[]) } nfc_init (NULL); - + // Try to open the NFC reader pnd = nfc_open(NULL, NULL); @@ -96,7 +96,7 @@ int main(int argc, const char* argv[]) printf ("NFC reader: %s opened\n", nfc_device_get_name (pnd)); if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } char *cmd; diff --git a/include/nfc/nfc-emulation.h b/include/nfc/nfc-emulation.h index da4f565..ed67dd4 100644 --- a/include/nfc/nfc-emulation.h +++ b/include/nfc/nfc-emulation.h @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -17,7 +17,7 @@ * along with this program. If not, see */ -/** +/** * @file nfc-emulation.h * @brief Provide a small API to ease emulation in libnfc */ diff --git a/include/nfc/nfc-types.h b/include/nfc/nfc-types.h index c13850e..6e41698 100644 --- a/include/nfc/nfc-types.h +++ b/include/nfc/nfc-types.h @@ -1,15 +1,15 @@ /** * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romain Tartière, Romuald Conty * Copyright (C) 2011, Romain Tartière, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -19,7 +19,7 @@ * along with this program. If not, see */ -/** +/** * @file nfc-types.h * @brief Define NFC types */ @@ -48,13 +48,13 @@ typedef char nfc_connstring[1024]; * Properties */ typedef enum { -/** +/** * Default command processing timeout * Property value's (duration) unit is ms and 0 means no timeout (infinite). * Default value is set by driver layer */ NP_TIMEOUT_COMMAND, -/** +/** * Timeout between ATR_REQ and ATR_RES * When the device is in initiator mode, a target is considered as mute if no * valid ATR_RES is received within this timeout value. diff --git a/include/nfc/nfc.h b/include/nfc/nfc.h index 61e3b93..eb2456d 100644 --- a/include/nfc/nfc.h +++ b/include/nfc/nfc.h @@ -1,14 +1,14 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -137,47 +137,47 @@ extern "C" { #define NFC_EIO -1 /** @ingroup error * @hideinitializer - * Invalid argument(s) + * Invalid argument(s) */ #define NFC_EINVARG -2 /** @ingroup error * @hideinitializer - * Operation not supported by device + * Operation not supported by device */ #define NFC_EDEVNOTSUPP -3 /** @ingroup error * @hideinitializer - * No such device + * No such device */ #define NFC_ENOTSUCHDEV -4 /** @ingroup error * @hideinitializer - * Buffer overflow + * Buffer overflow */ #define NFC_EOVFLOW -5 /** @ingroup error * @hideinitializer - * Operation timed out + * Operation timed out */ #define NFC_ETIMEOUT -6 /** @ingroup error * @hideinitializer - * Operation aborted (by user) + * Operation aborted (by user) */ #define NFC_EOPABORTED -7 /** @ingroup error * @hideinitializer - * Not (yet) implemented + * Not (yet) implemented */ #define NFC_ENOTIMPL -8 /** @ingroup error * @hideinitializer - * Target released + * Target released */ -#define NFC_ETGRELEASED -10 +#define NFC_ETGRELEASED -10 /** @ingroup error * @hideinitializer - * Error while RF transmission + * Error while RF transmission */ #define NFC_ERFTRANS -20 /** @ingroup error @@ -187,7 +187,7 @@ extern "C" { #define NFC_ESOFT -80 /** @ingroup error * @hideinitializer - * Device's internal chip error + * Device's internal chip error */ #define NFC_ECHIP -90 diff --git a/libnfc/buses/uart.c b/libnfc/buses/uart.c index 7ea73da..eead562 100644 --- a/libnfc/buses/uart.c +++ b/libnfc/buses/uart.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, 2010, Roel Verdult, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/libnfc/buses/uart.h b/libnfc/buses/uart.h index 728d998..3a2a805 100644 --- a/libnfc/buses/uart.h +++ b/libnfc/buses/uart.h @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult, Romuald Conty * Copyright (C) 2010, Roel Verdult, Romuald Conty * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/libnfc/buses/uart_posix.c b/libnfc/buses/uart_posix.c index c319880..d14fdea 100644 --- a/libnfc/buses/uart_posix.c +++ b/libnfc/buses/uart_posix.c @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, 2010, Roel Verdult, Romuald Conty * Copyright (C) 2010, Roel Verdult, Romuald Conty * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -138,7 +138,7 @@ void uart_set_speed (serial_port sp, const uint32_t uiPortSpeed) { log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Serial port speed requested to be set to %d bauds.", uiPortSpeed); - + // Portability note: on some systems, B9600 != 9600 so we have to do // uint32_t <=> speed_t associations by hand. speed_t stPortSpeed = B9600; @@ -352,13 +352,13 @@ uart_list_ports (void) char **res2 = realloc (res, (szRes+1) * sizeof (char *)); if (!res2) goto oom; - + res = res2; if (!(res[szRes-1] = malloc (6 + strlen (pdDirEnt->d_name)))) goto oom; sprintf (res[szRes-1], "/dev/%s", pdDirEnt->d_name); - + szRes++; res[szRes-1] = NULL; } diff --git a/libnfc/buses/uart_win32.c b/libnfc/buses/uart_win32.c index 68d1484..5e3bafa 100644 --- a/libnfc/buses/uart_win32.c +++ b/libnfc/buses/uart_win32.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, 2010, Roel Verdult, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -167,7 +167,7 @@ uart_receive (serial_port sp, uint8_t * pbtRx, const size_t szRx, void * abort_p do { log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "ReadFile"); res = ReadFile (((struct serial_port_windows *) sp)->hPort, pbtRx + dwTotalBytesReceived, - dwBytesToGet, + dwBytesToGet, &dwBytesReceived, NULL); dwTotalBytesReceived += dwBytesReceived; @@ -179,7 +179,7 @@ uart_receive (serial_port sp, uint8_t * pbtRx, const size_t szRx, void * abort_p } else if (dwBytesReceived == 0) { return NFC_ETIMEOUT; } - + if (((DWORD)szRx) > dwTotalBytesReceived) { dwBytesToGet -= dwBytesReceived; } diff --git a/libnfc/chips/pn53x-internal.h b/libnfc/chips/pn53x-internal.h index adc13bd..56c6d9b 100644 --- a/libnfc/chips/pn53x-internal.h +++ b/libnfc/chips/pn53x-internal.h @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -74,21 +74,21 @@ #define TgGetTargetStatus 0x8A /** @note PN53x's normal frame: - * + * * .-- Start * | .-- Packet length * | | .-- Length checksum * | | | .-- Direction (D4 Host to PN, D5 PN to Host) * | | | | .-- Code * | | | | | .-- Packet checksum - * | | | | | | .-- Postamble + * | | | | | | .-- Postamble * V | | | | | | * ----- V V V V V V * 00 FF 02 FE D4 02 2A 00 */ /** @note PN53x's extended frame: - * + * * .-- Start * | .-- Fixed to FF to enable extended frame * | | .-- Packet length @@ -96,13 +96,13 @@ * | | | | .-- Direction (D4 Host to PN, D5 PN to Host) * | | | | | .-- Code * | | | | | | .-- Packet checksum - * | | | | | | | .-- Postamble + * | | | | | | | .-- Postamble * V V V | | | | | * ----- ----- ----- V V V V V * 00 FF FF FF 00 02 FE D4 02 2A 00 */ -/** +/** * Start bytes, packet length, length checksum, direction, packet checksum and postamble are overhead */ // The TFI is considered part of the overhead @@ -156,7 +156,7 @@ static const pn53x_command pn53x_commands[] = { PNCMD( SAMConfiguration, PN531|PN532 ), PNCMD( PowerDown, PN531|PN532 ), PNCMD( AlparCommandForTDA, PN533|RCS360 ), // Has another usage on RC-S360... - + // RF communication PNCMD( RFConfiguration, PN531|PN532|PN533|RCS360 ), PNCMD( RFRegulationTest, PN531|PN532|PN533 ), diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 4bad8ea..0e9e593 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult, Romuald Conty * Copyright (C) 2010, Roel Verdult, Romuald Conty, Romain Tartière * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -80,11 +80,11 @@ pn53x_init(struct nfc_device *pnd) nbSupportedModulation++; CHIP_DATA(pnd)->supported_modulation_as_initiator[nbSupportedModulation] = NMT_FELICA; nbSupportedModulation++; - } + } if (pnd->btSupportByte & SUPPORT_ISO14443B) { CHIP_DATA(pnd)->supported_modulation_as_initiator[nbSupportedModulation] = NMT_ISO14443B; nbSupportedModulation++; - } + } if(CHIP_DATA(pnd)->type != PN531) { CHIP_DATA(pnd)->supported_modulation_as_initiator[nbSupportedModulation] = NMT_JEWEL; nbSupportedModulation++; @@ -93,11 +93,11 @@ pn53x_init(struct nfc_device *pnd) nbSupportedModulation++; CHIP_DATA(pnd)->supported_modulation_as_initiator[nbSupportedModulation] = 0; } - + if (!CHIP_DATA(pnd)->supported_modulation_as_target) { CHIP_DATA(pnd)->supported_modulation_as_target = (nfc_modulation_type*) pn53x_supported_modulation_as_target; } - + // CRC handling should be enabled by default as declared in nfc_device_new // which is the case by default for pn53x, so nothing to do here // Parity handling should be enabled by default as declared in nfc_device_new @@ -488,7 +488,7 @@ pn53x_decode_target_data (const uint8_t *pbtRawData, size_t szRawData, pn53x_typ case NMT_ISO14443BI: // Skip V & T Addresses pbtRawData++; - if (*pbtRawData != 0x07) { // 0x07 = REPGEN + if (*pbtRawData != 0x07) { // 0x07 = REPGEN return NFC_ECHIP; } pbtRawData++; @@ -757,7 +757,7 @@ pn53x_int_to_timeout (const int ms) return res; } -int +int pn53x_set_property_int (struct nfc_device *pnd, const nfc_property property, const int value) { switch (property) { @@ -846,7 +846,7 @@ pn53x_set_property_bool (struct nfc_device *pnd, const nfc_property property, co // TODO Made some research around this point: // timings could be tweak better than this, and maybe we can tweak timings // to "gain" a sort-of hardware polling (ie. like PN532 does) - if (pn53x_RFConfiguration__MaxRetries (pnd, + if (pn53x_RFConfiguration__MaxRetries (pnd, (bEnable) ? 0xff : 0x00, // MxRtyATR, default: active = 0xff, passive = 0x02 (bEnable) ? 0xff : 0x01, // MxRtyPSL, default: 0x01 (bEnable) ? 0xff : 0x02 // MxRtyPassiveActivation, default: 0xff (0x00 leads to problems with PN531) @@ -984,7 +984,7 @@ pn53x_check_communication (struct nfc_device *pnd) szRx = (size_t) res; if ((sizeof(abtExpectedRx) == szRx) && (0 == memcmp (abtRx, abtExpectedRx, sizeof(abtExpectedRx)))) return NFC_SUCCESS; - + return NFC_EIO; } @@ -1051,7 +1051,7 @@ pn53x_initiator_select_passive_target_ext (struct nfc_device *pnd, const uint8_t abtReqt[]= { 0x10 }; // Getting product code / fab code & store it in output buffer after the serial nr we'll obtain later if ((res = pn53x_initiator_transceive_bytes (pnd, abtReqt, sizeof(abtReqt), abtTargetsData+2, sizeof(abtTargetsData)-2, timeout)) < 0) { - return res; + return res; } szTargetsData = (size_t)res; } @@ -1123,7 +1123,7 @@ pn53x_initiator_poll_target (struct nfc_device *pnd, nfc_target *pnt) { int res = 0; - + if (CHIP_DATA(pnd)->type == PN532) { size_t szTargetTypes = 0; pn53x_target_type apttTargetTypes[32]; @@ -1167,7 +1167,7 @@ pn53x_initiator_poll_target (struct nfc_device *pnd, size_t szInitiatorData; prepare_initiator_data (pnmModulations[n], &pbtInitiatorData, &szInitiatorData); const int timeout_ms = uiPeriod * 150; - + if ((res = pn53x_initiator_select_passive_target_ext (pnd, pnmModulations[n], pbtInitiatorData, szInitiatorData, pnt, timeout_ms)) < 0) { if (pnd->last_error != NFC_ETIMEOUT) { return pnd->last_error; @@ -1631,7 +1631,7 @@ pn53x_initiator_deselect_target (struct nfc_device *pnd) return pn53x_InDeselect (pnd, 0); // 0 mean deselect all selected targets } -int +int pn53x_initiator_target_is_present (struct nfc_device *pnd, const nfc_target nt) { // TODO Check if nt is equal to current target @@ -1786,7 +1786,7 @@ pn53x_target_init (struct nfc_device *pnd, nfc_target *pnt, uint8_t *pbtRx, cons // Set System Code abtFeliCaParams[16] = 0x0f; abtFeliCaParams[17] = 0xab; - + pbtFeliCaParams = abtFeliCaParams; break; case NMT_ISO14443B: @@ -1884,7 +1884,7 @@ pn53x_target_receive_bits (struct nfc_device *pnd, uint8_t *pbtRx, const size_t uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN]; size_t szRx = sizeof (abtRx); int res = 0; - + // Try to gather a received frame from the reader if ((res = pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), abtRx, szRx, -1)) < 0) return res; @@ -2048,7 +2048,7 @@ pn53x_target_send_bytes (struct nfc_device *pnd, const uint8_t *pbtTx, const siz return pnd->last_error; } } - // NO BREAK + // NO BREAK case NMT_JEWEL: case NMT_ISO14443B: case NMT_ISO14443BI: @@ -2064,7 +2064,7 @@ pn53x_target_send_bytes (struct nfc_device *pnd, const uint8_t *pbtTx, const siz // Copy the data into the command frame memcpy (abtCmd + 1, pbtTx, szTx); - + // Try to send the bits to the reader if ((res = pn53x_transceive (pnd, abtCmd, szTx + 1, NULL, 0, timeout)) < 0) return res; @@ -2565,7 +2565,7 @@ pn53x_TgInitAsTarget (struct nfc_device *pnd, pn53x_target_mode ptm, return res; szRx = (size_t) res; - // Note: the first byte is skip: + // Note: the first byte is skip: // its the "mode" byte which contains baudrate, DEP and Framing type (Mifare, active or FeliCa) datas. if(pbtModeByte) { *pbtModeByte = abtRx[0]; @@ -2573,7 +2573,7 @@ pn53x_TgInitAsTarget (struct nfc_device *pnd, pn53x_target_mode ptm, // Save the received byte count szRx -= 1; - + if ((szRx - 1) > szRxLen) return NFC_EOVFLOW; // Copy the received bytes @@ -2831,7 +2831,7 @@ pn53x_nm_to_ptt(const nfc_modulation nm) return PTT_UNDEFINED; } -int +int pn53x_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type * *const supported_mt) { switch (mode) { @@ -2841,7 +2841,7 @@ pn53x_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_m case N_INITIATOR: *supported_mt = CHIP_DATA(pnd)->supported_modulation_as_initiator; break; - default: + default: return NFC_EINVARG; } return NFC_SUCCESS; @@ -2849,12 +2849,12 @@ pn53x_get_supported_modulation(nfc_device *pnd, const nfc_mode mode, const nfc_m int pn53x_get_supported_baud_rate (nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate * *const supported_br) -{ +{ switch (nmt) { - case NMT_FELICA: + case NMT_FELICA: *supported_br = (nfc_baud_rate*)pn53x_felica_supported_baud_rates; break; - case NMT_ISO14443A: + case NMT_ISO14443A: *supported_br = (nfc_baud_rate*)pn53x_iso14443a_supported_baud_rates; break; case NMT_ISO14443B: @@ -2872,7 +2872,7 @@ pn53x_get_supported_baud_rate (nfc_device *pnd, const nfc_modulation_type nmt, c case NMT_JEWEL: *supported_br = (nfc_baud_rate*)pn53x_jewel_supported_baud_rates; break; - case NMT_DEP: + case NMT_DEP: *supported_br = (nfc_baud_rate*)pn53x_dep_supported_baud_rates; break; default: @@ -2906,7 +2906,7 @@ pn53x_get_information_about (nfc_device *pnd, char *buf, size_t buflen) if ((res = nfc_device_get_supported_modulation(pnd, N_INITIATOR, &nmt)) < 0) { return res; } - + for (int i=0; nmt[i]; i++) { if ((res = snprintf (buf, buflen, "%s%s (", (i==0)?"":", ", str_nfc_modulation_type (nmt[i]))) < 0) { return NFC_ESOFT; @@ -2920,7 +2920,7 @@ pn53x_get_information_about (nfc_device *pnd, char *buf, size_t buflen) if ((res = nfc_device_get_supported_baud_rate (pnd, nmt[i], &nbr)) < 0) { return res; } - + for (int j=0; nbr[j]; j++) { if ((res = snprintf (buf, buflen, "%s%s", (j==0)?"":", ", str_nfc_baud_rate (nbr[j]))) < 0) { return NFC_ESOFT; @@ -2960,7 +2960,7 @@ pn53x_get_information_about (nfc_device *pnd, char *buf, size_t buflen) if ((res = nfc_device_get_supported_modulation(pnd, N_TARGET, &nmt)) < 0) { return res; } - + for (int i=0; nmt[i]; i++) { if ((res = snprintf (buf, buflen, "%s%s (", (i==0)?"":", ", str_nfc_modulation_type (nmt[i]))) < 0) { return NFC_ESOFT; @@ -2974,7 +2974,7 @@ pn53x_get_information_about (nfc_device *pnd, char *buf, size_t buflen) if ((res = nfc_device_get_supported_baud_rate (pnd, nmt[i], &nbr)) < 0) { return res; } - + for (int j=0; nbr[j]; j++) { if ((res = snprintf (buf, buflen, "%s%s", (j==0)?"":", ", str_nfc_baud_rate (nbr[j]))) < 0) { return NFC_ESOFT; @@ -3043,10 +3043,10 @@ pn53x_data_new (struct nfc_device *pnd, const struct pn53x_io *io) // Set default communication timeout (52 ms) CHIP_DATA (pnd)->timeout_communication = 52; - + CHIP_DATA (pnd)->supported_modulation_as_initiator = NULL; - - CHIP_DATA (pnd)->supported_modulation_as_target = NULL; + + CHIP_DATA (pnd)->supported_modulation_as_target = NULL; } void diff --git a/libnfc/chips/pn53x.h b/libnfc/chips/pn53x.h index c16a01c..9827860 100644 --- a/libnfc/chips/pn53x.h +++ b/libnfc/chips/pn53x.h @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult, Romuald Conty * Copyright (C) 2010, Roel Verdult, Romuald Conty, Romain Tartière * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -19,7 +19,7 @@ * along with this program. If not, see */ -/** +/** * @file pn53x.h * @brief PN531, PN532 and PN533 common functions */ @@ -189,8 +189,8 @@ struct pn53x_data { int timeout_atr; /** Communication timeout */ int timeout_communication; -/** Supported modulation type */ - nfc_modulation_type *supported_modulation_as_initiator; +/** Supported modulation type */ + nfc_modulation_type *supported_modulation_as_initiator; nfc_modulation_type *supported_modulation_as_target; }; @@ -210,7 +210,7 @@ typedef enum { /** JIS X 6319-4 (Sony Felica) http://en.wikipedia.org/wiki/FeliCa */ PM_FELICA_424 = 0x02, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531) */ - PM_ISO14443B_106 = 0x03, + PM_ISO14443B_106 = 0x03, /** Jewel Topaz (Innovision Research & Development) (Not supported by PN531) */ PM_JEWEL_106 = 0x04, /** ISO14443-B http://en.wikipedia.org/wiki/ISO/IEC_14443 (Not supported by PN531 nor PN532) */ @@ -322,7 +322,7 @@ int pn53x_initiator_poll_target (struct nfc_device *pnd, nfc_target *pnt); int pn53x_initiator_select_dep_target (struct nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, - const nfc_dep_info *pndiInitiator, + const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout); int pn53x_initiator_transceive_bits (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits, diff --git a/libnfc/drivers.h b/libnfc/drivers.h index e43c99f..b987394 100644 --- a/libnfc/drivers.h +++ b/libnfc/drivers.h @@ -1,14 +1,14 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/libnfc/drivers/acr122_pcsc.c b/libnfc/drivers/acr122_pcsc.c index b3dfa33..adb1c88 100644 --- a/libnfc/drivers/acr122_pcsc.c +++ b/libnfc/drivers/acr122_pcsc.c @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2011, Romain Tartiere, Romuald Conty * Copyright (C) 2012, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -282,7 +282,7 @@ acr122_pcsc_open (const nfc_connstring connstring) pn53x_data_new (pnd, &acr122_pcsc_io); SCARDCONTEXT *pscc; - + log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Attempt to open %s", ndd.pcsc_device_name); // Test if context succeeded if (!(pscc = acr122_pcsc_get_scardcontext ())) diff --git a/libnfc/drivers/acr122_pcsc.h b/libnfc/drivers/acr122_pcsc.h index 3caf3a0..fe9ae1a 100644 --- a/libnfc/drivers/acr122_pcsc.h +++ b/libnfc/drivers/acr122_pcsc.h @@ -1,15 +1,15 @@ /** * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2011, Romain Tartiere, Romuald Conty * Copyright (C) 2012, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -17,8 +17,8 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see - * - * + * + * * @file acr122_pcsc.h * @brief Driver for ACR122 devices (behind PC/SC daemon) */ diff --git a/libnfc/drivers/acr122_usb.c b/libnfc/drivers/acr122_usb.c index 64b41d2..2b3b09b 100644 --- a/libnfc/drivers/acr122_usb.c +++ b/libnfc/drivers/acr122_usb.c @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romain Tartière, Romuald Conty * Copyright (C) 2011, Romain Tartière, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -33,7 +33,7 @@ * Revision 1.1 * April 22rd, 2005 * http://www.usb.org/developers/devclass_docs/DWG_Smart-Card_CCID_Rev110.pdf - * + * * ACR122U NFC Reader * Application Programming Interface * Revision 1.2 @@ -684,7 +684,7 @@ acr122_usb_init (nfc_device *pnd) /* // See ACR122 manual: "Bi-Color LED and Buzzer Control" section - uint8_t acr122u_get_led_state_frame[] = { + uint8_t acr122u_get_led_state_frame[] = { 0x6b, // CCID 0x09, // lenght of frame 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // padding diff --git a/libnfc/drivers/acr122_usb.h b/libnfc/drivers/acr122_usb.h index 76ca4d9..9c580e9 100644 --- a/libnfc/drivers/acr122_usb.h +++ b/libnfc/drivers/acr122_usb.h @@ -1,14 +1,14 @@ /** * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2011, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -16,8 +16,8 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see - * - * + * + * * @file acr122_usb.h * @brief Driver for ACR122 devices using direct USB connection (without PCSC) */ diff --git a/libnfc/drivers/acr122s.c b/libnfc/drivers/acr122s.c index f2e1e23..d7ce693 100644 --- a/libnfc/drivers/acr122s.c +++ b/libnfc/drivers/acr122s.c @@ -479,7 +479,7 @@ acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD return false; #else /* SERIAL_AUTOPROBE_ENABLED */ *pszDeviceFound = 0; - + serial_port sp; char **acPorts = uart_list_ports (); const char *acPort; @@ -488,7 +488,7 @@ acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD while ((acPort = acPorts[iDevice++])) { sp = uart_open (acPort); log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "Trying to find ACR122S device on serial port: %s at %d bauds.", acPort, ACR122S_DEFAULT_SPEED); - + if ((sp != INVALID_SERIAL_PORT) && (sp != CLAIMED_SERIAL_PORT)) { // We need to flush input to be sure first reply does not comes from older byte transceive uart_flush_input (sp); @@ -512,7 +512,7 @@ acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD pn53x_data_new(pnd, &acr122s_io); CHIP_DATA(pnd)->type = PN532; CHIP_DATA(pnd)->power_mode = NORMAL; - + char version[32]; int ret = acr122s_get_firmware_version(pnd, version, sizeof(version)); if (ret == 0 && strncmp("ACR122S", version, 7) != 0) { @@ -525,11 +525,11 @@ acr122s_probe(nfc_connstring connstrings[], size_t connstrings_len, size_t *pszD if (ret != 0) continue; - + // ACR122S reader is found memcpy (connstrings[*pszDeviceFound], connstring, sizeof(nfc_connstring)); (*pszDeviceFound)++; - + // Test if we reach the maximum "wanted" devices if (*pszDeviceFound >= connstrings_len) break; @@ -551,7 +551,7 @@ acr122s_open(const nfc_connstring connstring) nfc_device *pnd; struct acr122s_descriptor ndd; int connstring_decode_level = acr122s_connstring_decode (connstring, &ndd); - + if (connstring_decode_level < 2) { return NULL; } diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index b8c91ce..838fe07 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty * Copyright (C) 2011, Romain Tartière, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -22,7 +22,7 @@ /** * @file arygon.c * @brief ARYGON readers driver - * + * * This driver can handle ARYGON readers that use UART as bus. * UART connection can be direct (host<->arygon_uc) or could be provided by internal USB to serial interface (e.g. host<->ftdi_chip<->arygon_uc) */ @@ -50,11 +50,11 @@ #include "uart.h" /** @def DEV_ARYGON_PROTOCOL_ARYGON_ASCII - * @brief High level language in ASCII format. (Common µC commands and Mifare® commands) + * @brief High level language in ASCII format. (Common µC commands and Mifare® commands) */ #define DEV_ARYGON_PROTOCOL_ARYGON_ASCII '0' /** @def DEV_ARYGON_MODE_HL_ASCII - * @brief High level language in Binary format With AddressingByte for party line. (Common µC commands and Mifare® commands) + * @brief High level language in Binary format With AddressingByte for party line. (Common µC commands and Mifare® commands) */ #define DEV_ARYGON_PROTOCOL_ARYGON_BINARY_WAB '1' /** @def DEV_ARYGON_PROTOCOL_TAMA @@ -541,7 +541,7 @@ arygon_reset_tama (nfc_device *pnd) return NFC_SUCCESS; } -static int +static int arygon_abort_command (nfc_device *pnd) { if (pnd) { diff --git a/libnfc/drivers/arygon.h b/libnfc/drivers/arygon.h index 711a9c1..8a1d847 100644 --- a/libnfc/drivers/arygon.h +++ b/libnfc/drivers/arygon.h @@ -1,15 +1,15 @@ /** * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -17,8 +17,8 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see - * - * + * + * * @file arygon.h * @brief Driver for PN53x-equipped ARYGON device connected using UART */ diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index 934d78e..4bff08a 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -1,14 +1,14 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2010, Roel Verdult, Romuald Conty * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -61,7 +61,7 @@ struct pn532_uart_data { volatile bool abort_flag; #endif }; - + #define DRIVER_DATA(pnd) ((struct pn532_uart_data*)(pnd->driver_data)) bool diff --git a/libnfc/drivers/pn532_uart.h b/libnfc/drivers/pn532_uart.h index c066e75..0eedeb6 100644 --- a/libnfc/drivers/pn532_uart.h +++ b/libnfc/drivers/pn532_uart.h @@ -1,14 +1,14 @@ /** * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2010, Roel Verdult, Romuald Conty * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -16,8 +16,8 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see - * - * + * + * * @file pn532_uart.h * @brief Driver for PN532 connected in UART (HSU) */ diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index b85da1d..b366a6f 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romain Tartière, Romuald Conty * Copyright (C) 2011, Romain Tartière, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -686,19 +686,19 @@ pn53x_usb_init (nfc_device *pnd) /* On ASK LoGO hardware: - LEDs port bits definition: + LEDs port bits definition: * LED 1: bit 2 (P32) * LED 2: bit 1 (P31) * LED 3: bit 0 or 3 (depending of hardware revision) (P30 or P33) * LED 4: bit 5 (P35) - Notes: - * Set logical 0 to switch LED on; logical 1 to switch LED off. + Notes: + * Set logical 0 to switch LED on; logical 1 to switch LED off. * Bit 4 should be maintained at 1 to keep RF field on. Progressive field activation: The ASK LoGO hardware can progressively power-up the antenna. To use this feature we have to switch on the field by switching on - the field on PN533 (RFConfiguration) then set P34 to '1', and cut-off the + the field on PN533 (RFConfiguration) then set P34 to '1', and cut-off the field by switching off the field on PN533 then set P34 to '0'. */ diff --git a/libnfc/drivers/pn53x_usb.h b/libnfc/drivers/pn53x_usb.h index 566f0bb..bc4af4a 100644 --- a/libnfc/drivers/pn53x_usb.h +++ b/libnfc/drivers/pn53x_usb.h @@ -1,14 +1,14 @@ /** * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2011, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -16,8 +16,8 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see - * - * + * + * * @file pn53x_usb.h * @brief Drive for PN53x USB devices */ diff --git a/libnfc/iso14443-subr.c b/libnfc/iso14443-subr.c index a474d90..86acf4c 100644 --- a/libnfc/iso14443-subr.c +++ b/libnfc/iso14443-subr.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -95,28 +95,28 @@ iso14443a_locate_historical_bytes (uint8_t *pbtAts, size_t szAts, size_t *pszTk) * @brief Add cascade tags (0x88) in UID * @see ISO/IEC 14443-3 (6.4.4 UID contents and cascade levels) */ -void +void iso14443_cascade_uid (const uint8_t abtUID[], const size_t szUID, uint8_t *pbtCascadedUID, size_t *pszCascadedUID) { - switch (szUID) { - case 7: - pbtCascadedUID[0] = 0x88; - memcpy (pbtCascadedUID + 1, abtUID, 7); - *pszCascadedUID = 8; - break; - - case 10: - pbtCascadedUID[0] = 0x88; - memcpy (pbtCascadedUID + 1, abtUID, 3); - pbtCascadedUID[4] = 0x88; - memcpy (pbtCascadedUID + 5, abtUID + 3, 7); - *pszCascadedUID = 12; - break; - - case 4: - default: - memcpy (pbtCascadedUID, abtUID, szUID); - *pszCascadedUID = szUID; - break; - } + switch (szUID) { + case 7: + pbtCascadedUID[0] = 0x88; + memcpy (pbtCascadedUID + 1, abtUID, 7); + *pszCascadedUID = 8; + break; + + case 10: + pbtCascadedUID[0] = 0x88; + memcpy (pbtCascadedUID + 1, abtUID, 3); + pbtCascadedUID[4] = 0x88; + memcpy (pbtCascadedUID + 5, abtUID + 3, 7); + *pszCascadedUID = 12; + break; + + case 4: + default: + memcpy (pbtCascadedUID, abtUID, szUID); + *pszCascadedUID = szUID; + break; + } } diff --git a/libnfc/iso7816.h b/libnfc/iso7816.h index 250f053..60b8898 100644 --- a/libnfc/iso7816.h +++ b/libnfc/iso7816.h @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/libnfc/log.h b/libnfc/log.h index 1f174d4..f72fe15 100644 --- a/libnfc/log.h +++ b/libnfc/log.h @@ -41,8 +41,8 @@ __attribute__((format(printf, 3, 4))) # endif ; - - + + #define NFC_PRIORITY_FATAL "fatal" #define NFC_PRIORITY_ALERT "alert" #define NFC_PRIORITY_CRIT "critical" @@ -59,7 +59,7 @@ #define log_msg(category, priority, message) do {} while (0) #define log_set_appender(category, appender) do {} while (0) #define log_put(category, priority, format, ...) do {} while (0) - + #define NFC_PRIORITY_FATAL 8 #define NFC_PRIORITY_ALERT 7 #define NFC_PRIORITY_CRIT 6 diff --git a/libnfc/mirror-subr.c b/libnfc/mirror-subr.c index f1da337..1746e49 100644 --- a/libnfc/mirror-subr.c +++ b/libnfc/mirror-subr.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/libnfc/mirror-subr.h b/libnfc/mirror-subr.h index e0ee172..f3dc057 100644 --- a/libnfc/mirror-subr.h +++ b/libnfc/mirror-subr.h @@ -1,13 +1,13 @@ /** * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -15,8 +15,8 @@ * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see - * - * + * + * * @file mirror-subr.h * @brief Mirror bytes */ diff --git a/libnfc/nfc-device.c b/libnfc/nfc-device.c index db576f0..4e296f5 100644 --- a/libnfc/nfc-device.c +++ b/libnfc/nfc-device.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romain Tartière, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/libnfc/nfc-emulation.c b/libnfc/nfc-emulation.c index e959ed6..b8445c1 100644 --- a/libnfc/nfc-emulation.c +++ b/libnfc/nfc-emulation.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for diff --git a/libnfc/nfc-internal.c b/libnfc/nfc-internal.c index c52ef52..c6862c9 100644 --- a/libnfc/nfc-internal.c +++ b/libnfc/nfc-internal.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -25,7 +25,7 @@ #include #include "nfc-internal.h" -void +void prepare_initiator_data (const nfc_modulation nm, uint8_t **ppbtInitiatorData, size_t * pszInitiatorData) { switch (nm.nmt) { diff --git a/libnfc/nfc-internal.h b/libnfc/nfc-internal.h index edb454b..b1dee6c 100644 --- a/libnfc/nfc-internal.h +++ b/libnfc/nfc-internal.h @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2011, Romain Tartière, Romuald Conty - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -54,7 +54,7 @@ /* * Buffer management macros. - * + * * The following macros ease setting-up and using buffers: * BUFFER_INIT (data, 5); // data -> [ xx, xx, xx, xx, xx ] * BUFFER_SIZE (data); // size -> 0 diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 6f19616..a049c86 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -1,15 +1,15 @@ /*- * Public platform independent Near Field Communication (NFC) library - * + * * Copyright (C) 2009, Roel Verdult, Romuald Conty * Copyright (C) 2010, Roel Verdult, Romuald Conty, Romain Tartière * Copyright (C) 2011, Romuald Conty, Romain Tartière - * + * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. - * + * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for @@ -19,7 +19,7 @@ * along with this program. If not, see */ -/** +/** * @file nfc.c * @brief NFC library implementation */ @@ -30,36 +30,36 @@ * must not call any libnfc functions after deinitialization. */ /** - * @defgroup dev NFC Device/Hardware manipulation + * @defgroup dev NFC Device/Hardware manipulation * The functionality documented below is designed to help with the following * operations: * - Enumerating the NFC devices currently attached to the system * - Opening and closing the chosen device - */ + */ /** * @defgroup initiator NFC initiator * This page details how to act as "reader". - */ + */ /** * @defgroup target NFC target * This page details how to act as tag (i.e. MIFARE Classic) or NFC target device. - */ + */ /** * @defgroup error Error reporting * Most libnfc functions return 0 on success or one of error codes defined on failure. - */ + */ /** * @defgroup data Special data accessors * The functionnality documented below allow to access to special data as device name or device connstring. - */ + */ /** * @defgroup properties Properties accessors * The functionnality documented below allow to configure parameters and registers. - */ + */ /** * @defgroup misc Miscellaneous - * - */ + * + */ /* vim:set ts=2 sw=2 et: */ @@ -128,7 +128,7 @@ nfc_exit(nfc_context *context) /** @ingroup dev * @brief Get the defaut NFC device - * @param connstring \a nfc_connstring pointer where the default connection string will be stored + * @param connstring \a nfc_connstring pointer where the default connection string will be stored * @return \e true on success * * This function fill \e connstring with the LIBNFC_DEFAULT_DEVICE environment variable content @@ -136,11 +136,11 @@ nfc_exit(nfc_context *context) * \e connstring with the corresponding \a nfc_connstring value. * * This function returns true when LIBNFC_DEFAULT_DEVICE is set or an available device is found. - * + * * @note The \e connstring content can be invalid if LIBNFC_DEFAULT_DEVICE is * set with incorrect value. */ -bool +bool nfc_get_default_device (nfc_connstring *connstring) { char *env_default_connstring = getenv ("LIBNFC_DEFAULT_DEVICE"); @@ -166,14 +166,14 @@ nfc_get_default_device (nfc_connstring *connstring) * @return Returns pointer to a \a nfc_device struct if successfull; otherwise returns \c NULL value. * * If \e connstring is \c NULL, the \a nfc_get_default_device() function is used. - * + * * If \e connstring is set, this function will try to claim the right device using information provided by \e connstring. * * When it has successfully claimed a NFC device, memory is allocated to save the device information. * It will return a pointer to a \a nfc_device struct. * This pointer should be supplied by every next functions of libnfc that should perform an action with this device. * - * @note Depending on the desired operation mode, the device needs to be configured by using nfc_initiator_init() or nfc_target_init(), + * @note Depending on the desired operation mode, the device needs to be configured by using nfc_initiator_init() or nfc_target_init(), * optionally followed by manual tuning of the parameters if the default parameters are not suiting your goals. */ nfc_device * @@ -191,12 +191,12 @@ nfc_open (nfc_context *context, const nfc_connstring connstring) } else { strncpy (ncs, connstring, sizeof (nfc_connstring)); } - + // Search through the device list for an available device const struct nfc_driver *ndr; const struct nfc_driver **pndr = nfc_drivers; while ((ndr = *pndr)) { - // Specific device is requested: using device description + // Specific device is requested: using device description if (0 != strncmp (ndr->name, ncs, strlen(ndr->name))) { pndr++; continue; @@ -209,7 +209,7 @@ nfc_open (nfc_context *context, const nfc_connstring connstring) log_fini (); return pnd; } - + log_put (LOG_CATEGORY, NFC_PRIORITY_TRACE, "\"%s\" (%s) has been claimed.", pnd->name, pnd->connstring); log_fini (); return pnd; @@ -233,7 +233,7 @@ nfc_close (nfc_device *pnd) if (pnd) { // Go in idle mode nfc_idle (pnd); - // Close, clean up and release the device + // Close, clean up and release the device pnd->driver->close (pnd); } @@ -245,7 +245,7 @@ nfc_close (nfc_device *pnd) * @param context The context to operate on, or NULL for the default context. * @param connstrings array of \a nfc_connstring. * @param szDevices size of the \a connstrings array. - * + * */ size_t nfc_list_devices (nfc_context *context, nfc_connstring connstrings[] , size_t szDevices) @@ -282,7 +282,7 @@ nfc_list_devices (nfc_context *context, nfc_connstring connstrings[] , size_t sz * * @see nfc_property enum values */ -int +int nfc_device_set_property_int (nfc_device *pnd, const nfc_property property, const int value) { HAL (device_set_property_int, pnd, property, value); @@ -385,7 +385,7 @@ nfc_initiator_init (nfc_device *pnd) * * @param[out] pnt \a nfc_target struct pointer which will filled if available * - * The NFC device will try to find one available passive tag or emulated tag. + * The NFC device will try to find one available passive tag or emulated tag. * * The chip needs to know with what kind of tag it is dealing with, therefore * the initial modulation and speed (106, 212 or 424 kbps) should be supplied. @@ -519,11 +519,11 @@ nfc_initiator_poll_target (nfc_device *pnd, * The NFC device will try to find an available D.E.P. target. The standards * (ISO18092 and ECMA-340) describe the modulation that can be used for reader * to passive communications. - * + * * @note \a nfc_dep_info will be returned when the target was acquired successfully. */ int -nfc_initiator_select_dep_target (nfc_device *pnd, +nfc_initiator_select_dep_target (nfc_device *pnd, const nfc_dep_mode ndm, const nfc_baud_rate nbr, const nfc_dep_info *pndiInitiator, nfc_target *pnt, const int timeout) { @@ -544,7 +544,7 @@ nfc_initiator_select_dep_target (nfc_device *pnd, * The NFC device will try to find an available D.E.P. target. The standards * (ISO18092 and ECMA-340) describe the modulation that can be used for reader * to passive communications. - * + * * @note \a nfc_dep_info will be returned when the target was acquired successfully. */ int @@ -599,7 +599,7 @@ nfc_initiator_deselect_target (nfc_device *pnd) * @param[out] pbtRx response from the tags * @param szRx size of \a pbtRx (Will return NFC_EOVFLOW if RX exceeds this size) * @param timeout in milliseconds - * + * * The NFC device (configured as initiator) will transmit the supplied bytes (\a pbtTx) to the target. * It waits for the response and stores the received bytes in the \a pbtRx byte array. * @@ -646,7 +646,7 @@ nfc_initiator_transceive_bytes (nfc_device *pnd, const uint8_t *pbtTx, const siz * explain how it works, if you just are sending two bytes with ISO14443-A * compliant parity bits you better can use the * nfc_initiator_transceive_bytes() function. - * + * * @param[out] pbtRx response from the tag * @param[out] pbtRxPar parameter contains a byte array of the corresponding parity bits * @@ -850,7 +850,7 @@ nfc_target_send_bytes (nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx, /** @ingroup target * @brief Receive bytes and APDU frames * @return Returns received bytes count on success, otherwise returns libnfc's error code - * + * * @param pnd \a nfc_device struct pointer that represent currently used device * @param pbtRx pointer to Rx buffer * @param szRx size of Rx buffer @@ -928,12 +928,12 @@ static struct sErrorMessage { /** @ingroup error * @brief Return the last error string * @return Returns a string - * + * * @param pnd \a nfc_device struct pointer that represent currently used device */ const char * nfc_strerror (const nfc_device *pnd) -{ +{ const char *pcRes = "Unknown error"; size_t i; for (i = 0; i < (sizeof (sErrorMessages) / sizeof (struct sErrorMessage)); i++) { @@ -949,7 +949,7 @@ nfc_strerror (const nfc_device *pnd) /** @ingroup error * @brief Renders the last error in pcStrErrBuf for a maximum size of szBufLen chars * @return Returns 0 upon success - * + * * @param pnd \a nfc_device struct pointer that represent currently used device * @param pcStrErrBuf a string that contains the last error. * @param szBufLen size of buffer @@ -962,9 +962,9 @@ nfc_strerror_r (const nfc_device *pnd, char *pcStrErrBuf, size_t szBufLen) /** @ingroup error * @brief Display the last error occured on a nfc_device - * + * * @param pnd \a nfc_device struct pointer that represent currently used device - * @param pcString a string + * @param pcString a string */ void nfc_perror (const nfc_device *pnd, const char *pcString) @@ -975,7 +975,7 @@ nfc_perror (const nfc_device *pnd, const char *pcString) /** @ingroup error * @brief Returns last error occured on a nfc_device * @return Returns an integer that represents to libnfc's error code. - * + * * @param pnd \a nfc_device struct pointer that represent currently used device */ int @@ -989,7 +989,7 @@ nfc_device_get_last_error (const nfc_device *pnd) /** @ingroup data * @brief Returns the device name * @return Returns a string with the device name - * + * * @param pnd \a nfc_device struct pointer that represent currently used device */ const char * @@ -1001,7 +1001,7 @@ nfc_device_get_name (nfc_device *pnd) /** @ingroup data * @brief Returns the device connection string * @return Returns a string with the device connstring - * + * * @param pnd \a nfc_device struct pointer that represent currently used device */ const char * @@ -1016,9 +1016,9 @@ nfc_device_get_connstring (nfc_device *pnd) * @param pnd \a nfc_device struct pointer that represent currently used device * @param mode \a nfc_mode. * @param supported_mt pointer of \a nfc_modulation_type array. - * + * */ -int +int nfc_device_get_supported_modulation (nfc_device *pnd, const nfc_mode mode, const nfc_modulation_type **const supported_mt) { HAL (get_supported_modulation, pnd, mode, supported_mt); @@ -1030,9 +1030,9 @@ nfc_device_get_supported_modulation (nfc_device *pnd, const nfc_mode mode, const * @param pnd \a nfc_device struct pointer that represent currently used device * @param nmt \a nfc_modulation_type. * @param supported_br pointer of \a nfc_baud_rate array. - * + * */ -int +int nfc_device_get_supported_baud_rate (nfc_device *pnd, const nfc_modulation_type nmt, const nfc_baud_rate **const supported_br) { HAL (get_supported_baud_rate, pnd, nmt, supported_br); @@ -1043,7 +1043,7 @@ nfc_device_get_supported_baud_rate (nfc_device *pnd, const nfc_modulation_type n /** @ingroup misc * @brief Returns the library version * @return Returns a string with the library version - * + * * @param pnd \a nfc_device struct pointer that represent currently used device */ const char * @@ -1063,7 +1063,7 @@ nfc_version (void) * @param buf string to print information * @param buflen buf length */ -int +int nfc_device_get_information_about (nfc_device *pnd, char *buf, size_t buflen) { HAL (device_get_information_about, pnd, buf, buflen); diff --git a/test/test_access_storm.c b/test/test_access_storm.c index 558f34c..d293374 100644 --- a/test/test_access_storm.c +++ b/test/test_access_storm.c @@ -18,7 +18,7 @@ test_access_storm (void) int res = 0; nfc_init (NULL); - + size_t ref_device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT); if (!ref_device_count) cut_omit ("No NFC device found"); diff --git a/test/test_dep_active.c b/test/test_dep_active.c index 9072495..3263e63 100644 --- a/test/test_dep_active.c +++ b/test/test_dep_active.c @@ -93,7 +93,7 @@ target_thread (void *arg) const uint8_t abtAttRx[] = "Hello DEP target!"; cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data")); if (res <= 0) { thread_res = -1; return (void*) thread_res; } - + const uint8_t abtTx[] = "Hello DEP initiator!"; res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device))); @@ -121,7 +121,7 @@ initiator_thread (void *arg) nfc_target nt; - // Active mode + // Active mode printf ("=========== INITIATOR %s (Active mode / %s Kbps) =========\n", nfc_device_get_name (device), str_nfc_baud_rate(nbr)); res = nfc_initiator_select_dep_target (device, NDM_ACTIVE, nbr, NULL, &nt, 1000); cut_assert_operator_int (res, >, 0, cut_message ("Can't select any DEP target: %s", nfc_strerror (device))); @@ -159,15 +159,15 @@ test_dep (void) .device = devices[TARGET], .cut_test_context = test_context, }; - + struct thread_data initiator_data = { .device = devices[INITIATOR], .cut_test_context = test_context, }; - + for (int i = 0; i < 3; i++) { initiator_data.nbr = nbrs[i]; - + if ((res = pthread_create (&(threads[TARGET]), NULL, target_thread, &target_data))) cut_fail ("pthread_create() returned %d", res); if ((res = pthread_create (&(threads[INITIATOR]), NULL, initiator_thread, &initiator_data))) @@ -181,5 +181,5 @@ test_dep (void) cut_assert_equal_int (0, result[INITIATOR], cut_message ("Unexpected initiator return code")); cut_assert_equal_int (0, result[TARGET], cut_message ("Unexpected target return code")); } - + } diff --git a/test/test_dep_passive.c b/test/test_dep_passive.c index e792f15..36e40bb 100644 --- a/test/test_dep_passive.c +++ b/test/test_dep_passive.c @@ -30,7 +30,7 @@ cut_setup (void) if (n < 2) { cut_omit ("At least two NFC devices must be plugged-in to run this test"); } - + nfc_init (NULL); devices[TARGET] = nfc_open (NULL, connstrings[TARGET]); devices[INITIATOR] = nfc_open (NULL, connstrings[INITIATOR]); @@ -90,11 +90,11 @@ target_thread (void *arg) res = nfc_target_receive_bytes (device, abtRx, sizeof (abtRx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device))); szRx = (size_t) res; - + const uint8_t abtAttRx[] = "Hello DEP target!"; cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data")); if (res <= 0) { thread_res = -1; return (void*) thread_res; } - + const uint8_t abtTx[] = "Hello DEP initiator!"; res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device))); @@ -107,7 +107,7 @@ target_thread (void *arg) cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data")); if (res <= 0) { thread_res = -1; return (void*) thread_res; } - + res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device))); if (res <= 0) { thread_res = -1; return (void*) thread_res; } @@ -119,11 +119,11 @@ target_thread (void *arg) cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data")); if (res <= 0) { thread_res = -1; return (void*) thread_res; } - + res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device))); if (res <= 0) { thread_res = -1; return (void*) thread_res; } - + // Fourth pass res = nfc_target_receive_bytes (device, abtRx, sizeof (abtRx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device))); @@ -131,7 +131,7 @@ target_thread (void *arg) cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data")); if (res <= 0) { thread_res = -1; return (void*) thread_res; } - + res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device))); if (res <= 0) { thread_res = -1; return (void*) thread_res; } @@ -226,7 +226,7 @@ initiator_thread (void *arg) res = nfc_initiator_deselect_target (device); cut_assert_operator_int (res, >=, 0, cut_message ("Can't deselect target: %s", nfc_strerror (device))); if (res < 0) { thread_res = -1; return (void*) thread_res; } - + // Passive mode / 424Kbps printf ("=========== INITIATOR %s (Passive mode / 424Kbps) =========\n", nfc_device_get_name (device)); res = nfc_initiator_select_dep_target (device, NDM_PASSIVE, NBR_424, NULL, &nt, 1000); diff --git a/test/test_device_modes_as_dep.c b/test/test_device_modes_as_dep.c index e03e233..95c6099 100644 --- a/test/test_device_modes_as_dep.c +++ b/test/test_device_modes_as_dep.c @@ -57,7 +57,7 @@ target_thread (void *arg) cut_set_current_test_context (((struct thread_data *) arg)->cut_test_context); printf ("=========== TARGET %s =========\n", nfc_device_get_name (device)); - nfc_target nt; + nfc_target nt; uint8_t abtRx[1024]; size_t szRx = sizeof (abtRx); @@ -66,7 +66,7 @@ target_thread (void *arg) int res = nfc_target_init (device, &nt, abtRx, szRx, 500); cut_assert_operator_int (res, >=, 0, cut_message ("Can't initialize NFC device as target: %s", nfc_strerror (device))); if (res < 0) { thread_res = -1; return (void*) thread_res; } - + // 2) act as target nfc_target nt1 = { .nm = { @@ -96,11 +96,11 @@ target_thread (void *arg) res = nfc_target_receive_bytes (device, abtRx, sizeof (abtRx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't receive bytes from initiator: %s", nfc_strerror (device))); szRx = (size_t) res; - + const uint8_t abtAttRx[] = "Hello DEP target!"; cut_assert_equal_memory (abtAttRx, sizeof (abtAttRx), abtRx, szRx, cut_message ("Invalid received data")); if (res <= 0) { thread_res = -1; return (void*) thread_res; } - + const uint8_t abtTx[] = "Hello DEP initiator!"; res = nfc_target_send_bytes (device, abtTx, sizeof(abtTx), 500); cut_assert_operator_int (res, >, 0, cut_message ("Can't send bytes to initiator: %s", nfc_strerror (device))); @@ -130,13 +130,13 @@ initiator_thread (void *arg) cut_assert_equal_int (0, res, cut_message ("Can't initialize NFC device as initiator: %s", nfc_strerror (device))); if (res < 0) { thread_res = -1; return (void*) thread_res; } - // 1) As other device should be in idle mode, nfc_initiator_poll_dep_target should return 0 + // 1) As other device should be in idle mode, nfc_initiator_poll_dep_target should return 0 nfc_target nt; res = nfc_initiator_poll_dep_target (device, NDM_PASSIVE, NBR_106, NULL, &nt, 1000); cut_assert_equal_int (0, res, cut_message ("Problem with nfc_idle")); if (res != 0) { thread_res = -1; return (void*) thread_res; } - + // 2 As other device should be in target mode, nfc_initiator_poll_dep_target should be positive. nfc_target nt1; @@ -165,12 +165,12 @@ initiator_thread (void *arg) cut_assert_operator_int (res, >=, 0, cut_message ("Can't deselect target: %s", nfc_strerror (device))); if (res < 0) { thread_res = -1; return (void*) thread_res; } - // 3) As other device should be in idle mode, nfc_initiator_poll_dep_target should return 0 + // 3) As other device should be in idle mode, nfc_initiator_poll_dep_target should return 0 nfc_target nt2; res = nfc_initiator_poll_dep_target (device, NDM_PASSIVE, NBR_106, NULL, &nt2, 1000); cut_assert_equal_int (0, res, cut_message ("Problem with nfc_idle")); if (res != 0) { thread_res = -1; return (void*) thread_res; } - + return (void *) thread_res; } @@ -184,12 +184,12 @@ test_dep_states (void) .device = first_device, .cut_test_context = test_context, }; - + struct thread_data initiator_data = { .device = second_device, .cut_test_context = test_context, }; - + for (int i = 0; i < 2; i++) { if ((res = pthread_create (&(threads[1]), NULL, target_thread, &target_data))) cut_fail ("pthread_create() returned %d", res); @@ -204,7 +204,7 @@ test_dep_states (void) cut_assert_equal_int (0, result[0], cut_message ("Unexpected initiator return code")); cut_assert_equal_int (0, result[1], cut_message ("Unexpected target return code")); - + // initiator --> target, target --> initiator target_data.device = second_device; initiator_data.device = first_device; diff --git a/test/test_register_access.c b/test/test_register_access.c index f6abfef..e196416 100644 --- a/test/test_register_access.c +++ b/test/test_register_access.c @@ -11,7 +11,7 @@ test_register_endianness (void) { nfc_connstring connstrings[MAX_DEVICE_COUNT]; int res = 0; - + nfc_init (NULL); size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT); diff --git a/test/test_register_endianness.c b/test/test_register_endianness.c index 09d622c..3310b79 100644 --- a/test/test_register_endianness.c +++ b/test/test_register_endianness.c @@ -12,7 +12,7 @@ test_register_endianness (void) { nfc_connstring connstrings[MAX_DEVICE_COUNT]; int res = 0; - + nfc_init (NULL); size_t device_count = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT); diff --git a/utils/mifare.c b/utils/mifare.c index e51e9ee..46ffe85 100644 --- a/utils/mifare.c +++ b/utils/mifare.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty, Romain Tartière - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -45,9 +45,9 @@ * The specified MIFARE command will be executed on the tag. There are different commands possible, they all require the destination block number. * @note There are three different types of information (Authenticate, Data and Value). * - * First an authentication must take place using Key A or B. It requires a 48 bit Key (6 bytes) and the UID. + * First an authentication must take place using Key A or B. It requires a 48 bit Key (6 bytes) and the UID. * They are both used to initialize the internal cipher-state of the PN53X chip (http://libnfc.org/hardware/pn53x-chip). - * After a successful authentication it will be possible to execute other commands (e.g. Read/Write). + * After a successful authentication it will be possible to execute other commands (e.g. Read/Write). * The MIFARE Classic Specification (http://www.nxp.com/acrobat/other/identification/M001053_MF1ICS50_rev5_3.pdf) explains more about this process. */ bool diff --git a/utils/mifare.h b/utils/mifare.h index 1b0a353..b827081 100644 --- a/utils/mifare.h +++ b/utils/mifare.h @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty, Romain Tartière - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ diff --git a/utils/nfc-emulate-forum-tag4.c b/utils/nfc-emulate-forum-tag4.c index ae82a07..c1b4a19 100644 --- a/utils/nfc-emulate-forum-tag4.c +++ b/utils/nfc-emulate-forum-tag4.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2010, Roel Verdult, Romuald Conty * Copyright (C) 2011, Romain Tartière, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -91,7 +91,7 @@ uint8_t nfcforum_capability_container[] = { 0x00, 0x0F, /* CCLEN 15 bytes */ 0x20, /* Mapping version 2.0, use option -1 to force v1.0 */ 0x00, 0x54, /* MLe Maximum R-ADPU data size */ -// Notes: +// Notes: // - I (Romuald) don't know why Nokia 6212 Classic refuses the NDEF message if MLe is more than 0xFD (any suggests are welcome); // - ARYGON devices doesn't support extended frame sending, consequently these devices can't sent more than 0xFE bytes as APDU, so 0xFB APDU data bytes. // - I (Romuald) don't know why ARYGON device doesn't ACK when MLe > 0x54 (ARYGON frame length = 0xC2 (192 bytes)) @@ -364,7 +364,7 @@ main (int argc, char *argv[]) err (EXIT_FAILURE, "Can't load NDEF file '%s'", argv[1 + options]); } } - + nfc_init (NULL); // Try to open the NFC reader @@ -391,7 +391,7 @@ main (int argc, char *argv[]) err (EXIT_FAILURE, "Can't save NDEF file '%s'", argv[2 + options]); } } - + nfc_exit (NULL); exit (EXIT_SUCCESS); } diff --git a/utils/nfc-list.c b/utils/nfc-list.c index ee570bb..8bd4cad 100644 --- a/utils/nfc-list.c +++ b/utils/nfc-list.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty, Romain Tartière - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -75,7 +75,7 @@ main (int argc, const char *argv[]) int res = 0; nfc_init (NULL); - + // Display libnfc version acLibnfcVersion = nfc_version (); printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion); @@ -132,7 +132,7 @@ main (int argc, const char *argv[]) } if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } printf ("NFC device: %s opened\n", nfc_device_get_name (pnd)); diff --git a/utils/nfc-mfclassic.c b/utils/nfc-mfclassic.c index acfaf2a..76c34e4 100644 --- a/utils/nfc-mfclassic.c +++ b/utils/nfc-mfclassic.c @@ -1,14 +1,14 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty, Romain Tartière * Copyright (C) 2011, Adam Laurie - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -24,7 +24,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -508,7 +508,7 @@ main (int argc, const char *argv[]) // printf("Successfully opened required files\n"); nfc_init (NULL); - + // Try to open the NFC reader pnd = nfc_open (NULL, NULL); if (pnd == NULL) { @@ -518,7 +518,7 @@ main (int argc, const char *argv[]) if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); }; // Let the reader only try once to find a tag @@ -594,7 +594,7 @@ main (int argc, const char *argv[]) nfc_close (pnd); break; }; - + nfc_exit (NULL); exit (EXIT_SUCCESS); } diff --git a/utils/nfc-mfultralight.c b/utils/nfc-mfultralight.c index ba7394c..b2790e3 100644 --- a/utils/nfc-mfultralight.c +++ b/utils/nfc-mfultralight.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -149,7 +149,7 @@ write_card (void) bFailure = false; } // For the Mifare Ultralight, this write command can be used - // in compatibility mode, which only actually writes the first + // in compatibility mode, which only actually writes the first // page (4 bytes). The Ultralight-specific Write command only // writes one page at a time. uiBlock = page / 4; @@ -205,7 +205,7 @@ main (int argc, const char *argv[]) DBG ("Successfully opened the dump file\n"); nfc_init (NULL); - + // Try to open the NFC device pnd = nfc_open (NULL, NULL); if (pnd == NULL) { @@ -215,7 +215,7 @@ main (int argc, const char *argv[]) if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } // Let the device only try once to find a tag diff --git a/utils/nfc-probe.c b/utils/nfc-probe.c index 29342ca..b35c73f 100644 --- a/utils/nfc-probe.c +++ b/utils/nfc-probe.c @@ -1,14 +1,14 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty, Romain Tartière * Copyright (C) 2011-2012, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -24,7 +24,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -75,7 +75,7 @@ main (int argc, const char *argv[]) bool verbose = false; nfc_init (NULL); - + // Display libnfc version acLibnfcVersion = nfc_version (); printf ("%s uses libnfc %s\n", argv[0], acLibnfcVersion); diff --git a/utils/nfc-read-forum-tag3.c b/utils/nfc-read-forum-tag3.c index 922bf21..9e046cc 100644 --- a/utils/nfc-read-forum-tag3.c +++ b/utils/nfc-read-forum-tag3.c @@ -1,12 +1,12 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2011, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -22,7 +22,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -85,7 +85,7 @@ build_felica_frame(const nfc_felica_info nfi, const uint8_t command, const uint8 } #define CHECK 0x06 -static int +static int nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t block, const uint8_t block_count, uint8_t *data, size_t *data_len) { uint8_t payload[1024] = { @@ -94,7 +94,7 @@ nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t block_count, 0x80, block, // block 0 }; - + size_t payload_len = 1 + 2 + 1; for (uint8_t b = 0; b < block_count; b++) { if (block < 0x100) { @@ -104,7 +104,7 @@ nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t payload[payload_len++] = 0x00; payload[payload_len++] = (block + b) >> 8; payload[payload_len++] = (block + b) & 0xff; - } + } } uint8_t frame[1024]; @@ -117,7 +117,7 @@ nfc_forum_tag_type3_check (nfc_device *dev, const nfc_target nt, const uint16_t return res; } const int res_overhead = 1 + 1 + 8 + 2; // 1+1+8+2: LEN + CMD + NFCID2 + STATUS - if (res < res_overhead) { + if (res < res_overhead) { // Not enough data return -1; } @@ -154,44 +154,44 @@ main(int argc, char *argv[]) (void)argv; int ch; - char *ndef_output = NULL; - while ((ch = getopt (argc, argv, "ho:")) != -1) { - switch (ch) { - case 'h': - print_usage(argv[0]); - exit (EXIT_SUCCESS); - break; - case 'o': - ndef_output = optarg; - break; - case '?': - if (optopt == 'o') - fprintf (stderr, "Option -%c requires an argument.\n", optopt); - default: - print_usage (argv[0]); - exit (EXIT_FAILURE); - } - } - - if (ndef_output == NULL) { - print_usage (argv[0]); - exit (EXIT_FAILURE); - } - FILE* message_stream = NULL; - FILE* ndef_stream = NULL; - - if ((strlen (ndef_output) == 1) && (ndef_output[0] == '-')) { - message_stream = stderr; - ndef_stream = stdout; - } else { - message_stream = stdout; - ndef_stream = fopen(ndef_output, "wb"); - if (!ndef_stream) { - fprintf (stderr, "Could not open file %s.\n", ndef_output); - exit (EXIT_FAILURE); - } + char *ndef_output = NULL; + while ((ch = getopt (argc, argv, "ho:")) != -1) { + switch (ch) { + case 'h': + print_usage(argv[0]); + exit (EXIT_SUCCESS); + break; + case 'o': + ndef_output = optarg; + break; + case '?': + if (optopt == 'o') + fprintf (stderr, "Option -%c requires an argument.\n", optopt); + default: + print_usage (argv[0]); + exit (EXIT_FAILURE); + } } - + + if (ndef_output == NULL) { + print_usage (argv[0]); + exit (EXIT_FAILURE); + } + FILE* message_stream = NULL; + FILE* ndef_stream = NULL; + + if ((strlen (ndef_output) == 1) && (ndef_output[0] == '-')) { + message_stream = stderr; + ndef_stream = stdout; + } else { + message_stream = stdout; + ndef_stream = fopen(ndef_output, "wb"); + if (!ndef_stream) { + fprintf (stderr, "Could not open file %s.\n", ndef_output); + exit (EXIT_FAILURE); + } + } + nfc_init (NULL); pnd = nfc_open (NULL, NULL); @@ -214,7 +214,7 @@ main(int argc, char *argv[]) if (nfc_initiator_init (pnd) < 0) { nfc_perror (pnd, "nfc_initiator_init"); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } fprintf (message_stream, "Place your NFC Forum Tag Type 3 in the field...\n"); @@ -227,7 +227,7 @@ main(int argc, char *argv[]) goto error; } - // Check if System Code equals 0x12fc + // Check if System Code equals 0x12fc const uint8_t abtNfcForumSysCode[] = { 0x12, 0xfc }; if (0 != memcmp (nt.nti.nfi.abtSysCode, abtNfcForumSysCode, 2)) { // Retry with special polling @@ -237,7 +237,7 @@ main(int argc, char *argv[]) error = EXIT_FAILURE; goto error; } - // Check again if System Code equals 0x12fc + // Check again if System Code equals 0x12fc if (0 != memcmp (nt.nti.nfi.abtSysCode, abtNfcForumSysCode, 2)) { fprintf (stderr, "Tag is not NFC Forum Tag Type 3 compliant.\n"); error = EXIT_FAILURE; diff --git a/utils/nfc-relay-picc.c b/utils/nfc-relay-picc.c index 288ab1d..2235bae 100644 --- a/utils/nfc-relay-picc.c +++ b/utils/nfc-relay-picc.c @@ -1,12 +1,12 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2010, Romuald Conty - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -22,7 +22,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ @@ -192,7 +192,7 @@ main (int argc, char *argv[]) #endif nfc_init (NULL); - + nfc_connstring connstrings[MAX_DEVICE_COUNT]; // List available devices size_t szFound = nfc_list_devices (NULL, connstrings, MAX_DEVICE_COUNT); @@ -277,7 +277,7 @@ main (int argc, char *argv[]) nfc_exit (NULL); exit(EXIT_FAILURE); } - } + } } if (initiator_only_mode) { printf ("Hint: tag <---> *INITIATOR* (relay) <-FD3/FD4-> target (relay) <---> original reader\n\n"); @@ -352,7 +352,7 @@ main (int argc, char *argv[]) printf("We will emulate:\n"); print_nfc_iso14443a_info (ntEmulatedTarget.nti.nai, false); - + // Try to open the NFC emulator device pndTarget = nfc_open (NULL, connstrings[0]); if (pndTarget == NULL) { diff --git a/utils/nfc-utils.c b/utils/nfc-utils.c index 25efd05..0c9cdd5 100644 --- a/utils/nfc-utils.c +++ b/utils/nfc-utils.c @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty, Romain Tartière - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ diff --git a/utils/nfc-utils.h b/utils/nfc-utils.h index 2a7f33c..4f3319f 100644 --- a/utils/nfc-utils.h +++ b/utils/nfc-utils.h @@ -1,13 +1,13 @@ /*- * Public platform independent Near Field Communication (NFC) library examples - * + * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty, Romain Tartière - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1) Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * this list of conditions and the following disclaimer. * 2 )Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. @@ -23,7 +23,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ diff --git a/windows/usb/include/usb.h b/windows/usb/include/usb.h index b141c86..f93c6b2 100644 --- a/windows/usb/include/usb.h +++ b/windows/usb/include/usb.h @@ -7,7 +7,7 @@ * */ -/* +/* * $Id: usb.h 1220 2010-05-04 03:14:56Z roger.brown $ */ @@ -18,8 +18,8 @@ #include #include -/* - * 'interface' is defined somewhere in the Windows header files. This macro +/* + * 'interface' is defined somewhere in the Windows header files. This macro * is deleted here to avoid conflicts and compile errors. */ @@ -29,7 +29,7 @@ /* * PATH_MAX from limits.h can't be used on Windows if the dll and - * import libraries are build/used by different compilers + * import libraries are build/used by different compilers */ #define LIBUSB_PATH_MAX 512 @@ -81,7 +81,7 @@ /* ensure byte-packed structures */ -#include +#include /* All standard descriptors have these 2 fields in common */ @@ -339,7 +339,7 @@ extern "C" { int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size, int timeout); int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, - int value, int index, char *bytes, int size, + int value, int index, char *bytes, int size, int timeout); int usb_set_configuration(usb_dev_handle *dev, int configuration); int usb_claim_interface(usb_dev_handle *dev, int interface); @@ -365,7 +365,7 @@ extern "C" { int usb_install_service_np(void); void CALLBACK usb_install_service_np_rundll(HWND wnd, HINSTANCE instance, LPSTR cmd_line, int cmd_show); - + #define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1 int usb_uninstall_service_np(void); void CALLBACK usb_uninstall_service_np_rundll(HWND wnd, HINSTANCE instance,