Commit graph

427 commits

Author SHA1 Message Date
Ludovic Rousseau
565134d4c4 Add missing \n in a printf() 2013-08-31 17:59:24 +02:00
Philippe Teuwen
bb5b712a74 Adding link to AUTHORS in the copyright headers 2013-07-17 13:57:56 +02:00
Romain Tartière
27c43e8b8a Improve a bit shell scripts portability.
- Use /bin/sh: bash is not required here;
  - Avoid Perl regexp in grep(1): this is a GNU extension;
  - While here, make ReadNavigo.sh fail earlier if pn53x-tamashell
    fails at first invocation.

Reported by:	Ganael Laplanche <martymac@FreeBSD.org>
2013-05-25 13:29:38 +02:00
Philippe Teuwen
9cb9e0e6da Fix cppcheck warning: The scope of the variable X can be reduced. 2013-04-05 14:38:03 +02:00
Philippe Teuwen
fc144fe389 nfc-anticol: add option -t for timed exchanges 2013-04-05 14:33:16 +02:00
Ludovic Rousseau
7d986844c4 Fix compiler warnings
doc/quick_start_example1.c:24: warning: unused parameter ‘argc’
doc/quick_start_example2.c:21: warning: unused parameter ‘argc’
2013-04-03 17:55:40 +02:00
Philippe Teuwen
ecc12d28aa quick_start_example1.c: avoid using warnx() to remove err.h dependency
err.h is not available under Windows and the goal of this example is not to learn how to get around that problem ;)
2013-03-12 17:46:04 +01:00
Philippe Teuwen
d019f9729d nfc-anticol: fix ATS length 2013-03-12 12:23:15 +01:00
Philippe Teuwen
bf164220ee Unify copyright notices & update authors lists 2013-03-10 16:15:23 +01:00
Alex Lian
7b917f9a8b Windows: Clean up all compiler warnings and link warnings
- Fixed the suppression of the auto-fixup for linking against MS built libs
- Fixed all the formatting warnings by shifting to inttypes.h specifiers
- shifted to %lu for DWORD printf
2013-03-07 09:37:36 +01:00
Philippe Teuwen
d8a93217ff make style 2013-03-07 09:17:27 +01:00
Philippe Teuwen
181cd914d5 pn53x-sam: fix print_nfc_target 2013-03-07 09:17:11 +01:00
Alex Lian
c72846e3c6 Convert by value passing of nfc_target to pointer for str_nfc_target and nfc_initiator_target_is_present
This becomes more consistent with all other pass by pointer of most structures.
Additionally, this should lessen stack memory usage, as building strings with str_nfc_target would push the target (283 bytes) plus then a copy of the info objects (up to 275) onto the stack as it dives into the sprintf functions.

Lastly, this makes my attempt at a .NET wrapper easier, as I can make passing by pointer work, but passing by value seems to bomb on the interop right now.
2013-03-07 09:16:33 +01:00
Philippe Teuwen
048ed88e16 Fix cppcheck warning "Obsolete function 'usleep' called"
It is recommended to use the 'nanosleep' or 'setitimer' function instead.
2013-03-06 21:43:36 +01:00
Philippe Teuwen
d577fda412 Fix cppcheck warning "scanf without field width limits can crash with huge input data"
Fix following warnings:
[examples/pn53x-tamashell.c:162]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/acr122_pcsc.c:261]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/acr122s.c:441]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/arygon.c:210]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/arygon.c:522]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/pn532_uart.c:187]: (warning) scanf without field width limits can crash with huge input data
[utils/nfc-relay-picc.c:176]: (warning) scanf without field width limits can crash with huge input data
2013-03-06 00:52:08 +01:00
Philippe Teuwen
4822bb3e42 Fix bug introduced in some signal traps where context was not declared 2013-03-05 23:58:35 +01:00
Philippe Teuwen
e55efd6db0 examples/utils: add nfc_exit() to signal traps
and one missing nfc_abort_command()
2013-03-05 22:50:37 +01:00
Philippe Teuwen
73b5c9d0af nfc_init() return rather than exit on malloc error, examples fixed accordingly 2013-03-05 22:24:59 +01:00
Philippe Teuwen
bece73faaf Error conditions in utils & examples: fix leaks, unify style (see details)
* in main():
** errx()/err()/return -> exit()
** return values -> EXIT_SUCCESS & EXIT_FAILURE

* out of main:
** err()/errx()/exit() -> return
** change retval from size_t to int to allow returning errors
** don't use EXIT_SUCCESS / EXIT_FAILURE as retvals

* add nfc_close() & nfc_exit() to exit() on errors
* add missing fclose() on errors
* add missing test if (pnd == NULL)
* unify style if (pnd == / != NULL)
* remove goto's
* few related fixes
* remove if(pnd!=NULL) test on nfc_close() calls
2013-03-05 19:44:59 +01:00
Philippe Teuwen
232930c3d5 Fix resource leaks detected by cppcheck
[examples/pn53x-tamashell.c:94]: (error) Resource leak: input
[utils/nfc-mfultralight.c:264]: (error) Resource leak: pfDump
2013-03-04 01:06:16 +01:00
Philippe Teuwen
7af127ac0d pn53x-tamashell: allow larger commands up to full extended frame (264 bytes)
It was arbitrarily limited to MAX_FRAME_LEN-10 probably because of bug in LOG_HEX() fixed in previous commit
2013-02-21 22:36:23 +01:00
Alex Lian
4487fd768e Windows: Shift files from libnfc/windows to libnfc/contrib/win32
- Fixes the fact files were missed in package
2013-02-14 15:33:47 +01:00
Alex Lian
54e0bdb62f Windows: Build updates
- Generate rc files from version.rc.in + CMake variable information in CMakeLists files
- Add step to generate .lib file for windows developers
- Re-structure tool flag usage, apparently ADD_DEFINTIONS adds them to _ALL_ tools. This is bad for rc files with the windres tool.

Needs other platform testing, as the flags have changed to fix Windows rc file generation.
2013-02-01 10:19:02 -05:00
Nobuhiro Iwamatsu
50f5c610a1 Add man of nfc-emulate-forum-tag2 to the installation
Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
2013-02-01 01:57:47 +01:00
Romuald Conty
cd2b03a08a Add timeout parameter to nfc_emulate_target() function.
Fixes issue 219.

Thanks to raidolinja.
2013-01-30 00:10:24 +01:00
Ludovic Rousseau
109d496222 Compilation: Change the order of arguments
Put the -lnfc at the end of the command lie to avoid undefined
references on Ubuntu 12.04.

Close #219
2013-01-25 14:18:28 +01:00
Philippe Teuwen
9815ac728f nfc-emulate-uid: fix BCC 2013-01-22 00:45:42 +01:00
Romuald Conty
cbdac66fa4 Add quick start examples compliation to "make check" 2013-01-18 16:05:43 +01:00
Romuald Conty
995368cffa Update quick_start_examples 2012-12-05 02:05:16 +01:00
Romuald Conty
5b0e276572 Examples and utils are now updated to use the requiered nfc_context 2012-12-05 00:51:13 +01:00
Romuald Conty
3ee77eb79e Fix *transceive*() calls from examples and utils (bug introduced in previous commit) 2012-11-24 13:00:23 +01:00
Philippe Teuwen
7437f76007 simplify quick_start_example1 and add quick_start_example2 2012-11-16 12:25:27 +01:00
Philippe Teuwen
6c7c0a6e63 ReadMobib: make it compatible with Basic card 2012-11-10 17:11:48 +01:00
Romuald Conty
9afa3c6598 Use copyright format recommended by GNU project.
http://www.gnu.org/prep/maintain/html_node/Copyright-Notices.html
2012-10-21 14:09:16 +00:00
Philippe Teuwen
6e7fdb1c80 Adds nfc-emulate-forum-tag2 man page 2012-09-19 10:25:33 +00:00
Romuald Conty
310d7eba07 New str_nfc_target() function in API.
This allow to convert a nfc_target struct into allocated string.
2012-09-17 13:47:54 +00:00
Romuald Conty
b4ef1a3a5d New nfc_initiator_init_secure_element() function to set SAM as wired card (only relevant with a PN532 SAM-equipped) 2012-06-04 00:16:28 +00:00
Philippe Teuwen
568317929d astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux --pad-oper --unpad-paren --pad-header --align-pointer=name 2012-05-29 15:55:35 +00:00
Philippe Teuwen
01303fab0d astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux --pad-oper --unpad-paren --pad-header 2012-05-29 15:54:36 +00:00
Philippe Teuwen
562205cc14 astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux --pad-oper 2012-05-29 15:54:00 +00:00
Philippe Teuwen
67522bae65 astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 --brackets=linux 2012-05-29 15:53:43 +00:00
Philippe Teuwen
a2cd236441 astyle --formatted --mode=c --indent=spaces=2 --indent-switches --indent-preprocessor --keep-one-line-blocks --max-instatement-indent=60 2012-05-29 15:52:51 +00:00
Philippe Teuwen
26569c2202 Indent manually some comments to prepare astyle 2012-05-29 15:52:29 +00:00
Romuald Conty
26865bbc19 Remove extra whitespaces/tabs before EOL.
find . -name '*.[ch]' | xargs perl -pi -e 's/\t+$//; s/ +$//'

Thanks to Ludovic.
2012-05-29 00:33:22 +00:00
Romuald Conty
2c9275adde nfc_initiator_transceive_bytes() now take a constant size for Rx buffer to have a cleaner API: no more in/out parameters 2012-05-27 21:06:22 +00:00
Romuald Conty
531702a1fc example/pn532-sam: Fix few bugs in SAM example
- Fix choice input (Dual card mode was not available);
 - Fix segfault when target selection returns no target;
 - Use error label to close the device before exiting;
2012-05-20 23:09:21 +00:00
Ludovic Rousseau
48016fa297 warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') 2012-05-18 07:38:42 +00:00
Philippe Teuwen
4bfd6ac874 fix disruptancies between tools location in src (utils<>examples) and in Debian packages (libnfc-bin<>libnfc-examples) 2012-05-17 19:22:25 +00:00
Ludovic Rousseau
2c5bac191f Remove useless pointer cast 2012-05-17 07:17:10 +00:00
Ludovic Rousseau
551512ad54 Do not cast pointers to different size integers
It will work only on little endian machines.

Fix clang warning
pn53x-tamashell.c:163:40: warning: cast from 'uint8_t *' (aka 'unsigned char *')
      to 'unsigned int *' increases required alignment from 1 to 4
      [-Wcast-align]
      size = sscanf(cmd+offset, "%2x", (unsigned int*)&byte);
                                       ^~~~~~~~~~~~~~~~~~~~
2012-05-17 07:16:02 +00:00