NFC study Note 2-libnfc introduction and Installation

Source: Internet
Author: User

I have always wanted to write down the English articles I have translated, and learn NFC, now we will translate the libnfc homepage introduction and libnfc installation articles on different operating systems. On the one hand, we will improve our English, and on the other hand, we will learn about libnfc.


Original address: http://nfc-tools.org/index.php? Title = libnfc

Independent Near-Field Communication (NFC) library on the public platform

Libnfc is the first free underlying NFC Development Kit and programming API released under the GNU Public License. It is free and open to anyone. This list shows functions supported by libnfc. Libnfc supports all mainstream operating systems, including GNU/Linux, Mac OS X, and windows. The compiling environment should be based on the POSIX system kernel. The libnfc Library supports various NFC hardware libraries, such as dongles, flat, and OEM devices. Libnfc currently supports ISO/IEC 14443 protocols a, B, felica, Jewel/Topaz tags and point-to-point data exchange between initiators and receivers.

Download Stable version

Stable version can be downloaded from

Development version

Get the current version from the http://code.google.com/p/libnfc/source/checkout through git

git clone https://code.google.com/p/libnfc/
Note: If you want to enable all libnfc hardware, you also need the libusb library and header file, as well as the * BSD and GNU/Linux operating systems, libpcsclite library, and header file.

In maxos, GNU/Linux, * BSD, and some POSIX systems, you can use the following command to compile the libnfc Library:

autoreconf -vis./configure --enable-docmakesudo make install

Run the following command to generate the document:

make doc

Third-party packages

Thomas Hood -- Ubuntu

  • PPA

Nobuhiro iwamatsu, Ludovic Rousseau -- Debian

  • Packages in Jessie & SID
  • Package tracking
  • Git repo (GIT: // anonscm.debian.org/collab-maint/libnfc.git)
Install

This section describes how each platform installs and uses the libnfc library. Because of the use of some dependent libraries (libusb, PSCs-lite), the situation of each platform is different.

POSIX System

Obtain all the dependent packages and header files required for compilation: libsub and pcsc-lite. Download libnfc:

$ wget http://libnfc.googlecode.com/files/libnfc-x.x.x.tar.gz$ tar -xvzf libnfc-x.x.x.tar.gz

Configuration and Compilation:

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

Note: The prefix of the./configure installation directory can also be set to/usr/local, and sysconfidir can be set to $ prefix/etc as the default value. If you want other startup configurations, you can use the -- prefix and sysconfdir options.

You must have runtime dependent libraries: libusb, pcsc-Runtime (with pscsd), libccid

Insert an NFC device and run the following command to use libnfc to detect the device:

$ libnfc/utils/nfc-scan-device -v
Place a tag and run the following command:

$ libnfc/utils/nfc-list
Install libnfc:

$ sudo make install
Debian/Ubuntu

Obtain all required dependent Libraries

 $ sudo apt-get install libusb-dev libpcsclite-dev
Download libnfc:

git clone https://code.google.com/p/libnfc/cd libnfcgit checkout libnfc-1.7.1git clean -d -f -x#rm ../libnfc*.debgit remote|grep -q anonscm||git remote add anonscm git://anonscm.debian.org/collab-maint/libnfc.gitgit fetch anonscmgit checkout remotes/anonscm/master debiangit resetdpkg-buildpackage -uc -us -b
Obtain the required runtime dependent Libraries

$ sudo apt-get install libusb-0.1-4 libpcsclite1 libccid pcscd
Install libnfc

$ sudo dpkg -i ../libnfc*.deb
Insert an NFC device, place a tag, and test the installation.

$ nfc-list
FreeBSD

The libnfc source provided by Romain Tartiere is appreciated.

Installation Source

 cd /usr/ports/devel/libnfc/ && make install clean
Add libnfc package

 pkg_add -r libnfc

Gentoo

Thanks to Mike auty, libnfc has a simple installation method on Gentoo:

 $ emerge libnfc

Fedora 12 +

Thanks to Francois kooman, libnfc is currently included in the ora 12 + distribution package.

Use the command number Interface

 # yum install libnfc libnfc-devel libnfc-examples
Libnfc-devel contains the developed header files and libraries, which are only the libnfc libraries required to compile your own programs.

Libnfc-examples contains some example tools such as NFC-list.

Use drawing tools

System> administrator> add or delete a program

Search for libnfc and select the appropriate installation package

Mac OS X

Install dependency package, need surge Ah macport Download Manager, for: http://distfiles.macports.org/MacPorts/

Install macports via this article: 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
When using the latest version of OS X, you must determine that it is an x86_64 version.

 $ lipo -info /usr/local/lib/libusb.dylib
Because the libnfc macport is not updated in real time, you need to compile libnfc by using an automatic tool in the manual Installation Wizard.

Official macport site: http://www.macports.org/, macportsuse and installation Tutorial: http://guide.macports.org


Windows

Windows Installation is a little complicated and will be translated in the next article.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.