Libnfc

From NFC Tools
(Difference between revisions)
Jump to: navigation, search
(Debian / Ubuntu)
(Added missing dependency to build libnfc in Debian 7)
 
(7 intermediate revisions by 2 users not shown)
Line 14: Line 14:
  
 
== Development version ==
 
== Development version ==
Fetch current version using [https://en.wikipedia.org/wiki/Git_(software) Git] as described in this page: http://code.google.com/p/libnfc/source/checkout
+
Fetch current version using [https://en.wikipedia.org/wiki/Git_(software) Git]:
  
  git clone https://code.google.com/p/libnfc/
+
  git clone https://github.com/nfc-tools/libnfc.git
  
 
Note: If you want all libnfc hardware drivers, you will need to have libusb (library and headers) plus on *BSD and GNU/Linux systems, libpcsclite (library and headers).
 
Note: If you want all libnfc hardware drivers, you will need to have libusb (library and headers) plus on *BSD and GNU/Linux systems, libpcsclite (library and headers).
Line 32: Line 32:
  
 
==Third party packages==
 
==Third party packages==
* '''Ubuntu''' packages by '''Thomas Hood'''
 
** [https://launchpad.net/~jdthood/+archive/nfc-tools PPA]
 
 
* '''Debian''' packages by '''Nobuhiro Iwamatsu''' and '''Ludovic Rousseau'''
 
* '''Debian''' packages by '''Nobuhiro Iwamatsu''' and '''Ludovic Rousseau'''
 
** [http://packages.debian.org/libnfc packages] in Jessie & Sid
 
** [http://packages.debian.org/libnfc packages] in Jessie & Sid
Line 41: Line 39:
 
=Installation=
 
=Installation=
 
The following sections describe per platform how to install and use '''libnfc'''.  
 
The following sections describe per platform how to install and use '''libnfc'''.  
<br>Because some dependencies (e.g. [//libusb.wiki.sourceforge.net libusb],[//pcsclite.alioth.debian.org/   PCSC-Lite]) are used, the requirements per platform can differ.
+
 
 +
<br>Because some dependencies (e.g. [//libusb.wiki.sourceforge.net libusb] and optionnal [//pcsclite.alioth.debian.org/ PCSC-Lite]) are used, the requirements per platform can differ.
 
== POSIX systems ==
 
== POSIX systems ==
 
=== Manual installation ===
 
=== Manual installation ===
 
First make sure you have required compilation dependencies, ie. you will need headers from:
 
First make sure you have required compilation dependencies, ie. you will need headers from:
 
* libusb
 
* libusb
* pcsc-lite
 
  
 
Download and extract libnfc archive
 
Download and extract libnfc archive
 
<pre>
 
<pre>
$ wget http://libnfc.googlecode.com/files/libnfc-x.x.x.tar.gz
+
$ wget https://bintray.com/artifact/download/nfc-tools/sources/libnfc-x.x.x.tar.bz2
 
$ tar -xvzf libnfc-x.x.x.tar.gz
 
$ tar -xvzf libnfc-x.x.x.tar.gz
 
</pre>
 
</pre>
Line 64: Line 62:
 
Make sure you have required run-time dependencies.
 
Make sure you have required run-time dependencies.
 
* libusb
 
* libusb
* pcsc-lite (with pcscd), libccid
 
  
 
Plug in NFC device, and test if libnfc detect it
 
Plug in NFC device, and test if libnfc detect it
Line 80: Line 77:
 
$ sudo make install
 
$ sudo make install
 
</pre>
 
</pre>
 +
 +
Note: if you have any troubles, please read [https://github.com/nfc-tools/libnfc/blob/master/README README] and browse this wiki before asking (dumb) question on forum and/or maling-lists...
  
 
=== Debian / Ubuntu ===
 
=== Debian / Ubuntu ===
 
First make sure you have required compilation dependencies.
 
First make sure you have required compilation dependencies.
   $ sudo apt-get install libusb-dev libpcsclite-dev libextutils-pkgconfig-perl
+
   $ sudo apt-get install libusb-dev dh-autoreconf
  
 
Download and extract libnfc archive
 
Download and extract libnfc archive
 
<pre>
 
<pre>
git clone https://code.google.com/p/libnfc/
+
git clone https://github.com/nfc-tools/libnfc.git
 
cd libnfc
 
cd libnfc
 
git checkout libnfc-1.7.1
 
git checkout libnfc-1.7.1
Line 101: Line 100:
 
Make sure you have required run-time dependencies.
 
Make sure you have required run-time dependencies.
 
<pre>
 
<pre>
$ sudo apt-get install libusb-0.1-4 libpcsclite1 libccid pcscd
+
$ sudo apt-get install libusb-0.1-4
 
</pre>
 
</pre>
  
Line 130: Line 129:
  
 
   $ emerge libnfc
 
   $ emerge libnfc
 +
 
=== Fedora 12+ ===
 
=== Fedora 12+ ===
 
Thanks to ''François Kooman'', '''libnfc''' library is now included in Fedora 12+ distribution.
 
Thanks to ''François Kooman'', '''libnfc''' library is now included in Fedora 12+ distribution.
Line 157: Line 157:
 
   $ sudo port install glib
 
   $ sudo port install glib
  
Install glib:
+
Install libusb:
 
   $ sudo port install libusb
 
   $ sudo port install libusb
 +
 +
(If you simply install libusb, MacPorts will install all dependencies.)
  
 
Make sure it's the x86_64 version (when on the latest OS X):
 
Make sure it's the x86_64 version (when on the latest OS X):
   $ lipo -info /usr/local/lib/libusb.dylib
+
   $ lipo -info /opt/local/lib/libusb.dylib
  
As the libnfc's MacPort is not up-to-date, now follow '''Manual installation''' instructions to compile libnfc using usual autotools way.
+
(The default location of all software installed in MacPorts is within "/opt/local".) As the libnfc's MacPort is not up-to-date, now follow '''Manual installation''' instructions to compile libnfc using usual autotools way.
  
 
'''Warning''': We have previously posted a link to ''darwinports .com'', according to MacPorts project: they are an impostor / phishing site designed to get donations from unsuspecting users. Donations made to that site do not benefit MacPorts project and the instructions shown there for installing software are incorrect. To know more about this issue: http://trac.macports.org/wiki/DarwinPorts
 
'''Warning''': We have previously posted a link to ''darwinports .com'', according to MacPorts project: they are an impostor / phishing site designed to get donations from unsuspecting users. Donations made to that site do not benefit MacPorts project and the instructions shown there for installing software are incorrect. To know more about this issue: http://trac.macports.org/wiki/DarwinPorts
Line 190: Line 192:
 
=ChangeLog=
 
=ChangeLog=
 
ChangeLog is directly available from libnfc's repository:
 
ChangeLog is directly available from libnfc's repository:
https://code.google.com/p/libnfc/source/browse/ChangeLog
+
https://github.com/nfc-tools/libnfc/blob/master/ChangeLog
  
 
If you want more detailed change log, you can use the repository log:
 
If you want more detailed change log, you can use the repository log:
https://code.google.com/p/libnfc/source/list
+
https://github.com/nfc-tools/libnfc/commits/master
  
 
=Contribute=
 
=Contribute=
  
 
There are many ways to contribute to libnfc, including but not limited to:
 
There are many ways to contribute to libnfc, including but not limited to:
* reporting issues on [http://code.google.com/p/libnfc/issues/list libnfc issues tracker]
+
* reporting issues on [https://github.com/nfc-tools/libnfc/issues libnfc issues tracker]
 
* providing patches by one of those ways:
 
* providing patches by one of those ways:
** on [http://code.google.com/p/libnfc/issues/list libnfc issues tracker]  
+
** on [https://github.com/nfc-tools/libnfc/issues libnfc issues tracker]  
 
** using [https://groups.google.com/d/forum/nfc-tools-devel nfc-tools developers discussion group]
 
** using [https://groups.google.com/d/forum/nfc-tools-devel nfc-tools developers discussion group]
** forking the git repository: [https://code.google.com/p/libnfc/source/checkout go here], press the "create a clone" button and commit patches to your own copy of libnfc, preferably in a new branch, and let us know about it in the issues tracker on the discussion group.
+
** forking the git repository: [https://github.com/nfc-tools/libnfc/commits/master go here], press the "Fork" button and commit patches to your own copy of libnfc and let us know about it in the issues tracker on the discussion group or push-request's GitHub feature.
** forking the git repository elsewhere than on google.com, commit in a new branch and let us know.
+
 
* helping us to extend [[Libnfc:Testing|tests coverage]]
 
* helping us to extend [[Libnfc:Testing|tests coverage]]
  

Latest revision as of 10:09, 9 March 2017

Public platform independent Near Field Communication (NFC) library

libnfc is the first libre low level NFC SDK and Programmers API released under the GNU Lesser General Public License.
It provides complete transparency and royalty-free use for everyone.
This list shows the current supported features.
All major operating systems are supported, including GNU/Linux, Mac OS X and Windows. Compilation should work out of the box on POSIX-systems.
This library supports various NFC hardware devices: dongles, flat and OEM devices.
The library currently supports modulations for ISO/IEC 14443 A and B, FeliCa, Jewel/Topaz tags and Data Exchange Protocol (P2P) as target and as initiator.

Contents

[edit] Download

[edit] Stable release

Stable releases can be found at libnfc download section.

[edit] Development version

Fetch current version using Git:

git clone https://github.com/nfc-tools/libnfc.git

Note: If you want all libnfc hardware drivers, you will need to have libusb (library and headers) plus on *BSD and GNU/Linux systems, libpcsclite (library and headers).

Under MacOSX, GNU/Linux, *BSD and probably a lot of POSIX systems you can compile development version using:

autoreconf -vis
./configure --enable-doc
make
sudo make install

If you want to (re)generate documentation:

make doc

[edit] Third party packages

[edit] Installation

The following sections describe per platform how to install and use libnfc.


Because some dependencies (e.g. libusb and optionnal PCSC-Lite) are used, the requirements per platform can differ.

[edit] POSIX systems

[edit] Manual installation

First make sure you have required compilation dependencies, ie. you will need headers from:

  • libusb

Download and extract libnfc archive

$ wget https://bintray.com/artifact/download/nfc-tools/sources/libnfc-x.x.x.tar.bz2
$ tar -xvzf libnfc-x.x.x.tar.gz

Configure and compile

$ cd libnfc-x.x.x
$ ./configure --prefix=/usr --sysconfdir=/etc
$ make

Please note that ./configure have an installation path prefix set as /usr/local and sysconfdir set as $PREFIX/etc as default. Use --prefix and sysconfdir option, if you want another setup (see ./configure --help).

Make sure you have required run-time dependencies.

  • libusb

Plug in NFC device, and test if libnfc detect it

$ libnfc/utils/nfc-scan-device -v

Place a tag on it and show it

$ libnfc/utils/nfc-list

Install libnfc into your system

$ sudo make install

Note: if you have any troubles, please read README and browse this wiki before asking (dumb) question on forum and/or maling-lists...

[edit] Debian / Ubuntu

First make sure you have required compilation dependencies.

 $ sudo apt-get install libusb-dev dh-autoreconf

Download and extract libnfc archive

git clone https://github.com/nfc-tools/libnfc.git
cd libnfc
git checkout libnfc-1.7.1
git clean -d -f -x
#rm ../libnfc*.deb
git remote|grep -q anonscm||git remote add anonscm git://anonscm.debian.org/collab-maint/libnfc.git
git fetch anonscm
git checkout remotes/anonscm/master debian
git reset
dpkg-buildpackage -uc -us -b

Make sure you have required run-time dependencies.

$ sudo apt-get install libusb-0.1-4

Install libnfc into your system

$ sudo dpkg -i ../libnfc*.deb

Plug in NFC device, place a tag on it and test your installation

$ nfc-list

[edit] FreeBSD

Romain Tartière contributed a FreeBSD port of libnfc, thanks to him.

  • To install the port:
 cd /usr/ports/devel/libnfc/ && make install clean
  • To add the package:
 pkg_add -r libnfc


[edit] Gentoo

Thanks to Mike Auty, libnfc have a ebuild to be easily installed on Gentoo using usual way:

 $ emerge libnfc

[edit] Fedora 12+

Thanks to François Kooman, libnfc library is now included in Fedora 12+ distribution.

[edit] Using command line interface

 # yum install libnfc libnfc-devel libnfc-examples
  • libnfc-devel contains development headers and libraries, its only necessary if you want to

compile your own applications requiring libnfc

  • libnfc-examples contains the example tools like nfc-list.

[edit] Using graphical tools

  • System -> Administration -> Add/Remove Software
  • Search for libnfc and select the appropriate packages for installation.

[edit] Mac OS X

For installing dependencies, MacPorts download manager is used (available at: http://distfiles.macports.org/MacPorts/)

Install MacPorts following instructions from http://www.macports.org/install.php

Install pkg-config:

 $ sudo port install pkgconfig

Install glib:

 $ sudo port install glib

Install libusb:

 $ sudo port install libusb

(If you simply install libusb, MacPorts will install all dependencies.)

Make sure it's the x86_64 version (when on the latest OS X):

 $ lipo -info /opt/local/lib/libusb.dylib

(The default location of all software installed in MacPorts is within "/opt/local".) As the libnfc's MacPort is not up-to-date, now follow Manual installation instructions to compile libnfc using usual autotools way.

Warning: We have previously posted a link to darwinports .com, according to MacPorts project: they are an impostor / phishing site designed to get donations from unsuspecting users. Donations made to that site do not benefit MacPorts project and the instructions shown there for installing software are incorrect. To know more about this issue: http://trac.macports.org/wiki/DarwinPorts

Official MacPorts' site: http://www.macports.org/ If you are looking for how to use and install MacPorts, please visit: http://guide.macports.org/

[edit] Windows

See Libnfc:Windows

[edit] Configuration

Libnfc can be tuned by a config file as well as with environment variables.
See the configuration page.

[edit] Usage

See Examples how to create code using libnfc.

For a list of projects using this library, see Related links.

A few of them have their page on this wiki, check Software category

[edit] Troubleshooting

Having trouble? Check the FAQs and consult the Troubleshooting page.
Make sure you've checked the configuration page too.

[edit] ChangeLog

ChangeLog is directly available from libnfc's repository: https://github.com/nfc-tools/libnfc/blob/master/ChangeLog

If you want more detailed change log, you can use the repository log: https://github.com/nfc-tools/libnfc/commits/master

[edit] Contribute

There are many ways to contribute to libnfc, including but not limited to:

[edit] Sponsoring

You can also sponsor us with hardware donations, to do so please contact romuald@libnfc.org.

If you are manufacturer and you want your device to be supported in libnfc, feel free to send a mail to romuald@libnfc.org.

Thanks to manufacturers which already done it, see sponsor page.

Personal tools
Namespaces

Variants
Actions
Navigation
Documentation
Misc
Toolbox
Partners