Touchatag RFID Reader
Touchatag 是来自 Touchatag 的 RFID 标签读卡器。它是一个廉价的套件,包含一个 ACR122U USB 标签读卡器和 MiFare Ultralight RFID 标签(USB ID 072f:2200,使用 lsusb -v 检查固件版本 - 截至 2020-05-10 为 2.14 - 在 bcdDevice 描述符下)。
安装
停止加载冲突的驱动程序(nfc、pn533 和 pn533_usb)。
请参阅关于 黑名单 驱动程序的注意事项:它们仍然可以手动加载,因此您应该 创建 以下文件
/etc/modprobe.d/blacklist.conf
install nfc /bin/false install pn533 /bin/false install pn533_usb /bin/false
重新加载 udev 规则,如果已加载,则卸载冲突的模块。
# rmmod pn533_usb pn533 nfc
或直接重启。
有两种方式可以将标签读卡器连接到 libnfc。它们之间的区别在 stackoverflow 上有详细介绍。
USB
这是使用此设备的现代推荐方法。
要使用 acr122_usb,您不需要运行 pcsc 守护进程(libnfc README 目前告诉您运行它,但这适用于 PC/SC 方式)。
PC/SC
这是使用此设备的旧有且已弃用的方法。
安装 ccid 和 pcsc-tools。
用法
USB
检查设备是否已检测到
# nfc-list
nfc-list uses libnfc 1.7.1 NFC device: ACS / ACR122U PICC Interface opened
读取 NFC 卡也同样有效
# nfc-poll
nfc-poll uses libnfc 1.7.1
NFC reader: ACS / ACR122U PICC Interface opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
ISO/IEC 14443A (106 kbps) target:
ATQA (SENS_RES): 00 04
UID (NFCID1): 42 14 3e 2e
SAK (SEL_RES): 08
Waiting for card removing...nfc_initiator_target_is_present: Target Released
done.
PC/SC
要测试该设备,请运行
# pcscd -f
启动 pcscd.service,然后将标签放在读卡器上,结果应如下所示
# pcsc_scan
PC/SC device scanner
V 1.4.17 (c) 2001-2009, Ludovic Rousseau <ludovic.rousseau@free.fr>
Compiled with PC/SC lite version: 1.6.6
Scanning present readers...
0: ACS ACR122U 00 00
Mon Mar 21 18:16:07 2011
Reader 0: ACS ACR122U 00 00
Card state: Card inserted, Shared Mode,
ATR: 3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
ATR: 3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
+ TS = 3B --> Direct Convention
+ T0 = BE, Y(1): 1011, K: 14 (historical bytes)
TA(1) = 95 --> Fi=512, Di=16, 32 cycles/ETU
125000 bits/s at 4 MHz, fMax for Fi = 5 MHz => 156250 bits/s
TB(1) = 00 --> VPP is not electrically connected
TD(1) = 00 --> Y(i+1) = 0000, Protocol T = 0
-----
+ Historical bytes: 41 03 00 00 00 00 00 00 00 00 00 02 90 00
Category indicator byte: 41 (proprietary format)
Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
touchatag SAM card
技巧与提示
tagEventor
tagEventor 在后台运行,并在标签进入或离开您的标签读卡器时执行脚本。
运行 tagEventor 测试您的安装
# tagEventor -v 1
脚本位于 /etc/gtagEventor。请阅读 tagEventor 文档了解如何使用它们。
故障排除
固件 [...] 是错误的!请升级读卡器固件
如果您遇到类似这样的问题
ccid_usb.c:859:ccid_check_firmware() Firmware (1.00) is bogus! Upgrade the reader firmware or get a new reader. ifdhandler.c:104:IFDHCreateChannelByName() failed readerfactory.c:1050:RFInitializeReader() Open Port 200000 Failed (usb:072f/2200:libusb:006) readerfactory.c:233:RFAddReader() ACS ACR122U PICC Interface init failed.
libnfc README 建议执行以下操作
移除 libccid 的错误固件检测:编辑 libccid_Info.plist 配置文件(通常是 /etc/libccid_Info.plist),找到 <key>ifdDriverOptions</key>,将 <string>0x0000</string> 改为 0x0004 以允许错误的设备,然后 重启 pcscd.service。
/usr/lib/pcsc/drivers/ifd-acsccid.bundle/Contents/Info.plist 或 /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist。