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
b68a37b835
Replace usb_set_debug() in utils by new group in LIBNFC_LOG_LEVEL
...
To use it: (NFC_LOG_PRIORITY_DEBUG * 2 ^ NFC_LOG_GROUP_LIBUSB)
LIBUSB_LOG_LEVEL=12288
2013-03-02 23:43:37 +01:00
Philippe Teuwen
b1448f6785
nfc-mfclassic: add option to tolerate RW errors & other enhancements
...
Reconciliate read & write operations.
Add option to tolerate or not RW failures.
Print success/failure for each block as ACL is per block.
2013-03-02 22:29:10 +01:00
Ludovic Rousseau
bd8a9fe96e
Remove dead code
...
The local variable bFailure is set before a return.
nfc-mfclassic.c:319:11: warning: Value stored to 'bFailure' is never read
bFailure = true;
^ ~~~~
2013-03-02 13:24:12 +01:00
Romuald Conty
2506ee35f6
Fixes invalid example in nfc-scan-device manpage
2013-03-01 17:07:40 +01:00
Philippe Teuwen
5ced93fcbf
Makefile.am: move header files from noinst_HEADERS to _SOURCES
...
Ensures proper recompilation when a header file is edited.
cf https://www.gnu.org/software/automake/manual/html_node/Headers.html
2013-02-21 22:37:20 +01:00
Romuald Conty
1e16795341
'make style' and align some #preprocessor directives
2013-02-19 00:43:20 +01:00
Romuald Conty
f8601886fd
Adds nfc_free() function to freed allocated buffers
...
Fixes issue 228 (Thanks to Alex Lian)
2013-02-16 14:20:37 +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
Romuald Conty
89b177c58a
Merge Alex Lian branch
2013-02-04 10:16:32 +01:00
Philippe Teuwen
4d0ee443d1
Fix crash in nfc-relay-picc -i/-t if fd3 or fd4 is missing
2013-02-01 21:55:29 +01:00
Philippe Teuwen
386e08d8b3
Fix nfc_initiator_select_passive_target() in several utils if tag is missing
2013-02-01 20:52:49 +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
Alex Lian
caa09db5fc
Merge remote-tracking branch 'refs/remotes/libnfc/master'
...
Conflicts:
contrib/windows.h
libnfc/CMakeLists.txt
libnfc/log-printf.c
utils/CMakeLists.txt
2013-01-31 22:17:33 -05:00
Philippe Teuwen
06bfed11b9
Various typos
2013-01-31 21:58:29 +01:00
Romuald Conty
acdde1088c
Renames contrib/win32/nfc_win32.c to contrib/win32/stdlib.c
2013-01-31 16:09:41 +01:00
Romuald Conty
c01b961be0
Fixes CMake under GNU/Linux
2013-01-31 16:04:47 +01:00
Romuald Conty
3fff5985fc
Moves Windows conditional code to dedicated files
2013-01-31 15:58:20 +01:00
Alex Lian
87182b5a65
Windows: Fix nfc-scan-device to compile by linking in contrib/nfc_win32.c
...
Re-factored the executable call with a list that is created, so that its easier to modify per tool.
2013-01-31 15:52:40 +01:00
Alex Lian
9eeaf33b94
Windows: getopt usage in nfc-read-forum-tag3 fixed by referencing correct header
2013-01-31 15:52:39 +01:00
Alex Lian
3c9d9a872c
Fix all utils compilation on windows.
...
- As nfc-utils now references str_nfc_target from the lib itself, so the static lib was not properly referencing the libnfc itself, so the final utility link would fail.
- Simply added the libnfc as a target for the static nfcutils library internal to cmake
2013-01-31 15:52:39 +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
Philippe Teuwen
b675db73be
nfc-scan-device: fix option -i
2013-01-29 13:52:53 +01:00
Alex Lian
88fd42a89d
Windows: Fix nfc-scan-device to compile by linking in contrib/nfc_win32.c
...
Re-factored the executable call with a list that is created, so that its easier to modify per tool.
2013-01-27 23:24:03 -05:00
Alex Lian
3c9cfc5036
Windows: getopt usage in nfc-read-forum-tag3 fixed by referencing correct header
2013-01-27 23:22:35 -05:00
Alex Lian
5aab7513cf
Fix all utils compilation on windows.
...
- As nfc-utils now references str_nfc_target from the lib itself, so the static lib was not properly referencing the libnfc itself, so the final utility link would fail.
- Simply added the libnfc as a target for the static nfcutils library internal to cmake
2013-01-27 23:08:22 -05:00
Philippe Teuwen
5876e33e49
Fix returned value ((res=f()<0)) => ((res=f())<0); this solves a bug in nfc-relay-picc
2013-01-22 00:56:34 +01:00
Philippe Teuwen
0ac3b26982
nfc-relay-picc: Fix received bytes count
2013-01-22 00:54:47 +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
7963fdfc3b
Import code to load configuration from file.
...
WARNING: This commit do not contains a fully cleaned code:
- Only nfc-list have been tested
- Some -commented- code is not used ATM
- Some printf-as-debug remain in this commit
... but that a bit usable so... happy hacking ;-)
2012-11-24 13:10:52 +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
6c7c0a6e63
ReadMobib: make it compatible with Basic card
2012-11-10 17:11:48 +01:00
Romuald Conty
56f9de23be
Autotools now distributes nfc-read-forum-tag3 man page in tarball
2012-10-30 22:59:43 +01:00
Romuald Conty
d6c97cb974
Fixes CMake build (Fixes Issue 211).
...
Thanks to Alex Lian
2012-10-30 22:29:13 +01:00
Romuald Conty
bed1d4ba5e
Add -i option to nfc-scan-device to allow intrusive scan and add a manpage for this util.
2012-10-21 14:12:04 +00:00
Romuald Conty
b5aa91fd62
Use a more appropriated term regarding device detection: from probe to scan
...
- Rename nfc-probe to nfc-scan-device
- Rename internal drivers function prototypes: _probe to _scan
- Revamp _scan function prototype: it now returns device found count
2012-10-21 14:11:17 +00: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
2a1558fb32
Deleting manpage present already twice
2012-09-28 09:16:30 +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
82e3416619
minor header clean up
2012-09-17 13:47:43 +00:00
Romuald Conty
de827ab583
nfc_device_get_information_about() now allocates returned string.
...
Note: must be freed by free().
2012-09-17 13:47:30 +00:00
Romuald Conty
ce443d50ca
Rename abtUid from struct mifare_param_auth into abtAuthUid: this is not the UID while using 7-bytes UID MIFARE Classic tags.
2012-06-03 21:02:54 +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