NFC

From ArchWiki
Jump to navigation Jump to search

Near-field communication communication devices have become pretty easy to operate and read out under Linux. This page explains how to quickly set up the most common NFC scanners.

Installation

Install ccid, libnfc, acsccid, pcsclite and pcsc-tools.

The pcsclite package ships a pcscd.socket which will cause the pcscd server to start when a program requests it. Alternatively, you can manually start/enable the pcscd.service.

After installing libnfc, it is important that you re-plug your card reader as it ships with a few udev rules and kernel module blacklist that need to load before loading the actual driver.

Scanning an NFC card

Now everything should already be in place for a test scan. Plug in your NFC reader and run pcsc_scan. This tool will try to communicate with your scanner and also poll for any NFC cards placed on your scanner. If you try to scan a card after the tool has found your scanner, you should see events printed on your terminal.

$ pcsc_scan
Using reader plug'n play mechanism
Scanning present readers...
0: ACS ACR122U 00 00
 
Sun Sep  5 05:15:10 2021
 Reader 0: ACS ACR122U 00 00
  Event number: 0
  Card state: Card removed,

Supported devices

See https://ccid.apdu.fr/#readers for a list of scanners supported by ccid.

Troubleshooting

In case things do not seem to work, investigate the log of pcscd.service