3

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.

1
  • Any updates to this? I also have another ACR122U-based NFC reader that I'm trying to use on Linux, specifically Ubuntu 22. None of the NFC libraries seem to be available anymore. I've tried installing nfctool, libnfc, and even neard via apt and every time I get the "Unable to locate package" error. When I tried to use pcsc, it gets stuck at this message: Waiting for the first reader... (even though my reader is connected).
    – rlittles
    Commented Apr 1, 2023 at 3:03

3 Answers 3

1

Fixing the libnfc driver works for this. Here is the fix.

To make it work - clone the libnfc driver, and then delete this paragraph, as in the commit above.
Recompile and it will work with ACR122U-A9.

Alternatively, to not to edit the code, just clone right away from the GitHUB repository

2
  • Actually I tried that months ago and it worked like a charm! Commented Nov 11, 2019 at 23:56
  • I deleted the paragraph and then compiled and it works. However it doesn't work when I install it. It only works with the package compiled. Commented Feb 5, 2020 at 14:35
1

Apparently there's something special about the ACR122U that causes the Linux NFC driver to conflict with the CCID (Chip/Smart Card Interfaces) driver.

As a workaround, you can unload the NFC kernel module associated with the NFC chip on that device (PN533):

$ sudo rmmod pn533

If you get this error: rmmod: ERROR: Module pn533 is in use by: pn533_usb then do:

sudo modprobe -r pn533_usb

Now, run pcsc_scan and it should identify your device:

Using reader plug'n play mechanism
Scanning present readers...
Waiting for the first reader... found one
Scanning present readers...
0: ACS ACR122U 00 00
 
Fri Mar 31 20:16:51 2023
 Reader 0: ACS ACR122U 00 00
  Event number: 0
  Card state: Card removed, 

Tested this on Ubuntu 22 with my ACR122U NFC reader (USB VID: 0x072f, USB PID: 0x2200) and was able to read NFC tags.

Original source is from here: https://ludovicrousseau.blogspot.com/2013/11/linux-nfc-driver-conflicts-with-ccid.html

-2

i resolve this question !!!!

  1. put packages, the seller sent from aliexpress.com package list (I buy ACR122U-A9 from aliexpress.com ) apt-get install pcsc-tools apt-get install pcscd apt-get install libacsccid1 apt-get install --reinstall libpcsclite1

  2. Unpack the libnfc-1.7.1.tar archive to the root of the disk /

  3. Install the libusb-dev package from the distribution repositories

  4. We edit the file /libnfc-1.7.1/libnfc/drivers/acr122_usb.c, find and comment on this line, there should be line 430:

/* res = usb_set_altinterface(data.pudh, 0); if (res < 0) { log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to set alternate setting on USB interface (%s)", _usb_strerror(res)); usb_close(data.pudh); // we failed to use the specified device goto free_mem; } */

  1. Excecute ./configure --prefix=/usr --sysconfdir=/etc --with-drivers=acr122_pcsc,acr122_usb,acr122s,arygon

  2. Making sure the configuration is correct

Selected drivers: acr122_pcsc...... yes acr122_usb....... yes acr122s.......... yes arygon........... yes pn53x_usb........ no pn532_uart....... no pn532_spi....... no pn532_i2c........ no

  1. If everything is fine, do make

  2. If everything is fine, do make install

  3. We can specify an explicit path for the location of libnfc.so export LD_LIBRARY_PATH=/usr/lib

  4. Editing file:

/etc/modprobe.d/blacklist-libnfc.conf

should be the following, add / change

#blacklist nfc blacklist pn533 blacklist pn533_usb

  1. Excecute

modprobe nfc

  1. pcscd - should be off killall -9 pcscd

  2. if there is something in the output of lsmod | grep pn bang, modprobe pn533_usb -r, should be empty lsmod | grep pn

1
  • 2
    What's that about packages sent from Ali Express? Please EDIT your answer to make it more clear or remove the unnecessary bits. Commented Oct 9, 2020 at 2:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .