Olliver Schinagl
32a306ee15
drivers: pn532_i2c: Add retry on error mechanism
...
Currently, we very occasionally can EXNIO errors from pn532_i2c_write() ->
i2c_write() -> write(). This may happen about once every 30 seconds.
Based from the kernel sources, EXNIO happens if the chip no longer
responds to its own address.
To make sure we do not loose any sent packets, we retry to send
PN532_SEND_RETRIES number of times. Since we miss 1 every 30 or so
seconds, doing 1 retry should be fine.
This might be considered a hack as the failure may be some other timing
related issue.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-10-31 15:56:13 +01:00
Olliver Schinagl
408b4f30ab
drivers: pn532_i2c: Respect proper timing specifications
...
The pn532 user manual states that after a i2c stop condition and before a i2c
start condition there should be a delay of minimally 1.3 milliseconds.
This is probably a limitation of the i2c peripheral or the firmware. In
any case, each i2c_read and i2c_write creates the packets which are
complemented with start/stop markers. It is thus required to take care
of timing in these two functions.
We solve this by wrapping the lower i2c_read and i2c_write functions for
the pn532, as this requirement is not for all chips.
Currently, we keep time using local variable, and thus the code is not
thread-safe. With libnfc being single threaded and only one instances of
libnfc can open a bus anyway, this is not yet a problem.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Conflicts:
libnfc/drivers/pn532_i2c.c
2016-10-31 15:55:36 +01:00
Olliver Schinagl
ace3f37818
drivers: pn532_i2c: Clarify preamble and start byte
...
The pn532 documentation differs slightly from the included ascii art
documentation on how a packet looks like. The preamble was omitted
however the postamble is mentioned. This patch adds the Preamble to the
ascii frame documentation.
The code later refers incorrectly to the start byte as the preamble.
This variable was renamed to more descriptively state that it is the
preambe and the start bytes.
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-10-31 15:52:27 +01:00
daid
0afc33e442
Reduce the I2C ready delay wait, which improves reading speed by butloads.
2016-07-12 12:41:37 +02:00
daid
4a1b48a8af
Modify the CMake file so it produces a .deb file with just the library with the proper links.
2016-07-11 10:32:06 +02:00
Romuald Conty
2d4543673e
Prepare 1.7.1 version
libnfc-1.7.1
2014-02-24 15:57:13 +01:00
Romuald Conty
101245a4a6
NEWS: add API changes for upcomming 1.7.1
2014-02-24 15:55:41 +01:00
Romuald Conty
78b827aa33
Bump library revision
...
According to https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
2014-02-24 15:50:49 +01:00
Philippe Teuwen
c0b9db6860
Update ChangeLog & AUTHORS
2014-02-18 15:40:22 +01:00
Philippe Teuwen
a7649da2b0
nfc-read-forum-tag3: add -q and document -o -
2014-02-18 00:22:24 +01:00
Philippe Teuwen
2aa4b99b7b
nfc-read-forum-tag3: full parsing of NDEF Attribute Block
2014-02-17 23:57:59 +01:00
Pim 't Hart
73c84c214d
nfc-read-forum-tag3: fix incomplete NDEF retrieval and size of output file
2014-02-17 23:09:15 +01:00
Philippe Teuwen
491db20d54
nfc-jewel: remove extraneous parentheses to silence warning
2014-02-11 23:23:42 +01:00
Philippe Teuwen
415ad7cbac
nfc_initiator_select_passive_target() accepts NULL pbtInitData and provides default values
2014-02-10 01:09:07 +01:00
Philippe Teuwen
fd30e63b80
nfc_initiator_target_is_present(): Fixes issue #267 , second attempt
2014-02-10 00:01:34 +01:00
Philippe Teuwen
766ed55c79
nfc-jewel: fix out-of-bounds array access
...
Defect(s) Reported-by: Coverity Scan
** CID 1169884: Out-of-bounds read (OVERRUN)
/utils/nfc-jewel.c: 186 in write_card()
2014-02-07 23:09:40 +01:00
Philippe Teuwen
2d584baa9b
Update ChangeLog
2014-02-07 14:39:44 +01:00
Philippe Teuwen
85bef73734
nfc_initiator_target_is_present(): Fixes issue #267
...
Fixes some -4A cards removal on PN533
but fixes also same -4A cards on PN532
2014-02-07 14:00:57 +01:00
Philippe Teuwen
1f5e14f862
cppcheck on pn53x.c: Array 'apttTargetTypes' is filled incompletely
2014-02-07 01:29:42 +01:00
Philippe Teuwen
a38279793a
cppcheck on nfc-pool: Variable 'res' is assigned a value that is never used
2014-02-07 01:22:27 +01:00
Philippe Teuwen
1e4fe3bd27
nfc_initiator_target_is_present(): Support B2 ST SRx
2014-02-07 01:11:19 +01:00
Philippe Teuwen
9fd11d331b
nfc_initiator_target_is_present(): Support B2 ASK CT
2014-02-07 00:53:35 +01:00
Philippe Teuwen
a3a7111210
nfc_initiator_target_is_present(): Support B'
2014-02-07 00:31:31 +01:00
Philippe Teuwen
7254e1b2ea
nfc_initiator_target_is_present(): Support Jewel
2014-02-03 00:24:23 +01:00
Pim 't Hart
ef81f06344
Adding nfc-jewel util
2014-02-03 00:04:08 +01:00
Philippe Teuwen
827d9792dd
Save & restore NP_INFINITE_SELECT status when changing it internally
2014-02-01 02:45:17 +01:00
Philippe Teuwen
69c4d0768a
nfc_initiator_select_passive_target(): grant NP_INFINITE_SELECT also for ISO14443B*
2014-02-01 02:45:17 +01:00
Philippe Teuwen
510228b6e0
nfc_initiator_select_passive_target(): save current target info even if pnt=NULL
2014-02-01 02:45:16 +01:00
Philippe Teuwen
e11c5254af
nfc_initiator_select_passive_target(): save current target info also for ISO14443B*
2014-01-31 23:53:29 +01:00
Philippe Teuwen
81e1dd715d
nfc_initiator_target_is_present(): Fix error type in case no target is selected yet
2014-01-31 23:19:04 +01:00
Philippe Teuwen
71eda315c7
nfc_initiator_target_is_present(): Fix MFC support on PN532
2014-01-31 22:33:05 +01:00
Philippe Teuwen
7d41ed34a3
*_is_present(): more robust detection of tag gone
2014-01-30 18:30:45 +01:00
Philippe Teuwen
9a84bb0ba0
Split pn53x_initiator_target_is_present() for readability
2014-01-30 18:10:30 +01:00
Philippe Teuwen
62e78ab582
nfc_initiator_target_is_present(): support -4B on PN532
2014-01-30 12:55:51 +01:00
Philippe Teuwen
d6330a55d0
nfc_initiator_target_is_present(): better error handling
2014-01-30 11:37:37 +01:00
Philippe Teuwen
05579fde09
nfc_initiator_target_is_present(): better Felica support
2014-01-30 11:19:02 +01:00
Romuald Conty
70f5c23486
Git: ignore generated examples/doc/.deps directory
2014-01-30 11:11:54 +01:00
Romuald Conty
5fe3fbdb5d
Fix nfc_target_is_present() when removing a ISO14443-4A target from a PN532-based device
2014-01-30 11:10:18 +01:00
Philippe Teuwen
d893e4398c
nfc_initiator_target_is_present(): fix ISO14443B-4 support
2014-01-30 00:32:21 +01:00
Philippe Teuwen
ade71ee8a6
nfc_initiator_target_is_present(): reuse iso14443_cascade_uid()
2014-01-30 00:24:06 +01:00
Philippe Teuwen
095f945224
nfc_initiator_target_is_present(): improve MFC support for 7-byte UID
2014-01-30 00:09:03 +01:00
Philippe Teuwen
9d63a93dd8
nfc_initiator_target_is_present(): improve MFC support
...
Increase timeout to support Tikitag & PN533
Fix support for MFC Mini on PN533
2014-01-29 23:30:50 +01:00
Philippe Teuwen
94f4e001f4
nfc_initiator_target_is_present(): support MFUL on PN532 too
2014-01-29 23:02:36 +01:00
Romuald Conty
7b5ab23452
Partial MFC support while checking target presence on PN532/PN531
...
Goal is to implement "ping" on MFC the same as PN533 does. This patch implements MFC re-selection, but do not take care about authentication; this means this will have side effect while you are authenticated on a MFC block.
2014-01-29 11:36:12 +01:00
Philippe Teuwen
1a3acdadc4
Prepare nfc_initiator_target_is_present() to support more cases
...
and return NFC_EDEVNOTSUPP for cases not yet supported, depending on the chipset.
Little helper to debug future additions to that function:
// LIBNFC_LOG_LEVEL=193 ./nfc-testing
int
main(void)
{
nfc_device *pnd;
nfc_modulation nm = { .nmt = NMT_ISO14443A, .nbr = NBR_106, };
nfc_context *context;
nfc_init(&context);
pnd = nfc_open(context, NULL);
nfc_initiator_init(pnd);
nfc_target nt;
nfc_initiator_select_passive_target(pnd, nm, NULL, 0, &nt);
while (nfc_initiator_target_is_present(pnd, NULL) == NFC_SUCCESS);
nfc_close(pnd);
nfc_exit(context);
}
2014-01-29 01:54:46 +01:00
Philippe Teuwen
744e052fbe
update ChangeLog
2014-01-28 13:20:03 +01:00
Philippe Teuwen
65ad186109
make style
2014-01-28 13:09:33 +01:00
Romuald Conty
e5c732e181
Fix internal current target when using nfc_initiator_poll_target() (Thanks to Bjoern Kinscher)
...
Fixes Issue 265.
2014-01-28 10:45:05 +01:00
Romuald Conty
b7f590acc8
Set correctly last_error when running pn53x_initiator_target_is_present()
2014-01-28 10:40:18 +01:00
Romuald Conty
9a0a10826b
Fix pn53x_initiator_target_is_present() when saved target is NULL
...
This patch prevents from running any command to check target presence when none have been saved
2014-01-28 10:27:10 +01:00