首页 > 解决方案 > ACR122 NFC 阅读器不适用于 libnfc ubuntu

问题描述

我刚给自己买了一个新的 ACR122U-A9 nfc 阅读器,我需要在 ubuntu 18.10 上使用 libnfc 进行设置。它需要与 libnfc 一起使用,因为 mfoc 接口就是这样(如果有办法在没有 libnf 的情况下使用 mfoc,那太好了!该解决方案也会对我有所帮助!)在安装 libnfc 1.7.1 并进行了几个小时的研究之后,我仍然做了不让它工作。每次我使用sudo nfc-list并且 pcscd 没有运行时,它都会给我以下错误:

nfc-list uses libnfc 1.7.1
error   libnfc.driver.acr122_usb    Unable to set alternate setting on USB interface (Connection timed out)
nfc-list: ERROR: Unable to open NFC device: acr122_usb:004:005

如果 pcscd 正在运行,则错误内容如下:

nfc-list uses libnfc 1.7.1
error   libnfc.driver.acr122_usb    Unable to set alternate setting on USB interface (Connection timed out)
nfc-list: ERROR: Unable to open NFC device: acr122_usb:004:007
nfc-list: ERROR: Unable to open NFC device: acr122_pcsc:ACS ACR122U 00 00

有时这也会出现:

nfc-list uses libnfc 1.7.1
error   libnfc.driver.acr122_usb    Unable to set alternate setting on USB interface (Connection timed out)
nfc-list: ERROR: Unable to open NFC device: acr122_usb:004:007
error   libnfc.driver.acr122_pcsc   No ACR122 firmware received, Error: 80100016
nfc-list: ERROR: Unable to open NFC device: acr122_pcsc:ACS ACR122U 00 00

我从中读到的是:

我已经做了以下事情:

谁能帮助我和/或告诉我我做错了什么?先感谢您!

PS:我不知何故让它与 pcscd 一起工作,但因为我不知道如何让 mfoc 使用它(如果这甚至可能的话)它没有用。

标签: ubuntuacr122lib-nfc

解决方案


现在你可以从源版本 1.8.0 安装。这个版本解决了这个问题。

首先卸载libnfc-bin

下载1.8.0版本的源代码 这就是我所做的:

export CFLAGS="-Wall -g -O2 -Wextra -pipe -funsigned-char -fstrict-aliasing \
      -Wchar-subscripts -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wunused \
      -Wuninitialized -Wpointer-arith -Wredundant-decls -Winline -Wformat \
      -Wformat-security -Wswitch-enum -Winit-self -Wmissing-include-dirs \
      -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition \
      -Wbad-function-cast -Wnested-externs -Wmissing-declarations"

autoreconf -Wall -vis
./configure --prefix=/usr --sysconfdir=/etc
sudo make clean
sudo make
sudo make install

之后我尝试过nfc-list并且它有效

nfc-list uses libnfc 1.8.0
NFC device: ACS / ACR122U PICC Interface opened

推荐阅读