Commit graph

2169 commits

Author SHA1 Message Date
Adam Laurie
84c3e8a3ba Fix number of blocks written. Fix number of written blocks reported. 2017-01-30 21:47:06 +00:00
Christoph Gritschenberger
11a2da2811 allow to cross-compile 32 and 64 bit versions of the library for windows 2017-01-25 18:44:44 +01:00
jgeslin
f9f03fa7fa Debug dedicated implementation removed 2017-01-12 09:53:40 +01:00
Romuald Conty
8e5ec4acf3 Merge pull request #383 from centromere/patch-2
Fix typo in nfc.c
2016-12-11 16:46:36 +01:00
Romuald Conty
e0c72b782f Merge pull request #382 from centromere/patch-1
Fix typo in nfc.h
2016-12-11 16:46:04 +01:00
Romuald Conty
3592a60c1d Merge pull request #381 from llorephie/patch-1
Update Makefile.am
2016-12-11 16:45:22 +01:00
John Galt
9c7b9eda8c Fix typo in nfc.c 2016-12-07 07:22:27 -05:00
John Galt
b38597f1e0 Fix typo in nfc.h 2016-12-07 06:17:04 -05:00
Romuald Conty
e9a750fc00 Merge pull request #379 from oliv3r/Errata_on_i2c_timing
drivers: pn532_i2c: Errata on i2c timing
2016-12-06 17:58:30 +01:00
Maxim Martyanov
e32cc068ec Update README.md
README-Windows.txt => README-Windows.md
2016-12-06 20:44:31 +04:00
Maxim Martyanov
b29332a309 Update Makefile.am
README-Windows.txt -> README-Windows.md
2016-12-06 20:43:08 +04:00
Olliver Schinagl
e946f7a97a drivers: pn532_i2c: Errata on i2c timing
The datasheet is wrong for the pn532_i2c. After having constant issues
with the device failing to respond on the bus and after contacting NXP
about this, it turns out 1.3 ms is too tight. The official timing spec
is unknown for now, but we tested 4 and 5 ms without problems. Thus we
have choosen 5 ms as a safe delay.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-12-06 11:40:56 +01:00
Romuald Conty
b2a9cce037 Merge pull request #367 from oliv3r/respect_pn532_i2c_timing
Respect pn532 i2c timing
2016-12-05 22:12:52 +01:00
Romuald Conty
c3b3f64224 Merge pull request #372 from timzi/fix-cmakelists
Fixed file name "README" in cmakelists.txt
2016-12-05 22:10:33 +01:00
Romuald Conty
a07a496234 Merge pull request #378 from BourgeoisLab/patch-1
Match nfc.h
2016-12-05 19:50:49 +01:00
Frédéric Bourgeois
65477eea5e Match nfc.h
Synchronized with nfc.h with all API functions
2016-12-05 13:11:45 +01:00
timzi
a625d6a02d Fixed file name "README" in cmakelists.txt 2016-11-20 20:32:25 +03:00
Olliver Schinagl
d960673681 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-24 13:05:42 +02:00
Olliver Schinagl
8f8f780c2b 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>
2016-10-24 12:02:58 +02:00
Olliver Schinagl
b953002f8f 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-24 12:00:36 +02:00
Olliver Schinagl
512be89700 busses: i2c: improve logging
Currently we only inform the user with the error logging mechanism that
we received a different number of bytes than expected.

Thus in case of an error, we say that we sent/received -1 bytes. However
-1 indicates an error and errno is set to indicate the error state.

This patch extends the logging to also print the actual error.

Additionally the same debugging printing was added to read, which is now
silently returned to the caller.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
2016-10-21 14:20:51 +02:00
Olliver Schinagl
61b42396d9 CMake: allow building of debian packages
This patch allows for using the CMakefile to generate debian packages.
While CPack is far from perfect for generating debian packages, it is a
minimal change and quite helpful for quick deployment on debian based
systems.

Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com>
2016-10-21 14:20:51 +02:00
Jeremy
4a10d0f21b Cosmetics changes 2016-10-10 17:36:55 +02:00
Jeremy
7eae55e929 Adding pn71xx NXP's NFC Controllers through Linux Libnfc-nci 2016-10-06 17:40:48 +02:00
Jim Anastassiou
0d3d5c13ff Add R-Pi 3 conf sample.
There have been changes to the Raspberry Pi 3's usage of serial ports with the addition of a Bluetooth LE module.
This configuration uses the mini UART without disabling any devices except for the linux serial console.
2016-08-19 19:22:06 -04:00
Jim Anastassiou
27ed3acc1a Update pn532_uart_on_rpi_3.conf.sample 2016-08-19 18:38:19 -04:00
Jim Anastassiou
35cc69dffb Rename pn532_uart_on_rpi3.conf.sample to pn532_uart_on_rpi_3.conf.sample 2016-08-19 18:37:04 -04:00
Jim Anastassiou
4076046a66 Create pn532_uart_on_rpi3.conf.sample 2016-08-19 18:36:48 -04:00
Romuald Conty
659f5f407f Merge pull request #357 from yerzhanm/patch-1
added support for ACR1222U-C1
2016-06-24 02:49:29 +02:00
yerzhanm
41d694013c added support for ACR1222U-C1
added ACR1222U-C1 ACS ACR1222 1SAM PICC Reader in supported devices
2016-06-23 18:20:39 +06:00
Romuald Conty
403650a0fc Merge pull request #350 from oliv3r/master
Allow mfultralight and mfc tools to work also with specific UID's
2016-05-15 11:48:39 +02:00
Olliver Schinagl
a4bc1b9f6c nfc-mfultralight: also set failure state on uid write error
Currently, we return false, and after turning set the bFailure state.
This is of course not possible.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-05-13 14:44:07 +02:00
Olliver Schinagl
ed62b01a0f nfc-mfultralight: write uiBlocks, as we read
We use a variable, uiBlocks, to determine how many blocks to read/write.
Reading is actually done via a hardcoded 0xF value however.

Additionally, make uiblocks a const, as we use it as a constant and
change the page variable to uint32_t for consistency sake.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-05-13 14:44:07 +02:00
Olliver Schinagl
4b8871fd8f nfc-mfultralight: Remove whitespaces
Clean up some stray unintended whitespaces. This patch does not
introduce any binary changes.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-05-11 09:38:39 +02:00
Olliver Schinagl
ecd0e59b5c nfc-mfultralight: Add option to specify UID
When several tags are in range, nfc-mfultralight uses the lowest ID it
finds by default. This patch adds some code from nfc-list that lists the
tags in range whenever an operation is performed (r/w). Further more it
adds the --with-uid <UID> option to force reading/writing of a specific
tag.

The UID can be up to 10 bytes long and can be optionally separated by
colons or hyphens (MAC address style).

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-05-11 09:38:39 +02:00
Olliver Schinagl
7b1ff70a52 nfc-mfultralight: Show help when no arguments are supplied
For some reason, 0cece94778 changed the argc count check to only show
the help if argc is 0. Obviously, argc is never zero, as the first
argument in argv is always the binary itself. Revert that and show usage
if there is no arguments supplied to the binary.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-05-11 09:38:39 +02:00
Olliver Schinagl
e1a25a8203 nfc-mfclassic: Add option to specify key
The nfc-mfclassic utility will pick a seemingly random (the libnfc
default which seems to be the lowest UID). With the new (u|U) options
it is now possible to force a UID and thus write a specific tag, which
can be very useful if there are more then one tag visible.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-05-11 09:38:39 +02:00
Olliver Schinagl
898f3a4d2f nfc-mfclassic: check argc < 4 only once
Currently the check on argc is done twice, once in each if branch. This
is silly and we can just check once and fail right away.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2016-05-11 09:38:39 +02:00
Romuald Conty
83b70d6326 Merge pull request #349 from frankmorgner/foreign
tell Automake that we will not follow GNU Standards
2016-05-03 11:15:47 +02:00
Frank Morgner
7d4352dc98 tell Automake that we will not follow GNU Standards
NEWS and README are mandatory for autoconf. Fixes problem introduced in
b1a81b385d

closes https://github.com/nfc-tools/libnfc/pull/346
fixes https://github.com/nfc-tools/libnfc/issues/347
2016-05-03 10:53:55 +02:00
Romuald Conty
e23f8a9f9c Merge pull request #345 from quantum-x/ultralight-gen-2
Adding support for UL Gen 2 Badges
2016-04-09 11:25:11 +02:00
Simon Yorkston
e37de54e18 Updated to remove bugs
- For cards that aren’t magic, system will refuse to attempt writing
to block 0  / 1

 - Tested on Gen 1 & Gen 2 cards:

Gen 1
$ ./nfc-mfultralight w ul-test.dmp --full
NFC device: SCM Micro / SCL3711-NFC&RW opened
Found MIFARE Ultralight card with UID: 044e075ad42184
Writing 16 pages |................|
Done, 16 of 16 pages written (0 pages skipped).

Gen 2
$ ./nfc-mfultralight w ul-test.dmp --full
NFC device: SCM Micro / SCL3711-NFC&RW opened
Found MIFARE Ultralight card with UID: 044e075ad42184
Writing 16 pages |................|
Done, 16 of 16 pages written (0 pages skipped).

Non-magic
$ ./nfc-mfultralight w ul-test.dmp --full
NFC device: SCM Micro / SCL3711-NFC&RW opened
Found MIFARE Ultralight card with UID: 044e075ad42184
Writing 16 pages |
Unable to unlock card - are you sure the card is magic?
$
2016-04-09 03:42:01 +10:00
Romuald Conty
e8e1826eeb Merge pull request #344 from hiddewie/markdown2
Actual Markdown for the README and HACKING files
2016-04-08 18:53:05 +02:00
Simon Yorkston
8de7ce3899 Adding support for UL Gen 2 Badges 2016-04-09 01:32:14 +10:00
Hidde Wieringa
1f68888020
Added Markdown to HACKING file 2016-04-08 11:02:40 +02:00
Hidde Wieringa
291f70edee
Updated README-Windows for Markdown 2016-04-08 10:56:12 +02:00
Hidde Wieringa
62159a33ef
Added more Markdown formatting to README 2016-04-08 10:52:25 +02:00
Romuald Conty
d63e624b09 Merge pull request #341 from hiddewie/markdown
Changed a few README Markdown files to the .md extension so GitHub interprets it as Markdown
2016-04-07 20:09:46 +02:00
Hidde Wieringa
b1a81b385d
Changed a few README Markdown files to the .md extension so GitHub
interprets it as Markdown
2016-04-07 13:52:12 +02:00
Romuald Conty
bc8bb8de89 Merge pull request #315 from xantares/travis
Add travis config file
2016-03-19 12:44:59 +01:00