ACR122 NFC reader does not work with libnfc ubuntu
Asked Answered
S

1

7

I just got myself a new ACR122U-A9 nfc reader that I need to set up with libnfc on ubuntu 18.10. It needs to work with libnfc because mfoc interfaces wit that (If there is a way to use mfoc without libnf, great! That solution would help me as well!) After installing libnfc 1.7.1 and doing a few hours of research I still did not get it to work. Every time I use sudo nfc-list and pcscd is not running it gives me the following error:

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

If pcscd isrunning, the error reads as follows:

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

And sometimes this shows up as well:

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

What I read from that is:

  • libnfc works
  • There is some driver issue
  • something blocks the reader
  • that something is pcscd (accoarding to the internet)

I already did the following things:

  • Blacklist nfc pn533 pn533_usb in the file /etc/modprobe.d/blacklist-libnfc.conf
  • stop the pcscd deamon
  • remove the drivers stated above manually using sudo modprobe -r <driver>
  • install the device drivers from here: https://www.acs.com.hk/en/products/3/acr122u-usb-nfc-reader/
  • restart my laptop about 100 times
  • pray to the nfc god

Can anyone help me out and/or tell me what I did wrong? Thank you in advance!

PS: I somehow got it to work with pcscd, but since I couldn't figure out how to make mfoc use that (if that's even possible) it's no use.

Spieler answered 2/9, 2019 at 21:27 Comment(2)
Any luck since the post ?Discarnate
Yes. I did actually get it to work using a fix described here superuser.com/questions/1477349/… some time ago. You have to comment out an if statement in the nfclib driver and then recompile the whole thing. After they it will work. I think there is actually even a pull request on the nfclib GitHub page to implement exactly this fix. Not sure though, if it already got approved.Spieler
M
0

Nowadays you can install from sources version 1.8.0. This version have this problem resolved.

First uninstall libnfc-bin

download sources of version 1.8.0 And that is what I have done:

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

After that I have tried nfc-list and it works

nfc-list uses libnfc 1.8.0
NFC device: ACS / ACR122U PICC Interface opened
Magbie answered 10/12, 2021 at 23:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.