Step One: Download libnfc
Before you can do anything, you will need to get a copy of libnfc. Make sure you have an Ethernet cable connected to your Pi, and run the following commands to get libnfc 1.7.0
UPDATE 22 Jan 2018: LIBNFC has moved to Github, and 1.7.0 can be downloaded directly from this URL: https://github.com/nfc-tools/libnfc/releases/tag/libnfc-1.7.0
Download:
file
$ cd /home/pi $ mkdir libnfc $ cd libnfc $ wget https://github.com/nfc-tools/libnfc/releases/download/libnfc-1.7.0/libnfc-1.7.0.tar.bz2 $ tar -xvjf libnfc-1.7.0.tar.bz2
You should see something similar to the following:
Step Two: Setup libnfc for the Pi
Before libnfc can be built, it needs to be configured for the target system and based on some parameters specific the NFC device you have connected.libnfc 1.7.0 and later use a new config file, which needs to be placed at a specific location. Thankfully, libnfc 1.7.0 includes a config file for the Raspberry Pi, which you can copy to the right destination with the following commands:
Download:
file
$ cd libnfc-1.7.0 $ sudo mkdir /etc/nfc $ sudo mkdir /etc/nfc/devices.d $ sudo cp contrib/libnfc/pn532_uart_on_rpi.conf.sample /etc/nfc/devices.d/pn532_uart_on_rpi.conf
Next, we need to make a small change to this file, which we can do by entering:
Download:
file
sudo nano /etc/nfc/devices.d/pn532_uart_on_rpi.conf
Update the file to include the following line at the bottom:
Download:
file
allow_intrusive_scan = true
Press CTRL+O then enter to save the file, and then CTRL+X to quite nano.
Step Three: Run Config
The next step is to configure the project itself using the 'configure' tool, as follows:
Download:
file
$ sudo apt-get install autoconf $ sudo apt-get install libtool $ sudo apt-get install libpcsclite-dev libusb-dev $ autoreconf -vis $ ./configure --with-drivers=pn532_uart --sysconfdir=/etc --prefix=/usr
This should give you the following screen once the configuration process is complete (it takes a few minute though):
Download:
file
$ sudo make clean $ sudo make install all
Which should start the (slowish!) build process as follows:
Once the build process is complete, you're ready to go on to testing the library on actual HW ...