Download pre-built binaries from releases.
git clone https://github.com/dotside-studios/davi-nfc-agent.git
cd davi-nfc-agent
go build ./cmd/davi-nfc-agent
The agent uses PC/SC for NFC reader communication. PC/SC is built into all major operating systems:
pcsclite:
# Debian/Ubuntu
sudo apt install pcscd libpcsclite1
# Fedora/RHEL
sudo dnf install pcsc-lite
# Arch Linux
sudo pacman -S pcsclite
The agent loads the PC/SC library at runtime, so the -dev headers are not
needed to build or run it.
Any PC/SC-compatible NFC reader works, including:
# Linux
sudo systemctl status pcscd
sudo systemctl start pcscd
# Linux
pcsc_scan
Flash and Beep on Scan in the tray menu makes the reader signal each operation: one green flash with a short beep when a tag is read or written, two red flashes when a write or a lock fails. It is off by default, and turning it on lasts as long as the agent runs.
The commands come from the ACS ACR122U instruction set, so ACR122 readers answer
them; other readers report the feature as unsupported and are skipped. They are
sent over SCardControl, and two stacks refuse to carry those commands until
told to:
ifdDriverOptions in the CCID driver’s
libccid_Info.plist (usually /etc/libccid_Info.plist or under
/usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist) and restart
pcscd. Without it pcsc-lite reports SCARD_E_NOT_TRANSACTED.EscapeCommandEnable set for the reader under
HKLM\SYSTEM\CurrentControlSet\Enum\...\Device Parameters\WUDFUsbccidDriver.Neither is required while a tag is on the reader: the agent falls back to sending the same command over the card connection, and logs once when it does. A reader that answers on neither channel is left alone for the rest of the session.
Add your user to the pcscd group or add udev rules:
# Create udev rule for common NFC readers
sudo tee /etc/udev/rules.d/99-nfc.rules << 'EOF'
SUBSYSTEM=="usb", ATTR{idVendor}=="072f", MODE="0666"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e6", MODE="0666"
EOF
sudo udevadm control --reload-rules
sudo udevadm trigger