libnfc can use a configuration file for special setups, or features activation.
This file (/etc/nfc/libnfc.conf under GNU/Linux systems) supports some keywords:
To enable/disable device auto-detection feature. Default is "true"
allow_autoscan = true/false
To enable/disable intrusive auto-detection (ie. serial port probing). Default is "false"
To select library verbosity. See corresponding section below about log levels.
To define a user device. See corresponding section below about connstrings.
device.name="My Reader Name" device.connstring="connstring"
This is the recommended method if the user has a not easily detectable device (ie. a serial one).
A sample is provided in the source code as libnfc.conf.sample
It is also possible to define devices using dedicated configuration files and put them into device search directory (/etc/nfc/devices.d under GNU/Linux).
Example for the OpenPCD2: create /etc/nfc/devices.d/openpcd2.conf with:
name = "OpenPCD2" connstring = "pn532_uart:/dev/ttyACM0" optional = true
The keyword "optional" does not mandate the device to be present always (it detects if the reader is indeed present before using it)
If you compile from sources and don't want SYSCONFDIR to be /usr/local/etc, use ./configure --sysconfdir=/etc
Overwriting "allow_autoscan" defined in the configuration:
Overwriting "allow_intrusive_scan" defined in the configuration:
Overwriting "log_level" defined in the configuration:
Add a user defined device on top of the list provided through config files:
Replace all possibly configured device by this one only:
Log levels can be defined globally or for a sub-system.
Log levels are:
- 0 none
- 1 error (default)
- 2 info
- 3 debug
If used alone, they apply globally, e.g.
will run the tool with all possible logging being activated.
To enable log only for one (or more) group, you can use this formula:
log_level = NFC_LOG_PRIORITY(main) + NFC_LOG_PRIORITY(group) * 2 ^ (NFC_LOG_GROUP(group) * 2)
with the following groups:
- 1 general
- 2 config
- 3 chip
- 4 driver
- 5 communication
- 6 libusb
- Main log level is NONE and only communication group log is set to DEBUG verbosity (for rx/tx trace): 0+3072
- Main log level is ERROR and DRIVER layer log is set to DEBUG level: 1+768
- Main log level is ERROR, DRIVER layer is set to INFO and COMMUNICATION is set to DEBUG: 1+512+3072
PN532 Breakout Board
ie. microbuilder.eu / Adafruit devices
PN532 device on R-Pi connected using UART
Note: to use UART port on R-Pi, you have to disable linux serial console, cf http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi/freeing-uart-on-the-pi