Commit Graph
100 Commits
Author SHA1 Message Date
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
Romain Tartiere e94513fdb7 libpcsclite is not really required. 2011-09-22 10:01:37 +00:00
Romain Tartiere f6fc637d77 Soooo fragile :-)))) 2011-09-12 17:05:00 +00:00
Romain Tartiere 752c247761 Add cast to fix build on 32bit systems. 2011-07-05 08:00:11 +00:00
Romain Tartiere 84918fd075 Fix invalid memory access when a new driver is probing for hardware and the number of requested devices was already reached.
The probing functions assume that at least one device should be found and
passed to the caller, and only after finding such a device they will check that
they should eventually stop looking for more devices.  While we could make each
probing function capable of handling the special-case of finding 0 devices, it
is much more consistent to perform the check from the calling function.
2011-06-30 13:35:40 +00:00
Romain Tartiere 4259f595ec Initialize DEP mode (nt.nti.ndi.ndm) to NDM_UNDEFINED. 2011-06-26 14:43:11 +00:00
Romain Tartiere a8394caed5 Fix comparison between signed and unsigned. 2011-06-13 21:46:01 +00:00
Romain Tartiere bf5b97f86a Add FreeBSD devd(8) snippet configuration for Sony S330 readers. 2011-06-06 08:46:55 +00:00
Romain Tartiere 4828211e97 Fix crash when usb_bulk_read() fails. 2011-05-18 22:25:09 +00:00
Romain Tartiere 6d66866268 Silent down the compiler. 2011-05-18 18:53:00 +00:00
Romain Tartiere 520e64c095 Compile unit tests only on demand unless using --enable-debug. 2011-05-11 17:38:11 +00:00
Romain Tartiere 7314b7d598 Unbreak build.
Reported by:	yobibe
Pointy hat to:	rconty
2011-04-02 21:16:31 +00:00
Romain Tartiere e44af986a0 Unbreak aborting from the pn53X_usb driver. 2011-03-13 20:42:27 +00:00
Romain Tartiere 2d31877aec Fix header protection. 2011-03-13 20:33:00 +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 03913708db Add write support to nfc-emulate-forum-tag4. 2011-03-12 15:01:04 +00:00
Romain Tartiere 7b95a8a487 Load NDEF message from file if a valid filename is provided. 2011-03-11 19:01:28 +00:00
Romain Tartiere e0dead1d7f Rewrite nfc-emulate-forum-tag4 example logic. 2011-03-09 18:17:05 +00:00
Romain Tartiere 2f60e23fd5 Cleanup macro. 2011-03-09 16:13:44 +00:00
Romain Tartiere 2cca743e07 Return an error when a command is aborted;
Fix aborting with UART devices.
2011-03-09 14:10:40 +00:00
Romain Tartiere 605a5f2db3 Fix nfc_pick_device() when called from nfc_connect with NULL nfc_device_desc_t parameter (Fixes Issue 156) 2011-03-09 13:49:33 +00:00
Romain Tartiere cfc5273275 Simplify uart_send() on POSIX systems. 2011-03-09 13:42:23 +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
Romain Tartiere 8d27768097 Implement abort in the nfc-emulate-forum-tag4 example. 2011-03-09 13:31:12 +00:00
Romain Tartiere 7ca0aa07c5 Initialise pn53x chip in acr122_connect(). 2011-03-08 15:09:23 +00:00
Romain Tartiere 88bff13b85 Lint the ACR122 driver. 2011-03-08 15:01:07 +00:00
Romain Tartiere 27c28944f2 Check off_t. 2011-03-08 14:36:13 +00:00
Romain Tartiere 61fa081cfe Unbreak support of ACR122.
Only tested w/ a touchatag.
@yobibe: _NO_ LED support yet (OMG!)
2011-03-08 14:33:32 +00:00
Romain Tartiere 854f18be74 Cleanup the Arygon driver. 2011-03-08 10:55:44 +00:00
Romain Tartiere 3052568597 Document requirements
Update issue 95
Status: WontFix
Driver dependencies are now well documented and fits most users needs.
2011-03-06 12:00:33 +00:00
Romain Tartiere 0abfe60f35 Fix aborting from blocking command with Arygon devices. 2011-03-05 21:28:18 +00:00
Romain Tartiere 29618b7e27 Fix crash when pn53x_TgInitAsTarget() is aborted. 2011-03-05 21:27:10 +00:00
Romain Tartiere f1f31d1b4c Unbreak and merge PN53x USB drivers.
While here fix some includes that would not work if SRCDIR != BUILDDIR.
2011-03-05 19:54:52 +00:00
Romain Tartiere a55a52e0a9 Fix pn53x_InAutoPoll() return value on user cancelation (true instead of false). 2011-03-05 01:46:16 +00:00
Romain Tartiere 76a1744d37 Lint returns. 2011-03-05 01:45:49 +00:00
Romain Tartiere 97dd0b63d7 Implement abort for pn532_uart driver. 2011-03-04 20:17:28 +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
Romain Tartiere 7ed71a1501 Merge r912 into trunk. 2011-03-04 15:49:16 +00:00
Romain Tartiere fe7ec36fb7 Fix Arygon driver reported name. 2011-03-04 11:23:52 +00:00
Romain Tartiere 4d65868208 Only call pn53x_init() from the drivers initialization functions. 2011-03-04 11:23:20 +00:00
Romain Tartiere b1521a3bb1 If the current driver name does not match what we are looking for, move to the
next one before retrying.
2011-03-04 11:18:47 +00:00
Romain Tartiere 61a5268d65 Do not coredump if we have an unexpected reply.
If we are speaking to the wrong device, it is very likely we will have an
"unexpected reply" and we should ignore it.
2011-03-04 11:16:18 +00:00
Romain Tartiere 62736ab48b Rework cleanup to drop code coverage information. 2011-02-26 00:21:27 +00:00
Romain Tartiere b9dee63467 Update devd(8) rules file for FreeBSD. 2011-02-26 00:19:34 +00:00
Romain Tartiere cf92bfaeee Fix crash when file cannot be opened for writing. 2011-01-20 15:42:46 +00:00
Romain Tartiere ad5959e860 Really fail if pkg-config is not present.
Submitted by:	Amnesia, bigjay via IRC.
2010-11-05 11:36:20 +00:00
Romain Tartiere 4e5d0766e1 Rename append_iso14443a_crc() to iso14443a_crc_append(). 2010-10-29 10:59:26 +00:00
Romain Tartiere b8910c5bd5 Sum up recent API changes for the user. 2010-10-15 19:35:53 +00:00
Romain Tartiere 81a1eb2c6c Don't display authentication errors in examples. 2010-09-07 13:34:48 +00:00
Romain Tartiere b9cb5b22c8 Fix build on Microsoft Windows. 2010-09-07 09:59:12 +00:00
Romain Tartiere 9629d073cb - Fix missing checks reported by autoscan (we still do nothing on failure but at least the configure output might be more useful in case of problem);
- Lint configure output when libusb detection methods fallback over and over.
2010-09-07 09:01:59 +00:00
Romain Tartiere ec58634a67 Fix build on Microsoft Windows. 2010-09-07 08:45:03 +00:00
Romain Tartiere 6ff1be2127 Fix build on Microsoft Windows. 2010-09-04 11:14:06 +00:00
Romain Tartiere 2efbccf236 Explicitly enable auto ISO14443-4 mode for nfc-list. 2010-09-04 10:20:02 +00:00
Romain Tartiere c82e1ff30f Change NDO_EASY_FRAMING value form 0x02 to 0x41.
Update issue 106
Just changed NDO_EASY_FRAMING value as requested.
2010-09-03 16:47:17 +00:00
Romain Tartiere cbbe559f94 Alse remove nfc_target_receive_dep_bytes() and nfc_target_send_dep_bytes().
Update issue 106
Implement what's described in comment 3, 7 and 8.
2010-09-03 16:45:24 +00:00
Romain Tartiere a5676ecd94 Remove nfc_initiator_transceive_dep_bytes() and introduce NDO_EASY_FRAMING option.
Always use nfc_initiator_transceive_bytes(). If you where using advanced
features and already relying on nfc_initiator_transceive_bytes(), then your
code has to be updated to unset the NDO_EASY_FRAMING option.  See an example of
such a change in the libfreefare's repository:
http://code.google.com/p/nfc-tools/source/detail?r=566

Updates issue 106
Status: Feedback
Romuald: I am not sure about the option enum values.  I took 0x02 thinking it
would not hurt but am not really sure about that because I can see many 'holes'
in the sequence.
2010-09-03 16:13:36 +00:00
Romain Tartiere b1f4c38f8f Improve configure's --with-drivers documentation.
- List drivers compiled in the default set;
- Expose the 'all' special-driver;
- Remove some autotools (broken) magic.
    Since it's broken, display "--with-drivers=DRIVERS" on all system and stop
    making my eyes bleeding with "--with-drivers=driver[[,]driver...]" which is
    a complete nonsense when using "recent" autotools.
2010-09-03 08:36:41 +00:00
Romain Tartiere 306e51fa72 Remove useless nfc_perror lines from tests.
The endianness problem spoken about in r586 does not exist since the value
in pn53x_get_reg() is in a register so keep the ugly boolean operations to
copy the value: using all endianness conversions macros is a PITA.
2010-08-28 14:40:29 +00:00
Romain Tartiere 1130036bf3 - Detect errors in pn53x_get_reg();
- Add a test case to confirm an endianness problem on little-endian machines.
2010-08-28 14:27:33 +00:00
Romain Tartiere af291c5a16 Report errors of ACR122 devices in the transceive function. 2010-08-28 14:25:49 +00:00
Romain Tartiere a676d34e5d Fix build on Microsoft Windows. 2010-08-24 11:03:59 +00:00
Romain Tartiere cbc3a62db1 Remove extern reference to pn53x-specific commands.
Fixes issue 101.
2010-08-24 10:31:21 +00:00
Romain Tartiere f8ed119d1b Reset pnd->iLastError in nfc.c. 2010-08-24 10:30:18 +00:00
Romain Tartiere 9b44e3b2b7 Rename some internal API to highlight the PN53x operating mode.
pn53x_select_dep_target    -> pn53x_initiator_select_dep_target
pn53x_transceive_dep_bytes -> pn53x_initiator_transceive_dep_bytes
pn53x_transceive_bits      -> pn53x_initiator_transceive_bits
pn53x_transceive_bytes     -> pn53x_initiator_transceive_bytes
2010-08-24 10:26:56 +00:00
Romain Tartiere ecb51c3554 New internal API functions: pn53x_target_send_bits(), pn53x_target_send_bytes(). 2010-08-24 10:22:55 +00:00
Romain Tartiere 047f274270 New internal API functions: pn53x_target_receive_bits(), pn53x_target_receive_bytes(). 2010-08-24 10:20:04 +00:00
Romain Tartiere 92a6789013 New internal API function: pn53x_target_init(). 2010-08-24 10:17:38 +00:00
Romain Tartiere 7f698431b7 New internal API function: pn53x_target_send_dep_bytes(). 2010-08-24 10:13:09 +00:00
Romain Tartiere 3d69c8b694 New internal API function: pn53x_target_receive_dep_bytes(). 2010-08-24 10:11:48 +00:00
Romain Tartiere 7a231cfb03 New internal API functions: pn53x_transceive_bits(), pn53x_transceive_bytes(). 2010-08-24 09:59:45 +00:00
Romain Tartiere 3cba76cc6f New internal API function: pn53x_transceive_dep_bytes(). 2010-08-24 09:56:22 +00:00
Romain Tartiere ca0d73875d New internal API function: pn53x_select_dep_target(). 2010-08-24 09:53:51 +00:00
Romain Tartiere 5055f3d30b New internal API function: pn53x_configure(). 2010-08-24 09:49:59 +00:00
Romain Tartiere 71b3a1ad6e New internal API function: pn53x_get_firmware_version(). 2010-08-24 09:47:03 +00:00
Romain Tartiere fbcf966d20 Merge r566-569 from the libnfc-error-handling branch.
Fix issue 103
2010-08-24 09:32:42 +00:00
Romain Tartiere 00ad302e32 Fix CMake build. 2010-08-24 09:29:59 +00:00
Romain Tartiere b6fb5829c0 Fix libnfc version in the Microsoft Windows Makefile.
Also add a note to avoid forgetting it in configure.ac.
2010-08-24 09:25:53 +00:00
Romain Tartiere 32917a9c0a Unbreak nfc-list on windows.
The 'z' format modifier is not portable.  Switch to a basic int and cast the
size_t to an int.
2010-08-24 09:23:48 +00:00
Romain Tartiere 23f84a4e6a Merge the libnfc-error-handling branch into trunk. 2010-08-20 11:08:04 +00:00
Romain Tartiere 5b0589c381 Merge r551-563 from trunk. 2010-08-20 10:41:30 +00:00
Romain Tartiere fd337dd0cc Also detect error frames in pn532_uart (tested) and arygon drivers (not tested). 2010-08-20 10:40:00 +00:00
Romain Tartiere 1e329529a7 Update nfc-poll example to enhance unsupported features detection. 2010-08-20 10:16:52 +00:00
Romain Tartiere f4aa4edc94 Rework and fix error frames detection.
While here, rename the pn53x_transceive_callback() function to
pn53x_transceive_check_ack_frame_callback() to make it more obvious what it is
supposed to do.
2010-08-20 10:06:19 +00:00
Romain Tartiere b0737bd1a0 Fix pn53x_InAutoPoll(). 2010-08-20 09:36:38 +00:00
Romain Tartiere 5744c67039 Fix build on Microsoft Windows (not tested, no hardware). 2010-08-19 18:19:40 +00:00
Romain Tartiere eb90b92c12 Detect errors in examples. 2010-08-18 17:22:13 +00:00
Romain Tartiere 076fa3686c Merge r547-550 from trunk. 2010-08-18 17:01:08 +00:00
Romain Tartiere 27b97c0fda Fix build on Microsoft Windows. 2010-08-18 16:55:16 +00:00
Romain Tartiere 0a09c8d8e7 Flag some problems in the examples. 2010-08-18 14:44:40 +00:00
Romain Tartiere c9f88e17a1 Reset pnd->iLastError in nfc.c. 2010-08-18 14:44:19 +00:00
Romain Tartiere 769eef20f7 Merge r520-546 from trunk. 2010-08-18 14:32:01 +00:00
Romain Tartiere f797d737d3 Fix build on Microsoft Windows. 2010-08-16 17:43:48 +00:00
Romain Tartiere 08eb21aa9d Second part of error handling.
- Define two sets of DE<FOOBAR> macros: the first one for 'generic' errors
  which could be encountered regardless of the NFC device the library is acting
  with (0xX000), and ont set for device-dependant errors (0x0X00).
- Make some more functions accept a nfc_device_t* as first argument to have
  access to the iLastError;
- Reset errors when entering public API functions;
- Save errors when applicable;
- Distinguish system-level errors (e.g. I/O error) and operational errors (the
  PCD returns an unexpected value);
- Minor tweaks.

Update issue 65
Status: Feedback

New review:
Owner: rconty@il4p.fr
Cc: rtartiere@il4p.fr
Summary: Review the error-handling code.
Branch: /branches/libnfc-error-handling

For this development, a strong emphasis has been set on making changes that
will not go through our way on the way to libnfc-1.6+.  For this reason, some
constructs are not natural (e.g. error codes defined in two different places),
please keep this in mind when reviewing.
2010-08-15 14:08:29 +00:00
Romain Tartiere 8a75f5b45e Fix wrong comment 2010-08-15 12:42:40 +00:00
Romain Tartiere 655fdb569a Fix nfc_initiator_mifare_cmd() in examples.
In r509, a direct call to pn53x_transceive() was changed into a call to nfc_initiator_transceive_dep_bytes() which is part of the public API. The command to send was updated accordingly, but the code that extracts the response have not.

Update issue 98
This should fix the problem: because the response was not the expected length, the actual card data was not copied to the buffer, so it was always the same 16 uninitialized bytes that where returned for any block.

PR:		Issue 98
Submitted by:	zamby.ing
Pointy hat to:  me
2010-08-13 19:53:13 +00:00
Romain Tartiere fab08a3951 Fix doxygen comment: the string SHALL NOT be freed (it's const BTW).
Or maybe I would rather have removed the const and called strdup(3)?

New issue
Summary: Sync code and comments
Owner: rconty@il4p.fr
Status: New
Romuald, can you please review this changeset and fix the code if I corrected
the wrong way (i.e. the comment was Okay and the code bogus while I fixed the
comment thinking the cod was right).

Thanks!
2010-08-13 19:10:31 +00:00
Romain Tartiere d7e0b926ac Rename the only test of the regression test suite to a more explicit name.
- While here, add assertions, enhance slightly the code and decrease the number of loop turns.
2010-08-13 18:34:30 +00:00
Romain Tartiere 57b775bae2 Always ACK on transmission.
New issue
Summary: Make sending ACK on message transmission skipable.
Owner: rtartiere@il4p.fr
Cc: rtartiere@il4p.fr
Status: New
I guess that for performance reasons, some advance users would prefer to skip
sending the non-mandatory ACK on data transmission.  They may also perform a
quicker check of the ACK returned by the chip after sending the command and
before receiving the response (not sure about this one).

It will probably be a ./configure option disabled by default that allows some "shortcuts" to perform NFC hacking.
2010-08-13 16:02:18 +00:00