树莓派ACR122U读取NFC标签卡

这里采用的NFC读卡器为龙杰ACR122U,测试卡片为标准M1卡

安装驱动以及依赖包

sudo aptitude install libusb-dev libpcsclite-dev autoconf
sudo aptitude remove libnfc5
wget https://coding.net/u/sfantree/p/self_use_OSS/git/raw/master/source/libacsccid_armhf.deb
sudo dpkg -i libacsccid_armhf.deb

安装libnfc

#wget https://coding.net/u/sfantree/p/self_use_OSS/git/raw/master/source/libnfc-1.7.1.tar.bz2
wget https://github.com/nfc-tools/libnfc/releases/download/libnfc-1.7.1/libnfc-1.7.1.tar.bz2
cd libnfc-1.7.1
./configure --with-drivers=acr122_usb --prefix=/usr/local/libnfc --sysconfdir=/etc
make
make install

安装mfoc

#wget https://coding.net/u/sfantree/p/self_use_OSS/git/raw/master/source/mfoc-0.10.7.zip
wget https://github.com/nfc-tools/mfoc/archive/mfoc-0.10.7.zip
unzip mfoc-0.10.7.zip
cd mfoc-mfoc-0.10.7
autoreconf -vis
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/libnfc/lib/pkgconfig ./configure --prefix=/usr/local/mfoc
make
make install

禁用pn533模块

echo "lacklist pn533 nfc" >> "/etc/modprobe.d/fbdev-blacklist.conf"
reboot 

添加至环境变量

export PATH=$PATH:/usr/local/libnfc/bin:/usr/local/mfoc/bin

测试

# hack the data from the source card
mfoc -P 50 -T 30 -O src.mfd
# hack the data(include key info) from the desdestination
mfoc -P 50 -T 30 -O dst.mfd
# paste to desdestination
nfc-mfclassic w a src.mfd dst.mfd

发表评论

电子邮件地址不会被公开。 必填项已用*标注