Commit graph

51 commits

Author SHA1 Message Date
Philippe Teuwen
d9b531f50f Verify return of nfc_device_set_property_bool()
Problem reported by Coverity
CID 1090319 (#1 of 1): Unchecked return value (CHECKED_RETURN)
  unchecked_value: No check of the return value of "nfc_device_set_property_bool(pnd, NP_EASY_FRAMING, nt.nti.nai.btSak & 0x20)".
CID 1090320 (#1 of 1): Unchecked return value (CHECKED_RETURN)
  unchecked_value: No check of the return value of "nfc_device_set_property_bool(dev, NP_HANDLE_CRC, false)".
CID 1090324 (#1 of 2): Unchecked return value (CHECKED_RETURN)
  unchecked_value: No check of the return value of "nfc_device_set_property_bool(pnd, NP_ACTIVATE_FIELD, true)".
CID 1090325 (#1 of 1): Unchecked return value (CHECKED_RETURN)
  unchecked_value: No check of the return value of "nfc_device_set_property_bool(pnd, NP_AUTO_ISO14443_4, false)".
2013-09-22 01:31:45 +02:00
Philippe Teuwen
bb5b712a74 Adding link to AUTHORS in the copyright headers 2013-07-17 13:57:56 +02:00
Philippe Teuwen
0841a94c65 nfc-mfclassic: allow option f for read operation too 2013-04-09 23:42:55 +02:00
Romuald Conty
e6ab66037d Better support for some special chinese cards
Fixes issue 190
2013-04-05 11:29:31 +02:00
Philippe Teuwen
e70a3314bf Update ChangeLog & make style 2013-03-12 17:07:09 +01:00
Philippe Teuwen
20e51e9752 nfc-mfclassic: add option to allow using keyfile from another card 2013-03-12 15:39:57 +01:00
Philippe Teuwen
16161e1a68 nfc-mfclassic: detect 2K MFP via RATS 2013-03-12 14:15:04 +01:00
Philippe Teuwen
56ea2e65dc nfc-mfclassic: use smaller files for cards < 4k 2013-03-12 10:56:57 +01:00
Philippe Teuwen
94617366a7 nfc-mfclassic: abort if expected UID is not matching real card 2013-03-12 10:56:20 +01:00
Philippe Teuwen
bb7b05681e nfc-mfclassic: fix reporting of processed blocks number 2013-03-12 10:55:45 +01:00
Philippe Teuwen
bf164220ee Unify copyright notices & update authors lists 2013-03-10 16:15:23 +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
f0d5896140 Fix cppcheck style: "The scope of the variable can be reduced" 2013-03-06 11:02:47 +01:00
Philippe Teuwen
4769392157 Fix cppcheck style: scope of variable can be reduced
Fix the following cppcheck warnings:
[libnfc/drivers/pn532_uart.c:492]: (style) The scope of the variable 'res' can be reduced
[libnfc/chips/pn53x.c:320]: (style) The scope of the variable 'res' can be reduced
[libnfc/chips/pn53x.c:616]: (style) The scope of the variable 'res' can be reduced
[libnfc/nfc.c:356]: (style) The scope of the variable '_device_found' can be reduced
[utils/nfc-mfclassic.c:178]: (style) The scope of the variable 'key_index' can be reduced
2013-03-06 00:35:36 +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
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
Philippe Teuwen
386e08d8b3 Fix nfc_initiator_select_passive_target() in several utils if tag is missing 2013-02-01 20:52:49 +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
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
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
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
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
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
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
26245add73 Merge libnfc-1.5-new-api branch to trunk (r1168:1303). 2012-01-25 09:56:05 +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
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
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
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
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
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
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
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
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