Commit graph

266 commits

Author SHA1 Message Date
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
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
Ludovic Rousseau
56e44670a5 Log the device name if the open fails 2012-05-22 09:50:12 +00:00
Ludovic Rousseau
b237213f75 Log an error message if opening a device fails 2012-05-22 09:48:43 +00:00
Philippe Teuwen
969102c1a0 utils/nfc-list: always display the card type when a card is found 2012-05-18 21:54:45 +00:00
Ludovic Rousseau
beab815ecb warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') 2012-05-18 07:40:41 +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
Romuald Conty
cfd95bae2c Fix shadowed declaration warnings 2012-05-17 01:18:24 +00:00
Romuald Conty
e4802de965 Add new public functions to grab information in string format:
- New nfc_device_get_information_about()
 - Moved nfc-utils function str_nfc_baud_rate()
 - New str_nfc_modulation_type()
 - Add new device_get_information_about callback to nfc_driver struct
 - Export new symbols
 - Changed internal pn53x firmware text handling: we now store firmware text for further operations
 - print_nfc_target() now uses str_nfc_* functions
 - nfc-probe util now have a verbose which display information on detected devices (Fix verbose set but not used warning ;-) )
2012-05-17 00:48:47 +00:00
Philippe Teuwen
028db71d79 utils/nfc-emulate-forum-tag4: add support for v2.0 of the spec 2012-05-14 22:13:19 +00:00
Philippe Teuwen
7597055f26 fix typos 2012-05-14 19:44:03 +00:00
Romain Tartiere
e9b2f5729c Fix a bunch of warnings. 2012-05-14 13:47:31 +00:00
Ludovic Rousseau
59d47bc7da Add MIN/MAX declarations in nfc-internal.h and nfc-utils.h
Remove the now useless #include <sys/param.h>
2012-05-13 19:15:44 +00:00
Ludovic Rousseau
a2b022609f Fix some spelling mistakes
Closes Issue #196
2012-05-13 13:10:15 +00:00
Ludovic Rousseau
02cf0b3d60 Fix compiler warning
nfc-list.c:64: warning: no previous prototype for ‘print_usage’
2012-05-13 13:03:47 +00:00
Ludovic Rousseau
2e075df1a9 Fix compiler warnings
nfc-emulate-forum-tag4.c:117: warning: no previous prototype for ‘nfcforum_tag4_io’
nfc-emulate-forum-tag4.c:231: warning: no previous prototype for ‘stop_emulation’
nfc-emulate-forum-tag4.c:241: warning: no previous prototype for ‘ndef_message_load’
nfc-emulate-forum-tag4.c:269: warning: no previous prototype for ‘ndef_message_save’
nfc-emulate-forum-tag4.c:285: warning: no previous prototype for ‘usage’
2012-05-13 12:57:49 +00:00
Ludovic Rousseau
7f9ba48018 Fix compiler warnings
nfc-read-forum-tag3.c:63: warning: no previous prototype for ‘print_usage’
nfc-read-forum-tag3.c:70: warning: no previous prototype for ‘stop_select’
nfc-read-forum-tag3.c:80: warning: no previous prototype for ‘build_felica_frame’
nfc-read-forum-tag3.c:91: warning: no previous prototype for ‘nfc_forum_tag_type3_check’
2012-05-13 12:56:41 +00:00
Ludovic Rousseau
0926f8a7c9 Fix compiler warning
nfc-probe.c:64: warning: no previous prototype for ‘print_usage’
2012-05-13 12:55:26 +00:00
Ludovic Rousseau
b5e688e74a Fix compiler warnings:
nfc-relay-picc.c:76: warning: no previous prototype for ‘intr_hdlr’
nfc-relay-picc.c:85: warning: no previous prototype for ‘print_usage’
nfc-relay-picc.c:96: warning: no previous prototype for ‘print_hex_fd4’
nfc-relay-picc.c:118: warning: no previous prototype for ‘scan_hex_fd3’
nfc-relay-picc.c: In function ‘main’:
nfc-relay-picc.c:190: warning: function declaration isn’t a prototype
2012-05-13 12:53:34 +00:00
Philippe Teuwen
896fa54ece nfc-utils: some changes on the newly introduced fingerprinting method, see log for details
* avoid hardcoded list sizes in #define
* merge card_link data into const_ca
* indexes start at 0, not 1, and use -1 as marker rather than 0
* fix bug in DESFire ATQA
* remove CL1 entries for double size UIDs, in practice we'll always get the latest SAK of the cascade
* remove CL2 tags, cf previous point
* compact const_cs considering the previous points
* keep const_cs strings only where they are informative
* premature halt of inner loop if there is no more SAK index to treat
* change atqa & sak types to uint16_t & uint8_t

* skip redundant matches in the old fingerprinting method
2012-05-02 23:48:06 +00:00
Philippe Teuwen
b10de698dd nfc-utils: new fingerprinting method closer to AN10833, patch proposed by Balazs Bucsay (thanks!) 2012-05-02 23:47:57 +00:00
Philippe Teuwen
93157dd30d nfc-utils.h: rename function oddparity_bytes_ts() to be coherent with nfc-utils.c 2012-05-02 21:18:46 +00:00
Philippe Teuwen
1cf9154296 nfc-utils: fix bug (remaining calls to old OddParity table) 2012-05-02 21:18:31 +00:00
Philippe Teuwen
b84e3d0f20 nfc-utils: smaller oddparity code 2012-05-02 10:02:56 +00:00
Romuald Conty
82b2cfa883 Smart merge of acr122_usb branch: add acr122_usb driver without removing acr122_pcsc support. 2012-05-01 23:09:57 +00:00
Romain Tartiere
05789e5a68 Fix a couple warnings. 2012-03-01 13:33:13 +00:00
Romuald Conty
3eba0e9b54 Prepare libnfc 1.6.0-rc1 2012-03-01 12:00:23 +00:00
Romuald Conty
75e776ffd0 utils/nfc-mfclassic: remove non-conscistent "extract payload" option in nfc-mfclassic and use MIFARE instead of Mifare typo (Thanks to Thomas Hood) 2012-02-15 13:41:38 +00:00
Audrey Diacre
983d4932f3 documentation: add utils and examples and hide internal files. 2012-01-31 14:28:45 +00:00
Romuald Conty
24e298626a libnfc-1.5-acr122-usb> fix minor bugs and apply pn53x_usb's patch to be used under FreeBSD too 2012-01-26 21:36:08 +00:00
Audrey Diacre
26245add73 Merge libnfc-1.5-new-api branch to trunk (r1168:1303). 2012-01-25 09:56:05 +00:00
Audrey Diacre
5a475cf074 add some whitespaces 2012-01-20 09:17:38 +00:00
Audrey Diacre
4c011279ff add context to nfc_init(), nfc_exit(), nfc_open() and nfc_list_devices() functions. 2012-01-18 16:22:06 +00:00
Romuald Conty
b366b8c027 add nfc_device_get_connstring() function and nfc-probe example to show devices connection strings 2012-01-18 13:17:01 +00:00
Audrey Diacre
207199dc34 examples, test and utils use now nfc_exit() function. 2012-01-18 11:36:18 +00:00
Audrey Diacre
1d55b6f8c6 examples, test and utils use now nfc_init() function. 2012-01-18 11:09:01 +00:00
Audrey Diacre
324af418db rename nfc_connect() function to nfc_open(). 2012-01-17 15:21:56 +00:00
Audrey Diacre
9eb37b3eee rename nfc_disconnect() function to nfc_close(). 2012-01-17 14:52:39 +00:00
Romain Tartiere
2d393bff91 Make these function accept no argument (instead of any). 2012-01-15 11:06:24 +00:00
Audrey Diacre
1ec504e163 nfc_list_devices() function returns now the number of devices found. 2012-01-10 10:35:36 +00:00
Audrey Diacre
00818e048c rx buffer size parameter of nfc_target_init() function is now a const size_t. 2012-01-09 11:26:57 +00:00
Romuald Conty
7df3bb5aeb various minor fixes/enhancements 2012-01-06 13:08:16 +00:00
Romuald Conty
48e92149e4 drop log4c support 2012-01-06 13:05:10 +00:00
Romuald Conty
22bea8d99b nfc_target_receive_*() need to know rx buffer size 2012-01-05 21:35:02 +00:00
Audrey Diacre
601105ef79 fix bad cast done in last revision. 2012-01-05 17:03:38 +00:00
Audrey Diacre
642f9a38f7 nfc_target_receive_bytes() function does not now use pszRx as parameter because this function returns it. 2012-01-05 16:33:55 +00:00
Audrey Diacre
239fd750c4 add timeout on nfc_target_init() and this function returns now received bytes count on success. 2012-01-05 15:10:11 +00:00
Audrey Diacre
c80ebdca25 nfc_abort_command() function returns now 0 on success and libnfc error code on failure and fix some warnings. 2012-01-05 14:49:02 +00:00
Audrey Diacre
5a1f0c2115 check result of nfc_initiator_init() function in examples/ and utils/ 2012-01-05 10:33:50 +00:00
Romuald Conty
125553c72e verbose option back for nfc-list, and newly implemented in nfc-poll 2012-01-04 21:29:43 +00:00
Audrey Diacre
6e7092b160 nfc_initiator_transceive_bits() function does not now use pszRxBits as parameter because this function returns it. 2012-01-04 15:30:42 +00:00
Audrey Diacre
61074f3497 nfc_initiator_transceive_bits() function returns now received bits count on success and libnfc error code on failure. 2012-01-04 11:46:07 +00:00
Audrey Diacre
9c1371dcca nfc_target_send_bytes() function returns now sent bytes count on success and libnfc error code on failure. 2011-12-22 15:59:08 +00:00
Audrey Diacre
ac6f652368 nfc_target_receive_bytes() function returns now received bytes count on success and libnfc error code on failure. 2011-12-22 15:39:51 +00:00
Audrey Diacre
f93bc59504 nfc_initiator_select_passive_target() function returns now the selected passive targets count on success. 2011-12-21 11:33:21 +00:00
Audrey Diacre
c41d7de8ca nfc_initiator_select_dep_target() function returns nox libnf error code and fix some uses of nfc_initiator_transceive_bytes() function. 2011-12-21 09:15:44 +00:00
Audrey Diacre
103485518c nfc_initiator_select_passive_target() function returns now libnfc error code. 2011-12-19 16:27:50 +00:00
Audrey Diacre
ba2a7cfe2e nfc_target_init() function returns now 0 on succes and libnfc error code on failure. 2011-12-19 15:35:37 +00:00
Romuald Conty
bf7c36d9bb less structs and defines publicly exposed
- nfc_device is now an opaque type;
 - PN53x specific errors are not public anymore;
 - nfc_device_name() renamed to nfc_device_get_name() for the sake of consistency;
 - examples/*, utils/* uses the new nfc_device_get_name() function instead of access directly to struct's content;
 - new error defined: NFC_ERFTRANS for notifying about RF transmission error, its used by mifare.c to detect permissions error on mifare;
 - drivers initiator_transceive_bytes() function now returns libnfc's error code on failure (<0), and received bytes count on success (>=0);
 - remove some unused errors.
2011-12-19 00:23:21 +00:00
Audrey Diacre
98355d36a7 nfc_initiator_init returns now error code and nfc_initiator_list_passive_targets returns now the number of targets found or error code. 2011-12-15 11:46:14 +00:00
Audrey Diacre
a615d969fd nfc_properties replace now nfc_options and nfc_configure is replaced by nfc_device_set_property_bool which returns error code. 2011-12-14 16:01:00 +00:00
Audrey Diacre
8b76d55fdc test/test_dep_active: fix multiple active DEP baudrates. 2011-12-14 10:31:08 +00:00
Audrey Diacre
52bc5853d8 Remove whitespace after star symbol for pointers 2011-11-25 15:21:10 +00:00
Audrey Diacre
5c7454a2f7 Timeout is now integer. 2011-11-25 11:37:30 +00:00
Audrey Diacre
784a2f86a2 Change byte_t type to uint8_t (Fixes Issue 147) 2011-11-24 10:54:42 +00:00
Audrey Diacre
ce846931bc Move nfc-emulate-forum-tag2 from utils to examples. 2011-11-24 10:27:02 +00:00
Audrey Diacre
c718fafee7 Massive code clean up: (Fixes Issue 161)
- Remove typedef from internal structs
- Remove _t suffix from types
- Fix tests using connstrings
2011-11-23 15:55:40 +00:00
Audrey Diacre
54b6827971 add missing manpages. 2011-11-22 15:23:18 +00:00
Romuald Conty
2e2d091bfd nfc-list: continue to attempt to reach devices after a connection failure. 2011-10-27 13:46:13 +00:00
Romuald Conty
55daa29a7c Allow to connect to a device using a connection string:
- Provide a nfc_get_default_device() that allow to grab the connstring stored
   in LIBNFC_DEFAULT_DEVICE environnement variable or returns the first
   available device if not set;
 - nfc_connect(NULL) now takes the default device (see
   nfc_get_default_device());
 - Removes nfc_driver_desc_t from public types
 - Defines nfc_connstring as char[1024]
 - examples/*: use nfc_connstring
 - examples/nfc-poll: now uses only the default device (instead of all devices
   availables)
 - Removes parse_args() from nfc-utils.[hc]
2011-10-17 13:03:56 +00:00
Romuald Conty
dc842a844c examples/nfc-read-forum-tag3: add new example to read a NFC Forum Tag Type 3 2011-10-10 00:40:34 +00:00
Romuald Conty
66e3ea6146 nfc-relay-picc.1 was missing from tarball 2011-10-03 11:16:42 +00:00
Romuald Conty
b2666dea15 windows port improved:
- PCSC headers/libs are not a requierement sif you dont select ACR122 driver
 - uart_win32 implementation now handles timeouts
2011-10-01 14:50:53 +00:00
Romuald Conty
d286a3c4b7 make distcheck OK 2011-10-01 13:29:18 +00:00
Romuald Conty
03a6f5e29c Update examples and utils manpages.(Fixes Issue 159) 2011-10-01 12:26:11 +00:00
Romuald Conty
8c7b61eaba move some examples to utils/ since they are not examples anymore :) (Fixes Issue 164) 2011-09-30 11:33:31 +00:00