nfc-tools / libnfc

Platform independent Near Field Communication (NFC) library
http://nfc-tools.org
GNU Lesser General Public License v3.0
1.72k stars 443 forks source link

error libnfc.driver.acr122_usb Wrong reply #646

Open amrbt opened 3 years ago

amrbt commented 3 years ago

Hello!

I'm stucked at this point with the libnfc 1.8.0 and do not find information about this error:

nfc-list -v 130 ⨯ nfc-list uses libnfc 1.8.0 NFC device: ACS / ACR122U PICC Interface opened 1 ISO14443A passive target(s) found: ISO/IEC 14443A (106 kbps) target: ATQA (SENS_RES): 00 04

  • UID size: single
  • bit frame anticollision supported UID (NFCID1): 67 32 64 c3
    SAK (SEL_RES): 08
  • Not compliant with ISO/IEC 14443-4
  • Not compliant with ISO/IEC 18092

Fingerprinting based on MIFARE type Identification Procedure:

  • MIFARE Classic 1K
  • MIFARE Plus (4 Byte UID or 4 Byte RID) 2K, Security level 1
  • SmartMX with MIFARE 1K emulation Other possible matches based on ATQA & SAK values:

error libnfc.driver.acr122_usb Wrong reply 0 Felica (212 kbps) passive target(s) found.

error libnfc.driver.acr122_usb Wrong reply 0 Felica (424 kbps) passive target(s) found.

error libnfc.driver.acr122_usb Wrong reply 0 ISO14443B passive target(s) found.

0 ISO14443B' passive target(s) found.

0 ISO14443B-2 ST SRx passive target(s) found.

0 ISO14443B-2 ASK CTx passive target(s) found.

0 ISO14443B iClass passive target(s) found.

error libnfc.driver.acr122_usb Wrong reply 0 ISO14443A-3 Jewel passive target(s) found.

0 ISO14443A-2 NFC Barcode passive target(s) found.

error libnfc.driver.acr122_usb Wrong reply

cat /etc/os-release PRETTY_NAME="Kali GNU/Linux Rolling" NAME="Kali GNU/Linux" ID=kali VERSION="2021.2" VERSION_ID="2021.2" VERSION_CODENAME="kali-rolling" ID_LIKE=debian ANSI_COLOR="1;31" HOME_URL="https://www.kali.org/" SUPPORT_URL="https://forums.kali.org/" BUG_REPORT_URL="https://bugs.kali.org/"

uname -r 5.10.0-kali7-amd64

lsusb -v
Bus 002 Device 005: ID 072f:2200 Advanced Card Systems, Ltd ACR122U Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x072f Advanced Card Systems, Ltd idProduct 0x2200 ACR122U bcdDevice 2.14 iManufacturer 1 ACS iProduct 2 ACR122U PICC Interface iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x005d bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 200mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 11 Chip/SmartCard bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 0 ChipCard Interface Descriptor: bLength 54 bDescriptorType 33 bcdCCID 1.00 nMaxSlotIndex 0 bVoltageSupport 7 5.0V 3.0V 1.8V dwProtocols 2 T=1 dwDefaultClock 4000 dwMaxiumumClock 4000 bNumClockSupported 0 dwDataRate 10752 bps dwMaxDataRate 250000 bps bNumDataRatesSupp. 0 dwMaxIFSD 256 dwSyncProtocols 00000000 dwMechanical 00000000 dwFeatures 00020040 Auto parameter negotiation made by CCID Short APDU level exchange dwMaxCCIDMsgLen 271 bClassGetResponse 00 bClassEnvelope 00 wlcdLayout none bPINSupport 0 bMaxCCIDBusySlots 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0008 1x 8 bytes bInterval 50 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 can't get debug descriptor: Resource temporarily unavailable Device Status: 0x0000 (Bus Powered)

davidebeatrici commented 1 year ago

Possibly related to #666.

lsusb ``` Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 64 idVendor 0x072f Advanced Card Systems, Ltd idProduct 0x2200 ACR122U bcdDevice 2.14 iManufacturer 1 ACS iProduct 2 ACR122U PICC Interface iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 0x005d bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 200mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber 0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass 11 Chip/SmartCard bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 0 ChipCard Interface Descriptor: bLength 54 bDescriptorType 33 bcdCCID 1.00 nMaxSlotIndex 0 bVoltageSupport 7 5.0V 3.0V 1.8V dwProtocols 2 T=1 dwDefaultClock 4000 dwMaxiumumClock 4000 bNumClockSupported 0 dwDataRate 10752 bps dwMaxDataRate 250000 bps bNumDataRatesSupp. 0 dwMaxIFSD 256 dwSyncProtocols 00000000 dwMechanical 00000000 dwFeatures 00020040 Auto parameter negotiation made by CCID Short APDU level exchange dwMaxCCIDMsgLen 271 bClassGetResponse 00 bClassEnvelope 00 wlcdLayout none bPINSupport 0 bMaxCCIDBusySlots 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes 3 Transfer Type Interrupt Synch Type None Usage Type Data wMaxPacketSize 0x0008 1x 8 bytes bInterval 50 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x04 EP 4 OUT bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x83 EP 3 IN bmAttributes 2 Transfer Type Bulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 ```

With #678 applied on top of 42de50f2b7bd4c43e3b92f5c9d6a996fd5300e4f:

LIBNFC_LOG_LEVEL=3 ``` error libnfc.driver.acr122_usb PN532 init failed, trying again... error libnfc.driver.acr122_usb Unexpected Status Word (SW1: 3b SW2: 00) error libnfc.driver.acr122_usb PN532 init failed, trying again... NFC device: ACS / ACR122U PICC Interface opened error libnfc.driver.acr122_usb Command Code verification failed error libnfc.driver.acr122_usb Wrong reply error libnfc.driver.acr122_usb Wrong reply error libnfc.driver.acr122_usb Wrong reply error libnfc.driver.acr122_usb Command Code verification failed error libnfc.chip.pn53x Buffer size is too short: 1 available(s), 2 needed error libnfc.driver.acr122_usb Command Code verification failed error libnfc.driver.acr122_usb Command Code verification failed error libnfc.driver.acr122_usb Wrong reply error libnfc.driver.acr122_usb Wrong reply ``` ``` info libnfc.config Unable to open file: /etc/nfc/libnfc.conf 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 debug libnfc.driver.acr122_usb device found: Bus 003 Device 007 Name ACS ACR122 debug libnfc.general 1 device(s) found using acr122_usb driver debug libnfc.driver.acr122_usb 3 element(s) have been decoded from "acr122_usb:003:007" debug libnfc.driver.acr122_usb TX: 62 00 00 00 00 00 00 01 00 00 debug libnfc.driver.acr122_usb RX: 80 08 00 00 00 00 00 02 81 00 d5 03 32 01 06 07 90 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.driver.acr122_usb RX: 80 02 00 00 00 00 00 00 81 00 3b 00 debug libnfc.chip.pn53x GetFirmwareVersion debug libnfc.driver.acr122_usb TX: 6f 07 00 00 00 00 00 00 00 00 ff 00 00 00 02 d4 02 debug libnfc.driver.acr122_usb RX: 80 08 00 00 00 00 00 02 81 00 d5 03 32 01 06 07 90 00 debug libnfc.chip.pn53x SetParameters debug libnfc.driver.acr122_usb TX: 6f 08 00 00 00 00 00 00 00 00 ff 00 00 00 03 d4 12 14 debug libnfc.driver.acr122_usb RX: 80 04 00 00 00 00 00 02 81 00 d5 13 90 00 debug libnfc.general "ACS / ACR122U PICC Interface" (acr122_usb:003:007) has been claimed. debug libnfc.general set_property_bool NP_ACTIVATE_FIELD False debug libnfc.chip.pn53x ReadRegister debug libnfc.driver.acr122_usb TX: 6f 11 00 00 00 00 00 00 00 00 ff 00 00 00 0c d4 06 63 02 63 03 63 0d 63 38 63 3d debug libnfc.driver.acr122_usb RX: 80 09 00 00 00 00 00 02 81 00 d5 07 80 80 00 00 00 90 00 debug libnfc.chip.pn53x RFConfiguration debug libnfc.driver.acr122_usb TX: 6f 09 00 00 00 00 00 00 00 00 ff 00 00 00 04 d4 32 01 00 debug libnfc.driver.acr122_usb RX: 80 04 00 00 00 00 00 02 81 00 d5 33 90 00 debug libnfc.general set_property_bool NP_ACTIVATE_FIELD True debug libnfc.chip.pn53x RFConfiguration debug libnfc.driver.acr122_usb TX: 6f 09 00 00 00 00 00 00 00 00 ff 00 00 00 04 d4 32 01 01 debug libnfc.driver.acr122_usb RX: 80 04 00 00 00 00 00 02 81 00 d5 33 90 00 debug libnfc.general set_property_bool NP_INFINITE_SELECT True debug libnfc.chip.pn53x RFConfiguration debug libnfc.driver.acr122_usb TX: 6f 0b 00 00 00 00 00 00 00 00 ff 00 00 00 06 d4 32 05 ff ff ff debug libnfc.driver.acr122_usb RX: 80 04 00 00 00 00 00 02 81 00 d5 33 90 00 debug libnfc.general set_property_bool NP_AUTO_ISO14443_4 True debug libnfc.general set_property_bool NP_FORCE_ISO14443_A True debug libnfc.general set_property_bool NP_FORCE_SPEED_106 True debug libnfc.general set_property_bool NP_ACCEPT_INVALID_FRAMES False debug libnfc.general set_property_bool NP_ACCEPT_MULTIPLE_FRAMES False NFC reader: ACS / ACR122U PICC Interface opened NFC device will poll during 36000 ms (20 pollings of 300 ms for 6 modulations) debug libnfc.chip.pn53x ReadRegister debug libnfc.driver.acr122_usb TX: 6f 13 00 00 00 00 00 00 00 00 ff 00 00 00 0e d4 06 63 02 63 03 63 05 63 38 63 3c 63 3d debug libnfc.driver.acr122_usb RX: 80 0a 00 00 00 00 00 02 81 00 d5 07 80 80 43 00 00 00 90 00 debug libnfc.chip.pn53x PN53X_REG_CIU_Control (Contains miscellaneous control bits) debug libnfc.chip.pn53x WriteRegister debug libnfc.driver.acr122_usb TX: 6f 0a 00 00 00 00 00 00 00 00 ff 00 00 00 05 d4 08 63 3c 10 debug libnfc.driver.acr122_usb RX: 80 04 00 00 00 00 00 02 81 00 d5 09 90 00 debug libnfc.chip.pn53x InAutoPoll debug libnfc.chip.pn53x No timeout debug libnfc.driver.acr122_usb TX: 6f 10 00 00 00 00 00 00 00 00 ff 00 00 00 0b d4 60 14 02 20 10 03 11 12 04 03 debug libnfc.driver.acr122_usb RX: 80 00 00 00 00 00 00 02 81 00 error libnfc.driver.acr122_usb Wrong reply nfc_initiator_poll_target: Input / Output Error debug libnfc.driver.acr122_usb ACR122 Abort debug libnfc.driver.acr122_usb TX: 6f 07 00 00 00 00 00 00 00 00 ff 00 00 00 02 d4 02 debug libnfc.driver.acr122_usb RX: 80 08 00 00 00 00 00 02 81 00 d5 03 32 01 06 07 90 00 debug libnfc.chip.pn53x InRelease debug libnfc.driver.acr122_usb TX: 6f 08 00 00 00 00 00 00 00 00 ff 00 00 00 03 d4 52 00 debug libnfc.driver.acr122_usb RX: 80 00 00 00 00 00 00 02 81 00 error libnfc.driver.acr122_usb Wrong reply ```
Device ![ACR122U](https://user-images.githubusercontent.com/5897523/232174571-9b66c3a0-d1ef-4dbb-adea-2271a6695d2e.png)
davidebeatrici commented 1 year ago

Please note that the device appears to be working just fine with pcscd and https://github.com/Flowtter/py-acr122u:

However, shutting down the daemon doesn't seem to be "resetting" the device as it just goes into timeout upon relaunching, with the green LED stuck.

davidebeatrici commented 1 year ago

I acquired another seemingly identical device, this time with a mini CD included. Here's the SDK that is provided: ACR122U_SDK.zip

The problem is that this other device works just fine with #678 applied. I wonder whether we're dealing with a defective and/or fake chip batch...

Alternatively, it could have different factory settings. On the device that is working the LED never turns on, on the other one it's red and turns to green when it detects an NFC tag.

dkdk22 commented 11 months ago

Is the mentioned error resolved? I'm experiencing the same issue.

Gapoly commented 9 months ago

Same problem here. I've tried using my ACR122U on 4 diffirents OS, 2 different machines:

All with the same problem, "error libnfc.driver.acr122_usb Wrong reply" Hopefully the problem comes from the device and getting another one will fix my issue.

Gapoly commented 9 months ago

Update: I've bought a new one and I don't have the error anymore. Either the other guy sold me a fake or it was damaged.

davidebeatrici commented 9 months ago

Could you send here a picture of the device's back, please?

Gapoly commented 8 months ago

Could you send here a picture of the device's back, please?

Same back as the old one I had IMG_20240303_153957

davidebeatrici commented 8 months ago

Interesting... in that case there may be no easy way to determine whether a specific reader is going to work.

italodeveloper commented 1 week ago

Could you send here a picture of the device's back, please?

Same back as the old one I had IMG_20240303_153957

Is this the device working or defective? I bought a defective one the serial number starts with RR171-XX

davidebeatrici commented 1 week ago

My non-working device's serial number begins with RR171- too (https://github.com/nfc-tools/libnfc/issues/646#issuecomment-1509407184).

Now that I'm rereading the comments I realized @Gapoly's one is unclear. Back when I replied I assumed he meant the fake/defective had the same SN prefix.

italodeveloper commented 1 week ago

O número de série do meu dispositivo que não funciona começa com RR171-( #646 (comentário) ).

Agora que estou relendo os comentários percebi@Gapoly's one não está claro. Quando respondi, presumi que ele queria dizer que o falso/defeituoso tinha o mesmo prefixo SN.

That's right, my reader with the problem is also the RR171-XX. This reader that he posted in the photo is not clear if it has the problem or if it was the one that worked, I got it with the same initial serial number to buy RR545-XX but it didn't I wanted to waste time, if I answer if this RR545 model works I would be grateful

davidebeatrici commented 1 week ago

Please note that I have a working device also beginning with RR171-.

Gapoly commented 6 days ago

I just recently went back to NFC and I found the problem. Yes, I had a bad ACR then bought another one which works. The main problem is that I bought some Mifare Classic 1K Gen1 (bad product from aliexpress), you can't change UID on Gen1.

I bought some Gen2 that works on Mifare Classic Tool only and it works, I can change the UID. I'm looking for some Mifare Classic 1K Gen2 that works with nfc-mfclassic. Not a lot of choice in Europe.