Commit graph

45 commits

Author SHA1 Message Date
Philippe Teuwen
bb5b712a74 Adding link to AUTHORS in the copyright headers 2013-07-17 13:57:56 +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
bf164220ee Unify copyright notices & update authors lists 2013-03-10 16:15:23 +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
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
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
Romain Tartiere
2256d5d3dc Fix usage of possibly uninitialized 'result'.
Can't tell how gcc/clang fail to detect this…
2012-05-14 12:50:04 +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
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
1ec504e163 nfc_list_devices() function returns now the number of devices found. 2012-01-10 10:35:36 +00:00
Audrey Diacre
c10b473361 rx buffer size parameter of pn53x_transceive() function is now a const size_t. 2012-01-09 10:24:00 +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
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
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
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
8c7b61eaba move some examples to utils/ since they are not examples anymore :) (Fixes Issue 164) 2011-09-30 11:33:31 +00:00
Romain Tartiere
481fb4943f - Add timeout capablities to nfc_initiator_transceive_bytes(), nfc_target_send_bytes() and nfc_target_receive_bytes();
- Bump version to 1.5.1.
2011-09-22 13:03:47 +00:00
Romuald Conty
580768a489 pn53x-diagnose: uses config.h if present 2011-09-12 14:46:58 +00:00
Philippe Teuwen
80a5ad1fd6 More attempt to support Sony S360 reader
Initialisation of RC-S360 in mode 0
Better generic nfc-list, does not rely only on DeSelect to avoid duplicates
Restore SetParameters for RC-S360
Handle Diagnose communication test properly

Tested:
    - nfc-list          => ok except for B' & 3B
    - nfc-anticol       => fails to send raw frames before select
    - nfc-mfultralight  => ok
    - nfc-mfclassic     => ok
    - pn53x-tamashell   => ok
    - pn53x-diagnose    => ok
    - nfc-dep-initiator => ok
    - nfc-dep-target    => fails in InitAsTarget
    - nfc-emulate-*     => fails in InitAsTarget

Commands momentarily disabled for RC-S330:
    - InDeselect
    - InRelease
    - select_passive_target for B'& 3B
2011-06-07 20:36:20 +00:00
Philippe Teuwen
96538d052b Extend max length for firmware description & fix typo 2011-05-25 19:53:45 +00:00
Romuald Conty
59c4e69feb examples/pn53x-diagnose: fix memcmp strings coverage 2011-04-28 13:35:05 +00:00
Romuald Conty
7c274029e7 examples/pn53x-diagnose: fix PN53x commands and report internal error using nfc_perror() 2011-04-28 13:26:47 +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
1d085f21c9 Improve PN53x frame size calculation.
chips/pn53x: adjust size and defines to better handle reply size;
drivers/arygon: improve attempted reply size, should speed up the connexion;
drivers/pn532_uart: improve attempted reply size, should speed up the connexion;
2011-01-06 12:39:29 +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
a214974684 Remove INFO macro: display was not clear enough and does not provide a big benefit.
New Issue
Summary: Remove nfc-message.h file from installed ones
nfc-message.h provide some usefull debugging macros but I am not sure that these macros have to be installed with other files.
2010-10-26 14:27:17 +00:00
Romuald Conty
c34be50ef1 For the sake of consistency, rename all szRxLen to szRx and szTxLen to szTx 2010-10-12 14:56:42 +00:00
Romuald Conty
623c8bbeef Remove useless FIXME 2010-10-06 10:11:24 +00:00
Romuald Conty
17b940c610 Finalize pn53x-tamashell integration (add readline m4, fiw minor warnings, adjust Makefile.am) 2010-10-04 10:24:45 +00:00
Romuald Conty
18cc86a613 Indent whole code using make indent. (Fixes issue 84). 2010-09-07 17:51:03 +00:00
Romain Tartiere
0a09c8d8e7 Flag some problems in the examples. 2010-08-18 14:44:40 +00:00
Romain Tartiere
79aeaa6287 Factorise code.
Avoid redundant code in PN53x usb and uart drivers.  Since it makes sense to
report errors at the nfc_device_t level, pass it directly to
pn53x_transceive().

Programs using the libnfc MAY use pn53x_transceive() to communicate with a NFC
device, and SHALL not use anymore pnd->pdc->transceive().  Code in the library
itself SHOULD avoid calling pnd->pdc->transceive(), so such construct have been
updated accordingly.
2010-07-31 14:20:15 +00:00
Romain Tartiere
d8f12035fc Add missing carriage return at EOF (yes, I have nothing better to do ATM). 2010-06-26 21:56:32 +00:00
Romuald Conty
07a779c880 Add a small example to diagnose basic elements (communication, rom and ram) of pn53x. 2010-05-28 09:09:36 +00:00