Sorry, you need to enable JavaScript to visit this website.

Feedback

Your feedback is important to keep improving our website and offer you a more reliable experience.

How to start with the linux-nfc code

This how-to is based on Ubuntu 12.04 64bits Prerequisite: Let's start with an up-to-date ubuntu installation: sudo apt-get update You need to following packages to build the nfc kernel and neard: Needed for building the kernel: sudo apt-get install git-core ncurses-dev gcc kernel-package ..and to build neard: sudo apt-get install build-essential automake libtool libglib2.0-dev libdbus-1-dev libnl2-dev Now, get the source of the kernel and the daemon :

  • mkdir NFC
  • cd NFC
  • git clone -b nfc-next-stable git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next.git
  • git clone git://git.kernel.org/pub/scm/network/nfc/neard.git

and optionnaly for Neardal :

  • git clone git://github.com/connectivity/neardal

First step will be to build the kernel:

  • cd ~/NFC/nfc-3.0
  • cp /boot/config-3.2.0-25-generic .config
  • make oldconfig
  • make menuconfig

Here, you should select the nfc components you want (if you don't know which one, you can select all the submenu entries) Networking support->NFC subsystem support->... Exit and Save (in the .config file, you should find the following entries:

CONFIG_NFC=m 
CONFIG_NFC_NCI=m 
CONFIG_NFC_HCI=m 
CONFIG_NFC_SHDLC=y 
CONFIG_NFC_LLCP=y 
# # Near Field Communication (NFC) devices # 
CONFIG_PN544_NFC=m 
CONFIG_NFC_PN533=m 
CONFIG_NFC_WILINK=m  

Kernel build:

  • make-kpkg clean
  • CONCURRENCY_LEVEL=$(($(getconf _NPROCESSORS_ONLN)+1)) fakeroot make-kpkg --initrd --append-to-version=-nfc kernel_image kernel_headers
  • (...take a break, a coffee or anything you want ;) )
  • make modules
  • sudo make modules_install

Install the new kernel:

  • sudo dpkg -i ../linux-{headers,image}-3.*.deb

Your kernel is now ready to be used, right after the next reboot...

Next step: Neard:

(this step is not needed anymore with last stable kernel)

Don't forget to copy the nfc.h file in the /usr/include/linux directory:

sudo cp ~/NFC/nfc-3.0/include/linux/nfc.h /usr/include/linux (or cp ~/NFC/nfc-3.0/include/uapi/linux/nfc.h /usr/include/linux) 

How to build neard

  • cd ~/NFC/neard
  • ./bootstrap-configure
  • make
  • sudo make install
  • sudo cp src/org.neard.conf /etc/dbus-1/system.d

Now, all the builds are done, everything should work...

(optional) Neardal : How to build neardal

  • cd ~/NFC/neardal
  • ./autogen.sh
  • ./configure --disable-traces
  • make
  • sudo ldconfig

How to test neard e.g. with a PN533 device (e.g.: SCL3711 dongle):

  • cd ~/NFC/neard
  • sudo ./src/neard -nd '*'

( -nd '*' makes neard to run in "not daemon mode" with debug traces...) If you plug the NFC dongle, you should see some debug lines specifying the device path (e.g.: /org/neard/nfc1). You can find some very useful scripts is the test subdir: e.g: ./list-adapters will give the path of the plugged dongles. ./start-poll launches the poll mode How to test neard using neardal

  • cd ~/NFC/neardal
  • ncl/ncl

A prompt "NCL> " must be displayed and the list of available commands. Any of these commands must be executed to register neardal and listen for NFC events. get_adapters will give the path of the plugged dongles. start-poll /org/neard/nfcX launches the poll mode

How to test p2p features

This "how-to" explains how to test neard with Stephen Tiedemann's nfcpy implementation (https://launchpad.net/nfcpy)

Requirements:

Two usb dongles (e.g. SCL 3711) One "real" PC, sets up to work with neard ( NFC kernel, neard) One Linux virtual machine (e.g.: Virtualbox / Ubuntu)

Objectives:

The aim is to setup a simple test configuration, to check/eval neard p2p support. As nfcpy is considered as the NFC forum reference implementation, we want to use Stephen's code.

Steps:

First, we will prepare the "nfcpy side", on the virtual machine. In this test, we are using a Ubuntu 12.04 VM. all the packages must be upgraded.

  1. Start the virtual machine (e.g.: Virtualbox Ubuntu 12.04)
  2. Plug the NFC dongle A
  3. Activate the dongle inside the VM (Devices -> USB devices-> "SCM Micro SCL3711..."
  4. If needed, remove the driver from the guest with sudo rmmod pn533

Now, the nfcpy code should work. To test, get the nfcpy code and type: sudo nfcpy/examples/tagtool.py The traces should be like:pctest@pctest_vbox:~/NFC/nfcpy/nfcpy/examples$ sudo ./tagtool.py searching for a usable reader searching for a usb bus reader chipset is a PN533 version 2.7 using SCM Micro SCL3711-NFC&RW at usb:002:005 Now, you can use a formatted tag on this dongle (e.g. a type 4), and get some log infos like : 000ed1010a5501696e74656c2e636f6d432064656d6f510115550373636d6d6963726f2e636f6d2f73636c333731303a4755495445523b4f6c6976 59 Type4Tag ATQ=4403 SAK=20 UID=04756e4aef2280 NDEF content version = 2.0 writeable = yes capacity = 2046 byte data size = 14 byte 0000: d1 01 0a 55 01 69 6e 74 65 6c 2e 63 6f 6d ...U.intel.com NDEF records [0] type = urn:nfc:wkt:U [0] name = [0] data = .intel.com Now, you can setup the *real* PC, aka the Neard machine, following the usual steps:

  • Build NFC kernel
  • Plug the dongle B
  • Launch neard

How to test:

In this example, we will explain how to use the nfcpy test01 llcp script against neard:

  • On the VM, launch llcp client script: sudo ./llcp-test-client.py -t 1
  • on the host, launch start poll in Initiator mode on the correct adapter, e.g.: ./test/start-poll nfc0 Initiator
  • Then, approach the two dongles... you should see on the VM some log messages like: activated as p2p target in 424 kbps active mode LLCP Link established, I'm the DEP Target Local LLCP Settings LLCP Version: 1.1 Link Timeout: 500 ms Max Inf Unit: 1024 octet Service List: 0000000000000011 Remote LLCP Settings LLCP Version: 1.1 Link Timeout: 1500 ms Max Inf Unit: 2175 octet Service List: 0001000000000000 Test 1: link activation, symmetry and deactivation PASS shutdown on link disruption I was the Target

Now, you can "play" with other test cases...

Neardal sample code

This sample code show how to use NeardAL to monitoring Neard events. This code must be compiled using automake tools. But before compiling, make sure NeardAL Library is compiled and installed : (How to start with the linux-nfc code). section "Next step: Neardal (optional)" This archive contains the following files : the main.c the autogen.sh file used to generate configure... The Makefile.am file. The configure.ac file. How to generate : Download neard_monitor.tar in a folder, and untar it. cd [NEARD_MONITOR_ARCHIVE] tar -xf neard_monitor.tar cd neard_monitor ./autogen.sh ./configure make If the compilation is OK, you can now launch neard_monitor : cd [NEARD_MONITOR_SRC] ./neard_monitor&

Project: