Commit graph

62 commits

Author SHA1 Message Date
Philippe Teuwen
e2135dbaa5 pn53x-sam: fix truncated stdio return value
Problem reported by Coverity:
CID 1090318 (#1 of 1): Truncated stdio return value (CHAR_IO)
char_io: Assigning the return value of "getchar(void)" to char "input" truncates its value
2013-09-22 02:38:17 +02:00
Philippe Teuwen
bb5b712a74 Adding link to AUTHORS in the copyright headers 2013-07-17 13:57:56 +02:00
Philippe Teuwen
bf164220ee Unify copyright notices & update authors lists 2013-03-10 16:15:23 +01:00
Philippe Teuwen
181cd914d5 pn53x-sam: fix print_nfc_target 2013-03-07 09:17:11 +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
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
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
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
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
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
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
cf56496ee9 Fix compiler warning
pn53x-sam.c:120: warning: enumeration value ‘PSM_NORMAL’ not handled in
switch
2012-05-16 19:06:42 +00:00
Ludovic Rousseau
61ba0478cd Fix compiler warning
pn53x-sam.c:56: warning: no previous prototype for ‘wait_one_minute’
2012-05-13 12:32:30 +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
00818e048c rx buffer size parameter of nfc_target_init() function is now a const size_t. 2012-01-09 11:26:57 +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
5a1f0c2115 check result of nfc_initiator_init() function in examples/ and utils/ 2012-01-05 10:33:50 +00:00
Audrey Diacre
9c5ec3c4e1 the following functions now return libnfc error code:
_pn53x_write_register()
_pn53x_WriteRegister()
_pn53x_transceive()
_pn53x_SAMConfiguration()
_pn53x_PowerDown()
 _pn53x_InListPassiveTarget()
_pn53x_InDeselect()
_pn53x_InRelease()
_pn53x_RFConfiguration__*
2011-12-20 11:25:33 +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
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
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
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
Romuald Conty
8f7834c625 drivers/arygon,pn532_uart,pn53x_usb: all PN53x commands are now cancelable 2011-09-29 14:53:52 +00:00
Romuald Conty
e6051ceca4 chip/pn53x: clean up SAMConfiguration usage. 2011-06-27 17:12:25 +00:00
Philippe Teuwen
96538d052b Extend max length for firmware description & fix typo 2011-05-25 19:53:45 +00:00
Philippe Teuwen
4124dc662d Cleanup of initializations 2011-05-05 10:12:26 +00:00
Romuald Conty
5db8be908b Windows support contribution:
- Move CMake modules from cmake_modules/ to cmake/modules/
 - CMake now use cmake/config_windows.h.cmake to create config.h on Windows platform
 - contrib/windows.h header is automagically included by config.h
 - Put missing NFC_EXPORT macro on front of emulation API
 - nfc-mfclassic and nfc-mfcultralight examples are now compiled under Windows
Many thanks to Glenn Ergeerts which provide the initial patch.
2011-03-31 13:38:49 +00:00
Philippe Teuwen
3dc8d6c97c pn53x-sam: fixed with new API 2011-03-09 14:49:38 +00:00
Romuald Conty
dba06a555e remove nfc-message.h usage from examples. 2011-03-05 08:53:46 +00:00
Romuald Conty
7ec1080e16 Remove a dummy argument in pn53x_transceive(). 2011-03-02 15:32:52 +00:00
Romuald Conty
4b6ba0aa3c Always set the size of Rx buffer (prevent from overflow) 2011-03-02 15:02:30 +00:00
Romuald Conty
5af845cdfc Broke whole the libnfc :-)
use a new way to handle drivers
use absolute include path instead of relative ones
move some nfc_device_t members in a better place
nfc_device_t now embeddeds driver data and chip data pointers (useful to be more generic)
use more readable variables instead of strange coding convention
move PRINT_HEX macro into nfc-internal.h
silent warnings with more strict CFLAGS
chips/pn53x: use the powerful C99 writing to construct PN53x commands
chips/pn53x: remove almost all memcpy()
chips/pn53x: WriteRegister, ReadRegister and SetParameters command wrappers are correctly named
chips/pn53x: introduce chip state (SLEEP, NORMAL or EXECUTE)
chips/pn53x: add SAMConfiguration command wrapper (need to be improved)
chips/pn53x: remove almost all const arrays
chips/pn53x: use human readable defines for commands instead of hex values
chips/pn53x: in debug mode, the PN53x command is shown in human-readable string, awesome isn't it? ;-)
drivers: split transceive() into send() and receive() to be able to handle more cases (differed replies, abort commands, etc) later
drivers: use a const structure of functions instead of -dirty- callbacks array
drivers/pn532_uart: major improvement of UART handling
drivers/pn532_uart: check PN53x frames when received
buses/uart: receive() is now based on expected bytes instead of calculated timeouts..
buses/uart: use a smart way to determine available ports on POSIX systems (tested on Linux and FreeBSD)
2011-03-02 15:00:44 +00:00
Romuald Conty
979fc1b5f5 examples: fix broken internal pn53x API. 2011-03-01 11:26:00 +00:00
Romuald Conty
4384d27f3e examples: silent some compilation warnings. 2011-02-28 09:47:31 +00:00
Romuald Conty
5e9e177319 Change examples license for the sake of consistency: LGPL covers library, re-usable examples code is now under BSD license. 2010-11-17 14:27:11 +00:00
Romuald Conty
58dcf63e7c MERGE: libnfc-mingw-cross merge with trunk (r805-821) 2010-11-17 08:29:41 +00:00