Commit graph

60 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
d8a93217ff make style 2013-03-07 09:17:27 +01:00
Philippe Teuwen
048ed88e16 Fix cppcheck warning "Obsolete function 'usleep' called"
It is recommended to use the 'nanosleep' or 'setitimer' function instead.
2013-03-06 21:43:36 +01:00
Philippe Teuwen
d577fda412 Fix cppcheck warning "scanf without field width limits can crash with huge input data"
Fix following warnings:
[examples/pn53x-tamashell.c:162]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/acr122_pcsc.c:261]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/acr122s.c:441]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/arygon.c:210]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/arygon.c:522]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/pn532_uart.c:187]: (warning) scanf without field width limits can crash with huge input data
[utils/nfc-relay-picc.c:176]: (warning) scanf without field width limits can crash with huge input data
2013-03-06 00:52:08 +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
7af127ac0d pn53x-tamashell: allow larger commands up to full extended frame (264 bytes)
It was arbitrarily limited to MAX_FRAME_LEN-10 probably because of bug in LOG_HEX() fixed in previous commit
2013-02-21 22:36:23 +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
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
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
Ludovic Rousseau
2c5bac191f Remove useless pointer cast 2012-05-17 07:17:10 +00:00
Ludovic Rousseau
551512ad54 Do not cast pointers to different size integers
It will work only on little endian machines.

Fix clang warning
pn53x-tamashell.c:163:40: warning: cast from 'uint8_t *' (aka 'unsigned char *')
      to 'unsigned int *' increases required alignment from 1 to 4
      [-Wcast-align]
      size = sscanf(cmd+offset, "%2x", (unsigned int*)&byte);
                                       ^~~~~~~~~~~~~~~~~~~~
2012-05-17 07:16:02 +00:00
Ludovic Rousseau
d28889c696 Remove now useless #define for getline()
getline() is no more used. So no need to use this ugly hack.

This also solves a compiler warning;
In file included from ../libnfc/log.h:22:0,
                 from ../libnfc/chips/pn53x-internal.h:28,
                 from ../libnfc/chips/pn53x.h:31,
                 from pn53x-tamashell.c:68:
../config.h:153:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
/usr/include/features.h:165:0: note: this is the location of the previous definition
2012-05-15 07:57:37 +00:00
Ludovic Rousseau
b65c133f80 stdin is already defined by stdio.h
Fix compiler warnings:

pn53x-tamashell.c: In function ‘main’:
pn53x-tamashell.c:79: warning: nested extern declaration of ‘__stdinp’
pn53x-tamashell.c:79: warning: redundant redeclaration of ‘__stdinp’
/usr/include/stdio.h:164: warning: previous declaration of ‘__stdinp’
was here
2012-05-13 12:42:51 +00:00
Ludovic Rousseau
e60f4ef870 Fix compiler warning
pn53x-tamashell.c:106: warning: initialization discards qualifiers from
pointer target type
2012-05-13 12:41:17 +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
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
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
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
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
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
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
Philippe Teuwen
9a101943b8 tamashell: now pause in milliseconds 2011-04-08 19:50:09 +00:00
Philippe Teuwen
35e9696ada pn53x-tamashell properly properly fixed 2011-03-10 14:43:59 +00:00
Philippe Teuwen
5bc113792b pn53x-tamashell properly fixed 2011-03-10 14:38:50 +00:00
Philippe Teuwen
351f08a54b pn53x-tamashell: fixed with new API 2011-03-09 14:45:22 +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
Philippe Teuwen
5df49391a9 pn53x-tamashell: add pause command & doc 2011-02-18 22:05:36 +00:00
Philippe Teuwen
287bbfeea3 pn53x-tamashell: fix bug introduced by r878 2011-02-10 14:29:29 +00:00