[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

NFC Reader/writer ACS ACR122U-A9 on Debian works… partially



Hello, I'm not sure if it's the best mailing list for asking this, But the problem is encountered using Debian Buster with debian packages for Debian repos, so maybe someone else had the same issues and found a workaround or can give any pointers on how to troubleshoot it

I have ACS ACR122U-A9 NFC USB reader/writer ({vendor,product}IDs: 072f:2200), that works on Debian… partially. using libacsccid1 driver from debian repo (not the one on ACS Website, as it doesn't have a proper cryptographic or even a hash to check the download, so I don't trust it. And prefer the one on Debian's main repos. The debian one is by the way maintained by an ACS employee. It's probably the same driver, except the one on the website is a in archive for multiple distros)

I've reed some docs about drivers and kernel modules to make it work: I'm sure I didn't miss anything obvious (installing the correct driver, making sure it's using the correct kernel module)

So with pcsc_scan (basic reader) or cardpeek, it works (exept for EMV analyze, which makes Cardpeek freezes instead before showing up any data). But it doesn't work at all with other tools

- libnfc, from Debian buster repo
- nfcpy, python3 module, installed with pip3, which also nistall all the python3 dependencies (I know my reader isn't ideal for this, due to hardware limitations, but it should still work and is listed as supported on the official nfcy's documentation [1], for reading/writer NFC tags, limitations are mostly for P2P mode)

libnfc and nfcpy are two different implementations with different functionalities and goals, and libncf is not a dependency of nfcpy. Yet they seem to have a very similar, if not the same, bug specific to the ACR122 reader.

In both cases, the nfc reader is identified as being ACR122 and the driver is loaded. But then the reader refuses to respond to the computer
- libnfc returns "Unable to open device" error.
- nfcpy returns a similar error "[Errno 110] Connection timed out".

Both fail to communicate with the ACR122U after the exact same step : Set PICC Operating Parameters

Here's the full debug log for both

- libnfc debug log

$  LIBNFC_LOG_LEVEL=3 nfc-list
debug    libnfc.config    Unable to open directory: /etc/nfc/devices.d
debug    libnfc.general    log_level is set to 3
debug    libnfc.general    allow_autoscan is set to true
debug    libnfc.general    allow_intrusive_scan is set to false
debug    libnfc.general    0 device(s) defined by user
nfc-list uses libnfc 1.7.1
debug libnfc.driver.acr122_usb device found: Bus 001 Device 028 Name ACS ACR122
debug    libnfc.general    1 device(s) found using acr122_usb driver
debug    libnfc.general    0 device(s) found using pn53x_usb driver
debug libnfc.driver.acr122_usb 3 element(s) have been decoded from "acr122_usb:001:028"
debug    libnfc.driver.acr122_usb    TX: 62 00 00 00 00 00 00 01 00 00
debug libnfc.driver.acr122_usb RX: 80 02 00 00 00 00 00 02 81 00 3b 00
debug    libnfc.driver.acr122_usb    ACR122 PICC Operating Parameters
debug libnfc.driver.acr122_usb TX: 6f 05 00 00 00 00 00 00 00 00 ff 00 51 00 00
debug    libnfc.general    Unable to open "acr122_usb:001:028".
nfc-list: ERROR: Unable to open NFC device: acr122_usb:001:028

- nfcpy debug log

$ python3 -m nfc -vvv
This is the 1.0.3 version of nfcpy run in Python 3.7.3
on Linux-4.19.0-16-amd64-x86_64-with-debian-10.9
I'm now searching your system for contactless devices
DEBUG:nfc.clf.transport:using libusb-1.0.22
DEBUG:nfc.clf.transport:path matches '^(usb|)$'
INFO:nfc.clf:searching for reader on path usb:001:028
DEBUG:nfc.clf.transport:using libusb-1.0.22
DEBUG:nfc.clf.transport:path matches '^usb(:[0-9]{1,3})(:[0-9]{1,3})?$'
DEBUG:nfc.clf.device:loading acr122 driver for usb:072f:2200
Level 9:nfc.clf.transport:>>> 6f050000000000000000ff00480000
Level 9:nfc.clf.transport:<<< 800a000000000002fe0041435231323255323138
DEBUG:nfc.clf.acr122:initialize ACR122U218
DEBUG:nfc.clf.acr122:CCID ICC-POWER-ON
Level 9:nfc.clf.transport:>>> 62000000000000000000
Level 9:nfc.clf.transport:<<< 800200000000000281003b00
DEBUG:nfc.clf.acr122:Set PICC Operating Parameters
Level 9:nfc.clf.transport:>>> 6f050000000000000000ff00517f00
DEBUG:nfc.clf.device:[Errno 110] Connection timed out
I'm not trying serial devices because you haven't told me
-- add the option '--search-tty' to have me looking
-- but beware that this may break other serial devs
Sorry, but I couldn't find any contactless device

I don't speak APDU, So I don't understand the half of the debug output… Just plain, human-readable, english. Any newbie friendly documentation/ressources to understand/debug APDU-related stuff is welcome.

And the workarounds I found on the web resolves different issues that mine. and/or require to compile newer libnfc (and 0 solution for ncfpy, which is my priority)

Since I don't have unlimited time to debug things, I won't do just to see "if I'm lucky enough". Unless I collect enough info to understand what's wrong, so I can determine if the latest stable version on libnfc actually supports my hardware revision of the ACR122U. I have found some bug reports with similar problems but most lack info about hardware revisions.

Because yes, to make things more fun, there is several hardware revisions all sold under the same name (ACR122U, that seems behave differently, with some working with libncf and/or nfcpy, other don't, according to the info I found on bug respond, blog posts and other online publications. And according to the ACR122 API doc (PDFs from ACS website) seems versioned as well, not sure if API actually changes with each hardware revision.

Of course, at least with most resellers, you can't know which hardware revision you'll get, meaning I can't buy an older revision to test if it works and/or and compare debug output and/or anything else that makes sense.

And the hardware revision isn't even written on the reader's sticker on the back (maybe it can be deduced form de serial number, but ACS website doesn't mention such thing… The only way the find out which hardware revision is the plug it to a computer (shows up nfcpy debug log). Which makes "the retraction right" under french legislation inapplicable (= giving a product back to a reseller and asking for exchange or reimbursement if the product hasn't been used, is still in it's original, sealed package, and has been bought at most 14 days ago). Meaning I can't replace it with an older revision that might work better.

All (known) revisions of ACR122U-A9 uses an NXP np532 NFC chip (which is not directly accessible by the computer on the ACR122U (thus the NFC P2P mode limitations) as it has an additional controller for USB-CCID interface for PC/SC, which is why I bought the ACR122U-A9 in the first place, to read "smart" cards). In order to make it work, it is necessarily to blacklist np533_usb module, which I did, otherwise, the reader doesn't work at all because the np533 module is loaded by default. And by the default, installing libnfc creates the file /etc/modprobe.d/blacklist-libnfc.conf with two other modules blacklisted by default.

cat /etc/modprobe.d/blacklist-libnfc.conf
blacklist nfc
blacklist pn533
blacklist pn533_usb

Module name pn533 is self-explanatory. But nfc module name isn't… I'm not sure if it's related to my bug. I spent to much time on this issue and I'm still stuck. It's driving nuts. So before spending even more time trying with the nfc module loaded (and possibly making things worse, or at best losing more time, I don't think blacklisting the nfc module is the prolem), I'd like to have some tips on how to find out what to try next.

1. https://nfcpy.readthedocs.io/en/latest/overview.html


Reply to: