NFC

提供: ArchWiki
2024年1月14日 (日) 00:09時点におけるKgx (トーク | 投稿記録)による版 (英語版から転載)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
ナビゲーションに移動 検索に移動

Near-field 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 and https://nfc-tools.github.io/resources/ by libnfc.

Troubleshooting

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