Commit graph

177 commits

Author SHA1 Message Date
Audrey Diacre
1ec504e163 nfc_list_devices() function returns now the number of devices found. 2012-01-10 10:35:36 +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
Romuald Conty
22bea8d99b nfc_target_receive_*() need to know rx buffer size 2012-01-05 21:35:02 +00:00
Audrey Diacre
642f9a38f7 nfc_target_receive_bytes() function does not now use pszRx as parameter because this function returns it. 2012-01-05 16:33:55 +00:00
Audrey Diacre
7e7ee3299e nfc_target_receive_bits() function does not now use pszRxBits as parameter because this function returns it. 2012-01-05 15:50:07 +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
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
331234713d nfc_idle() function returns now 0 on success and libnfc error code on failure. 2012-01-05 08:57:16 +00:00
Romuald Conty
93b34fa70b enhance new error handling
- add accessor to last error occured
- add new public error NFC_ETGRELEASED (Target Released)
2012-01-05 01:39:10 +00:00
Audrey Diacre
a41b2b0da8 nfc_initiator_transceive_bytes_timed() function does not now use pszRx as parameter because this function returns it. 2012-01-04 15:53:41 +00:00
Audrey Diacre
b699743973 nfc_initiator_transceive_bits_timed() function does not now use pszRxBits as parameter because this function returns it. 2012-01-04 15:43:08 +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
0de1136037 nfc_target_receive_bits() function returns now received bits count on success and libnfc error code on failure. 2012-01-04 13:33:53 +00:00
Audrey Diacre
951dde8143 nfc_target_send_bits() function returns now sent bits count on success and libnfc error code on failure. 2012-01-04 13:27:15 +00:00
Audrey Diacre
1c49329ffa nfc_initiator_transceive_bits_timed() function returns now received bits count on success and libnfc error code on failure. 2012-01-04 13:18:11 +00:00
Audrey Diacre
d02da0db64 nfc_initiator_transceive_bytes_timed() function returns now received bytes count on success and libnfc error code on failure. 2012-01-04 11:54:55 +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
9c1371dcca nfc_target_send_bytes() function returns now sent bytes count on success and libnfc error code on failure. 2011-12-22 15:59:08 +00:00
Audrey Diacre
ac6f652368 nfc_target_receive_bytes() function returns now received bytes count on success and libnfc error code on failure. 2011-12-22 15:39:51 +00:00
Audrey Diacre
ff066e394d nfc_initiator_deselect__target() function returns now libnf error code. 2011-12-21 09:53:16 +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
0f5cc5683d nfc_initiator_poll_target() function returns now libnfc error code. 2011-12-20 15:46:35 +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
Audrey Diacre
145cc4b2ad nfc_initiator_transceive_bytesfunction now returns libnfc error code on failure and received bytes count on success. 2011-12-19 14:37:22 +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
Romuald Conty
9bdc20353c nfc_device struct is not exposed as public API anymore (partial commit)
- split libnfc's errors and chip's errors
 - fix nfc_property enum
2011-12-15 16:02:38 +00:00
Audrey Diacre
98355d36a7 nfc_initiator_init returns now error code and nfc_initiator_list_passive_targets returns now the number of targets found or error code. 2011-12-15 11:46:14 +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
Romuald Conty
26b9c28f48 new properties to tune timeouts:
- add nfc_properties (will replace nfc_options)
 - introduce some error codes
 - rework functions to use the new timeout_command value
2011-12-14 13:27:11 +00:00
Romuald Conty
90c05c7d13 Add a printf-based logging when log4c is not available (I experiemented some bugs using log4c) 2011-12-07 14:59:40 +00:00
Romuald Conty
c286eec920 DEP enhancements:
- Add timeout on InJumpForDEP (pn53x) and initiator_select_dep (libnfc API)
- test_dep now works again (except 424Kbps)
- Fix ndi.ndm feeling when select a DEP target
Important: test_dep does not work on PN53x_USB devices after running previous tests
2011-12-06 10:05:35 +00:00
Audrey Diacre
297a8566a0 Oups, too quick replacement commited in r1183 2011-11-25 15:47:24 +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
dad3603936 Remove whitespace after star symbol for pointers 2011-11-24 16:45:27 +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
dccfd65c80 Add software polling for non-PN532 equipped device (Fixes Issue 136) 2011-10-03 11:19:08 +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
0f3b733239 directory include/nfc does not have iso7816.h file. 2011-09-12 19:50:21 +00:00
Romain Tartiere
f6fc637d77 Soooo fragile :-)))) 2011-09-12 17:05:00 +00:00
Romuald Conty
eec2794d2d drivers/pn532_uart,arygon: Make valgrind happy with UART-based drivers 2011-06-28 13:16:44 +00:00
Romuald Conty
eb70f3842e Error handling improvement:
- Attempt to sort errors depending their source
 - Rename DE* errors to differenciate Device-Error and Driver-Error
 - Add ENOTIMPL error to raise a error when a feature is not (yet) implemented in libnfc
2011-06-27 16:31:10 +00:00
Philippe Teuwen
ab54a37678 list_targets support for ASK CTS512B (no anticol support yet) 2011-05-11 23:00:54 +00:00
Philippe Teuwen
53f1acfdcb _timed() fcts: allow 32b cycles counter & prescaler!=0 2011-05-11 20:56:09 +00:00
Philippe Teuwen
21dfe81d0b Some optimisations in initialisation of registers 2011-05-10 23:44:27 +00:00
Romuald Conty
be0f0b0828 New function nfc_idle() to set the NFC device in idle mode.
nfc_disconnect() now switch NFC device into idle before disconnecting;
pn53x_data now have a operating_mode enum to know the current running mode (initiator, target or idle);
new pn53x_PowerDown wrapper for PowerDown (PN532) command;

Note: ARYGON idle mode now to be implemented and ACR122 does not support this mode.
2011-05-09 10:09:40 +00:00
Philippe Teuwen
d834860965 Add partial support (list) for ISO14443B-3 ST SRx & ASK CTx cards 2011-05-06 19:11:03 +00:00
Romuald Conty
cd6946e751 Add ISO/IEC 14443 B' aka Type B' modulation partial support 2011-05-06 14:14:06 +00:00
Romuald Conty
5f890fedcc Remove obsolete callbacks 2011-05-05 09:45:39 +00:00
Romuald Conty
0265515a0c Abort mecanism is now implemented in driver layer:
iAbortFd file descriptor array have been removed from nfc_device_t;
nfc_abort_command() can now failed (return false);
nfc_abort_command() now call abort_command pointer from drivers;
pn532_uart and arygon drivers use a pipe-based mecanism (similar from previous one);
pn53x_usb driver use a boolean flag-based mecanism (the previous one does not work as expected);
pn53x_usb now print smarter messages on error at usb connection;
pn53x_usb now handle a strange case: sometimes, the first sent command is not ACKed by PN53x USB device, a dummy command is now sent.
2011-05-05 09:27:17 +00:00
Romuald Conty
ef92fc6a7b add C++ compatibility in include/nfc/nfc-emulation.h 2011-04-06 21:42:47 +00:00
Philippe Teuwen
fb398c387f pn53x: add timed versions of transceive_bytes/bits 2011-04-04 14:16:36 +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
Romain Tartiere
53960c4643 Split user_data and state_machine_data. 2011-03-13 14:40:36 +00:00
Romain Tartiere
0f0fa2b14f Move nfc_emulate_target() from examples to the library. 2011-03-13 14:31:06 +00:00
Romain Tartiere
ad530f6d02 Various cleanups.
- New functions nfc_device_new(), nfc_device_free();
- Add experimental abort mechanism for the PN53x USB driver;
- Move chip-specific variables from nfc_device_t to pn53x_data (Fixes Issue 124).
2011-03-09 13:37:16 +00:00
Romuald Conty
0efa47880b Hardware abstraction layer for libnfc:
Suppress any PN53x references in nfc.c
Improve nfc_driver_t struct to embedded HAL API
Merge macros from nfc-messages.h into nfc-internal.h
Remove useless files: nfc-messages.h, buses.h and chips.h
Implement HAL for ARYGON driver
Move send/receive callbacks from nfc_driver_t to internal chip io callbacks (since there are dedicated to pn53x framing)
2011-03-05 10:06:52 +00:00
Romuald Conty
9b202d1dbf prefer one-line protypes in API. 2011-03-05 09:09:13 +00:00
Romain Tartiere
4b6060aeeb Enable aborting blocking commands (e.g. TgInitAsTarget) and refactor
*_check_communication() as pn53x_check_communication().
2011-03-04 19:59:49 +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
58ad2a5760 Add new supported device: ASK / LoGO. (Thanks to ASK for sending one sample of this device) 2011-02-01 21:20:48 +00:00
Romuald Conty
0f8c23bddd Inform user if target UID can be emulated
New error: ETGUIDNOTSUP raised when UID is not 4 bytes long or does not start with 0x08 (Security restriction present in the NXP PN53x chips)
2011-01-07 16:15:18 +00:00
Romuald Conty
6df612a364 Errors use #define instead of constant values.
Update Issue 84
Current 'ident' command breaks commit-concerned lines.
2010-11-15 18:50:53 +00:00
Romain Tartiere
4e5d0766e1 Rename append_iso14443a_crc() to iso14443a_crc_append(). 2010-10-29 10:59:26 +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
5538fbd20f Add NBR_847 (used with ISO14443B) and update convert function. 2010-10-20 08:34:06 +00:00
Romuald Conty
ccbd2d83c6 Add NEWS file to summarize important changes (like API ^^) 2010-10-19 15:50:18 +00:00
Romuald Conty
f249af6266 Add ISO14443-4 modulation to hardware polling only when NDO_AUTO_ISO14443_4A have been enabled and document this features and known issues. 2010-10-19 09:34:18 +00:00
Romuald Conty
b5d85fc6e1 Decode supported modulation from PN53x 2010-10-18 14:26:49 +00:00
Romuald Conty
1f62e9e2f2 Improve API for target emulation, nfc_target_mode_t does not exist anymore (this mode is computed from nfc_target_t) 2010-10-15 14:32:10 +00:00
Philippe Teuwen
ffe50562dd Make use of the now available Tk info 2010-10-14 18:33:17 +00:00
Romuald Conty
41758ab63f pn53x_target_init() now takes care of Historical Bytes 2010-10-14 17:38:54 +00:00
Romuald Conty
7c76e1bf32 nfc_target_init() now update nfc_target_t baud rate 2010-10-14 16:27:50 +00:00
Romuald Conty
60c9da598a Support different baud rates for nfc_initiator_select_dep_target() 2010-10-14 13:03:23 +00:00
Romuald Conty
af88da1a9c Replace nfc_target_info_t with nfc_target_t in API function, we now have a coherent struct to handle nfc_target_t, use it! 2010-10-14 11:44:43 +00:00
Romuald Conty
6f3fbcb6bf Fix nfc_dep_mode_t usage in API, fix/improve documentation 2010-10-14 11:12:23 +00:00
Romuald Conty
9d9b5a629e Fix nfc-poll, improve pn53x_target_type_t decoding 2010-10-13 21:40:54 +00:00
Romuald Conty
adba90684d introduce nfc_dep_mode_t type instead of bool in nfc_initiator_select_dep_target() 2010-10-13 19:59:39 +00:00
Romuald Conty
979430ecd1 nfc_target_t have now nfc_modulation_t instead of nfc_modulatation_type_t 2010-10-13 19:17:51 +00:00
Romuald Conty
d289eabc36 Attempt to provide clean types for API 2010-10-13 17:43:23 +00:00
Romuald Conty
9020014160 Rename nfc_modulation_t as pn53x_modulation_t 2010-10-13 15:39:52 +00:00
Romuald Conty
695e5c2f37 Rename nfc_target_type_t as pn53x_target_type_t 2010-10-13 15:31:48 +00:00
Romuald Conty
c53c512831 Change some nfc_target_type_t to insist on the ISO/IEC 14443-4 compliance 2010-10-13 11:49:34 +00:00
Romuald Conty
0fe30e3db7 Change some nfc_target_mode_t to insist on the restrictions offer these mode 2010-10-13 11:35:28 +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
602787bd03 We can now use an nfc_dep_info_t to specify DEP info as initiator. 2010-10-11 14:49:08 +00:00
Romuald Conty
1e9c390dfa Improve DEP info struct: add more info, and InJumpDEP now fill fully this struct. 2010-10-08 20:25:34 +00:00
Romuald Conty
d9505bbbcc Better handling of SetParameters command, use a cache, prevent from double set, adjust comments, remove junk code. 2010-10-06 15:12:33 +00:00
Romuald Conty
da7a2bc4c6 Add ISO/IEC 14443B baud rates: 212, 424 and 847 kbps. Set a device error when using a not supported modulation baud rate in InListPassive(). 2010-10-06 10:06:12 +00:00
Romuald Conty
92cc9a5736 Add non restrictive mode for emulation (NTM_NORMAL), fix comments, rename NTM_PICC to insist on "ISO14443-4" PICC mode. 2010-10-04 13:26:47 +00:00
Romuald Conty
5233fceda7 Improve the target emulation functions (ATM, only ISO14443A), add an example (nfc-emulate-tag), update examples to use the new API. 2010-10-04 12:46:03 +00:00
Romuald Conty
4a3a185857 Fix bad indent
Update issue 84
Indent insert some blank lines.
2010-10-01 11:00:27 +00:00
Romuald Conty
4d880e6ce8 Enhance documentation and fix typo. 2010-09-29 14:26:06 +00:00
Roel Verdult
6dfe88113e Added new example, PN53x chips will now emulate NDEF tag! not in build-script yet 2010-09-28 16:15:59 +00:00
Romuald Conty
2f95fb254b Improve ATQB decoding: "PUPI", "Application Data", and "Protocol Info" is now available as separated fields. 2010-09-23 16:26:06 +00:00
Romuald Conty
ccfd24a682 nfc-anticol now works even after running another program that change the modulation (Fixes Issue 111) (Thanks to Phil for help). 2010-09-23 16:03:05 +00:00
Romuald Conty
7e2ddedfc1 Fix ISO14443-B ATTRIB_RES decoding. (Thanks to Phil) 2010-09-23 10:12:10 +00:00