libnfc with ACR122U gives no response on SELECT (b

2019-04-24 22:56发布

问题:

See NFC reader "SELECT (by AID)" APDU is not routed to Android device on debugging and eventual results. TL;DR the reader might simply be defunct.


I have ACR122U nfc reader. I try to run this example http://www.nfc-tools.org/index.php?title=Libnfc:APDU_example#apdu_example.c on my Ubuntu machine.

This is the log output I get when I tap my Android device (should be in HCE mode) to the reader:

./apdu_example
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
./apdu_example uses libnfc libnfc-1.7.1
debug   libnfc.driver.acr122_usb    device found: Bus 001 Device 088 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:001:088"
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 00 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.driver.acr122_usb    RX: 80 01 00 00 00 00 00 02 fe 00 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 fe 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 fe 00 d5 13 90 00
debug   libnfc.general  "ACS / ACR122U PICC Interface" (acr122_usb:001:088) has been claimed.
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 fe 00 d5 07 00 00 00 00 00 90 00
debug   libnfc.chip.pn53x   PN53X_REG_CIU_TxMode (Defines the transmission data rate and framing during transmission)
debug   libnfc.chip.pn53x   PN53X_REG_CIU_RxMode (Defines the transmission data rate and framing during receiving)
debug   libnfc.chip.pn53x   WriteRegister
debug   libnfc.driver.acr122_usb    TX: 6f 0d 00 00 00 00 00 00 00 00 ff 00 00 00 08 d4 08 63 02 80 63 03 80
debug   libnfc.driver.acr122_usb    RX: 80 04 00 00 00 00 00 02 fe 00 d5 09 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 fe 00 d5 33 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 01
debug   libnfc.driver.acr122_usb    RX: 80 04 00 00 00 00 00 02 fe 00 d5 33 90 00
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 fe 00 d5 33 90 00
NFC reader: ACS / ACR122U PICC Interface opened
Polling for target...
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 fe 00 d5 07     80 80 43 00 10 00 90 00
debug   libnfc.chip.pn53x   InListPassiveTarget
debug   libnfc.chip.pn53x   No timeout
debug   libnfc.driver.acr122_usb    TX: 6f 09 00 00 00 00 00 00 00 00 ff 00     00 00 04 d4 4a 01 00
debug   libnfc.driver.acr122_usb    RX: 80 0e 00 00 00 00 00 02 fe 00 d5 4b     01 01 08 03 20 04 01 02 03 04 90 00
Target detected!
=> a4 04 00 07 f0 01 02 03 04 05 06 00
debug   libnfc.chip.pn53x   InDataExchange
debug   libnfc.chip.pn53x   Timeout value: 5000
debug   libnfc.driver.acr122_usb    TX: 6f 14 00 00 00 00 00 00 00 00 ff 00     00 00 0f d4 40 01 a4 04 00 07 f0 01 02 03 04 05 06 00
res from transceive: -6
debug   libnfc.chip.pn53x   InDataExchange
debug   libnfc.chip.pn53x   Timeout value: 5000
debug   libnfc.driver.acr122_usb    TX: 6f 14 00 00 00 00 00 00 00 00 ff 00     00 00 0f d4 40 01 a4 04 00 07 f0 01 02 03 04 05 06 00

Basically I can see that my Android device is seen by the reader as I can see the UID (01 02 03 04) (or another UID if I tap another device). After that transmitting select AID apdu just timeouts and I can see no relevant response in my Android logs.

On the Android device I have an application installed with the AID I am trying to select - f0 01 02 03 04 05 06.

Can this be a problem with this particular reader? There are other ADPUs which also seem to stop the reader from responding, e.g. FF 00 00 00 02 D4 04 just gives me no response. Can I diagnose the hardware somehow?