Commit graph

256 commits

Author SHA1 Message Date
Ludovic Rousseau
e7290de83b Fix compiler warning
nfc.c:121: warning: function declaration isn't a prototype
nfc.c: In function 'nfc_drivers_init':
nfc.c:121: warning: old-style function definition
2013-03-02 11:30:24 +01:00
Philippe Teuwen
a6c405a5d5 malloc/free: some more cleaning & checking malloc errors 2013-03-02 02:51:33 +01:00
Philippe Teuwen
7e3549819e Split --disable-conf into --disable-conffiles & --disable-envvars 2013-02-22 21:53:16 +01:00
Ahti Legonkov
fd6d4db5b7 Make it possible to disable conf.
Now the configure script has --disable-conf command-line argument
that can be used to turn off environment variables and use of
configuration files.
2013-02-22 21:09:46 +01:00
Philippe Teuwen
72b10c5d9b Fix warnings: ignoring return value of 'pipe' & discarding const qualifier 2013-02-21 23:20:28 +01:00
Philippe Teuwen
24e1edd858 make style 2013-02-21 22:39:39 +01:00
Romuald Conty
7e26869b68 Fixes nfc_drivers memory leak 2013-02-21 19:58:40 +01:00
Romuald Conty
1e16795341 'make style' and align some #preprocessor directives 2013-02-19 00:43:20 +01:00
Philippe Teuwen
09ce0e822c nfc_free(): fix related doc 2013-02-16 22:18:00 +01:00
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
lego
225094e2c8 Add nfc_register_driver. Issue 137.
The nfc_register_driver allows users of the library to write their
own device drivers without needing to resort to hacking libnfc itself.
2013-02-01 14:40:40 +02:00
Philippe Teuwen
8bc7a1c291 call idle() from driver-dependent close() rather than from nfc_close() as some driver still need to do an ack() before 2013-01-31 01:18:23 +01:00
Romuald Conty
4b97700352 Removes exit() calls
Fixes issue 220

exit() was used to run abort-driven development while API changed, I forgot to remove them, sorry for that :-)
2013-01-28 13:57:40 +01:00
Philippe Teuwen
edacadbce6 make style 2013-01-20 15:48:32 +01:00
Philippe Teuwen
bcd53a7cdc Fix double malloc 2013-01-20 15:24:03 +01:00
Philippe Teuwen
04a7d2a3ba Allow device.optional=true to tolerate missing device 2013-01-18 22:54:44 +01:00
Romuald Conty
443f70dd65 Fix wrong condition to display a warning when user disables autoscan 2013-01-18 18:14:59 +01:00
Romuald Conty
f2be582cd5 Fix timeout documentation 2013-01-15 14:22:21 +01:00
Romuald Conty
82c41b4fc1 Fixes style: make style 2012-12-09 20:09:55 +01:00
Romuald Conty
8f015c4369 Suppress warnings: "ISO C99 requires rest arguments to be used" 2012-12-05 16:53:43 +01:00
Romuald Conty
dc949c257e Removes nfc_get_default_device() function.
The nfc_get_default_device() is not needed anymore since the first element from returned nfc_connstring list of nfc_list_devices() function.
Plus, nfc_open() can be use with NULL nfc_connstring which will select automatically the first available device (ie. the default one).
2012-12-05 00:51:13 +01:00
Romuald Conty
84dc268781 New feature: user can define a device by conf file. 2012-12-05 00:51:13 +01:00
Philippe Teuwen
2651cdce2e Remove last SVN cruft 2012-11-27 18:56:54 +01:00
Romuald Conty
9b3947b8ed Improves log feature:
* Add --disable-log
  * Add a log level filter, configurable using conf file (ie. /etc/nfc/libnfc.conf) or environment var LIBNFC_LOG_LEVEL
2012-11-26 21:02:03 +01:00
Romuald Conty
4722b7dd97 SVN_REVISION is not relevant anymore, use GIT_REVISION (git describe) instead. 2012-11-24 20:11:12 +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
Romuald Conty
6650105174 Add some functions parameters documentation. 2012-11-23 16:58:10 +01:00
Romuald Conty
c239873634 Add missing NFC_EMFCAUTHFAIL error string. 2012-11-23 16:55:45 +01:00
Romuald Conty
dd451da4a5 Change *transceive*() API to be closer to *transceive_bytes.
Warning: only prototypes have been changed, implementation does not take care about buffer size.

New issue
Summary: Implement buffer overflow protection on all *transceive*() functions
*transceive*() functions do have an argument for rx buffer but some of them dont use it to protect user from buffer overflow.
2012-11-23 16:54:38 +01:00
Philippe Teuwen
fda8d60ce0 Adapt *transmit_bytes_timed API to be closer to *transmit_bytes 2012-11-12 16:54:03 +01:00
Romuald Conty
9f90a04a84 nfc_initiator_transceive_bytes() returns NFC_EMFCAUTHFAIL when AUTH command failed on a Mifare Classic 2012-11-01 01:27:06 +01:00
Romuald Conty
397222c33f Removes --enable-serial-autoprobe option at compile and replace this feature by LIBNFC_INTRUSIVE_SCAN environment variable at run time. 2012-10-21 14:11:38 +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
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
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
2aba0f962a documentation: add missing group description 2012-09-17 13:47:18 +00:00
Romuald Conty
3cd6015c81 minor header cleanup 2012-09-17 13:47:11 +00:00
Romuald Conty
ab312299d6 pn53x_reset_settings() now resets CRC, parity, easyframing and crypto1.
These settings are quite specifics and should be reset in other functions that call pn53x_reset_settings() too: i.e. nfc_initiator_init_secure_element()
2012-06-12 16:46:20 +00:00
Philippe Teuwen
4b5b45f14a Add "usb" keyword support to connstring to specify all usb drivers at once 2012-06-06 01:10:05 +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
Romuald Conty
f47af31fb7 Indent correctly previous commit (make style) 2012-06-03 21:05:26 +00:00
Romuald Conty
2b81baa14f Add documentation related to previous commit (NFC_ETGRELEASED on MFC AUTH failure) 2012-06-03 21:02:38 +00:00
Romuald Conty
d7e7979580 Listing passive targets now quit earlier if szTargets count is reached and in that case, leave with the latest tag selected.
That's quite useful when you need to directly use 1 target because in contrast of nfc_initiator_select_passive_target, you don't need to prepare initiator data by hands
2012-05-30 23:02:41 +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
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
8f08431ddf New function nfc_initiator_target_is_present() to test is a previously selected target is in the field. 2012-05-27 22:34:21 +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