Commit graph

623 commits

Author SHA1 Message Date
Romain Tartiere
f237d44339 Take care of 16-blocks-long sectors of Mifare Classic 4K in the nfc-mfclassic example's blocks counting routine. 2010-08-11 09:26:22 +00:00
Romain Tartiere
ca6b768a67 Fix build on Microsoft Windows. 2010-08-10 21:45:30 +00:00
Romain Tartiere
4a5347e5ae Merge r512 from trunk. 2010-08-10 21:41:42 +00:00
Romain Tartiere
3ec0b9376c Make Mifare example use only the libnfc public API. 2010-08-10 21:36:57 +00:00
Romain Tartiere
dfb82f8893 Merge r499-510 from trunk. 2010-08-10 21:14:13 +00:00
Romain Tartiere
bda739eb8f Hey! r509 also fixed that! 2010-08-10 21:02:26 +00:00
Romain Tartiere
eece496351 Use nfc_initiator_transceive_dep_bytes() instead of pn53x_transceive() in example. 2010-08-10 21:00:08 +00:00
Romain Tartiere
fd0efd4a62 Fix build on Microsoft Windows.
Windows users: I hate you in secret.
2010-08-10 19:50:29 +00:00
Romain Tartiere
8fef257d16 Also use pn53x_transceive_callback() in the arygon driver.
While here, remove unneeded header in pn532_uart.c.
2010-08-08 15:25:06 +00:00
Romain Tartiere
d7c16d6d1a Factorise UART-relative macros definitions. 2010-08-08 09:34:18 +00:00
Romain Tartiere
8e5d235cd2 Implement pn53x_InRelease().
I used it for some experiments and guess that it should be part of the API.
2010-08-06 07:29:57 +00:00
Romain Tartiere
d77c25224a After a bazillion tests, make the Debian-5-year-outdated-and-buggy autotools happy with some weird m4 syntax and hope it will not fail on a much more recent autolol suite. 2010-07-31 15:37:27 +00:00
Romain Tartiere
d0357cf3aa Merge r486-498 from trunk. 2010-07-31 14:23:33 +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
301d692e8a Flag references to deprecated usage of pn53x_transceive().
New issue
Summary: pn53x_transceive() workaround reverences in examples/nfc-poll.c comments
Status: New
Owner: rconty@il4p.fr
Cc: rtartiere@il4p.fr
The source code of nfc-poll has references to no using pn53x_transceive() for
the status-byte workaround reason in a comment.  However this function is not
called in the code.  While I guess that's some comment that should have been
removed and have never reached the svn repo, I prefer to be sure that it can be
removed.  The comments where introduced at the same time of the file, at r353.
2010-07-31 14:02:46 +00:00
Romain Tartiere
b60d045537 Remove another deprecated test that '^#ifdef' did not matched for previous commit. 2010-07-31 13:46:32 +00:00
Romain Tartiere
cd53efb038 Enforce ISO C conformance about empty files.
ISO C forbids empty source files.  Instead of compiling possibly empty source
files depending on the compiler parameters, only compile required files to
build the library as requested at the ./configure stage.

Windows users (and more precisely non-autotools users), you may have to update
whatever you use to build the libnfc to fit your needs.  The Makefile shipped
in the windows directory compiles all drivers as it is written so you should
not notice any difference, but if you don't use _that_ makefile, then you will
have to do some adjustment.

For now, keep the defines in CFLAGS just in case.  Planned for removal in circa
one week.

While here, pet `./configure` output (--help format and summary).
2010-07-31 13:21:56 +00:00
Romain Tartiere
bb06d45a05 Really silent down gcc with -Wextra. 2010-07-31 12:57:02 +00:00
Romain Tartiere
93494aad24 Fix serial string for FreeBSD.
I am sure we don't have /dev/ttyUSB*, and since I use /dev/cuau0 with a
cross-over cable to connect 2 machines and have a serial console, I guess
"/dev/cuau" is the SERIAL_STRING that's expected to work for me.  A quick test
would be cool however, but I don't own a serial NFC device.
2010-07-31 10:13:18 +00:00
Romain Tartiere
d498fcd48e Comment all commands that return a status code in the list. Found a typo at that occasion so s/0x93/0x92/. 2010-07-31 09:50:04 +00:00
Romain Tartiere
fb6d9d2d20 Yes we can... remove all those pnd->pdc->transceive() from nfc.c.
Within the ongoing effort to improve the NFC devices abstraction, and now that
pn53x_transceive() does not fail when it reads a response that has no
status-code, do not call directly pnd->pdc->transceive() from nfc.c.  In a
mid-term future this will be changed again, and calling pn53x_transceive() from
nfc.c will be forbiden, in favor of colling some pnd->transceive() function,
but that's another part of the story.

Of course, it changes the API one more and it's not going to be the last time
in this branch.
2010-07-31 09:40:29 +00:00
Romain Tartiere
705e037b12 Only report status error for commands that provide it in pn53x_transceive().
This is the first step for improving abstraction in libnfc.
2010-07-31 09:19:22 +00:00
Romain Tartiere
36ee32f81a Merge r478-485 from trunk. 2010-07-30 16:34:12 +00:00
Romuald Conty
0afaf656fa Attempt to provide target listing function (WARNING: this function is actually incomplete)
New issue
Summary: Provide a target listing function
Labels: Milestone-1.4.x
Libnfc lacks of target listing function. Actually, applications or libraries based on libnfc have to wrote their own listing function which can provide side effect if two or more of theses libraries are used together in the same application. Plus, some kind of problem could appears during listing multiples targets (i.e. collisions) and this problem should be solved in libnfc (i.e. using NFC chip capabilities), not in applications based on libnfc.
2010-07-30 13:27:03 +00:00
Romuald Conty
7113d1418b Add FIXME to raise an E_NOTSUPPORTED error in future,
New issue
Summary: Catch unsupported command before sending to chip
Labels: Milestone-1.6.x
Actually, libnfc support PN531, PN532 and PN533 NFC chips, but the devices does not the same features. e.g. PN531 does not support ISO14443B modulation.
It should great to catch theses unsuported commands before sending to chip in order to prevent a chip error.
2010-07-30 11:45:59 +00:00
Romuald Conty
5ac580a241 Code cleanup: remove many debug prints, enhance comments and documentation. 2010-07-30 11:30:19 +00:00
Romain Tartiere
daa178b18f Enhance error handeling.
- New API functions: nfc_strerror(), nfc_strerror_r() and nfc_perror();
  - Drivers now have a reference to chips callback methods;
  - Rename -pn53x_err2string to pn53x_strerror and add it to pn53x_callbacks_list.
2010-07-29 14:16:11 +00:00
Romuald Conty
18e6e1bc7c Add documentation for pn53x_InListPassiveTarget() 2010-07-29 12:48:59 +00:00
Romuald Conty
fc15146bf2 Minor code cleanning. 2010-07-29 12:47:51 +00:00
Romain Tartiere
30e715cff0 Merge r470-477 from trunk. 2010-07-29 10:59:52 +00:00
Romain Tartiere
740b5b430d libnfc-error-handling: Remove boring debug stuff. 2010-07-29 10:53:14 +00:00
Romain Tartiere
f01b73ab32 Move usb_reset(3) call.
As the documentation states, and as reported in isssue 81 (fixed in r421),
usb_reset()'s argument is invalid after the call and so usb_close(3) must be
called before usb_reset(3).
2010-07-29 10:47:53 +00:00
Emanuele Bertoldi
f7e8ec0a95 nfc-sam: cleanup and Windows support improvements. 2010-07-29 10:18:19 +00:00
Roel Verdult
5129a37ec8 fixed typo, missed closing bracket ;) 2010-07-28 12:56:40 +00:00
Roel Verdult
20ed5e1a52 fixed wakeup preamble, change PN532 chip to normal mode after wakeup 2010-07-28 12:52:39 +00:00
Romuald Conty
d63157a41d Fix mask to extract "Error Code" from status byte. 2010-07-27 09:29:54 +00:00
Romain Tartiere
9984e1bdcb Start of work on error handling. 2010-07-26 12:41:46 +00:00
Emanuele Bertoldi
9a7ffc38a1 Small improvements to nfc-sam stuff. 2010-07-26 08:55:43 +00:00
Romain Tartiere
af584bd474 Fix packet length checksum computation.
The doc says LCS (aka abtTx[4]) must be set so that the lower byte of LCS+LEN
(aka abtTx[3]) is 0x00.  This has not to be related to the USB buffer size, so
that we can adjust it without breaking down the libnfc.
2010-07-25 16:31:53 +00:00
Romain Tartiere
7f9f907bc2 Silent down compiler. 2010-07-24 18:54:50 +00:00
Romain Tartiere
e6d079d87a Fix a regression introduced at r461.
This prevents the ATR_REQ from being processed and some tags detection fails in
libfreefare.
2010-07-24 17:20:48 +00:00
Romain Tartiere
4ff66d125f Fix a regression introduced at r458.
Both abtInit and szInitLen are initialised using pbtInitData and szInitDataLen,
so we must use them when calling pn53x_InListPassiveTarget().
2010-07-24 16:30:44 +00:00
Romuald Conty
544bda197e Fix minor warning. 2010-07-23 13:31:33 +00:00
Romuald Conty
edb62bd1cb Create pn53x_InDeselect function. 2010-07-23 13:30:06 +00:00
Romuald Conty
7eeb46ab68 Minor indentation fix. 2010-07-23 12:48:30 +00:00
Romuald Conty
7dd1053d03 Fix incorrect selected targets size in pn53x_InListPassive(). 2010-07-23 12:45:21 +00:00
Romuald Conty
3f17e5e032 Minor indentation fix. 2010-07-23 12:41:29 +00:00
Romuald Conty
aca1eb40a8 Comment out extern symbol related to PN53x in nfc.c; The goal is to remove all of them from nfc.c 2010-07-22 16:24:24 +00:00
Romuald Conty
d932cd8450 Move some PN53x related code from nfc.c to pn53x.c 2010-07-22 16:21:59 +00:00
Romuald Conty
424a48714f Minor documentation improvements. 2010-07-22 16:16:37 +00:00