nfc-tools/libnfc

When I run nfc-relay-picc, it prompts CRC Error and sometimes emulation failure. How can I solve this problem?

yellowzq opened this issue · 1 comments

$ LIBNFC_LOG_LEVEL=3 ./nfc-relay-picc.out
./nfc-relay-picc.out uses libnfc 1.8.0
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 002 Device 015 Name ACS ACR122
debug libnfc.driver.acr122_usb device found: Bus 002 Device 012 Name ACS ACR122
debug libnfc.general 2 device(s) found using acr122_usb driver
debug libnfc.driver.acr122_usb 3 element(s) have been decoded from "acr122_usb:002:015"
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 02 00 00 00 00 00 00 81 00 90 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 00 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 00 81 00 d5 13 90 00
debug libnfc.general "ACS / ACR122U PICC Interface" (acr122_usb:002:015) has been claimed.
NFC reader device: ACS / ACR122U PICC Interface opened
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 00 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 00 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 00 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 00 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
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 00 81 00 d5 07 80 80 40 00 10 00 90 00
debug libnfc.chip.pn53x InListPassiveTarget
debug libnfc.chip.pn53x Timeout value: 300
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 00 81 00 d5 4b 01 01 00 04 08 04 e3 18 40 00 90 00
Found tag:
ISO/IEC 14443A (106 kbps) target:
ATQA (SENS_RES): 00 04
UID (NFCID1): e3 18 40 00
SAK (SEL_RES): 08
Hint: tag <---> initiator (relay) <---> target (relay) <---> original reader

We will emulate:
ISO/IEC 14443A (106 kbps) target:
ATQA (SENS_RES): 00 04
UID (NFCID3): 08 18 40 00
SAK (SEL_RES): 08
ATS: 75 33 92 03
debug libnfc.driver.acr122_usb 3 element(s) have been decoded from "acr122_usb:002:012"
debug libnfc.driver.acr122_usb TX: 62 00 00 00 00 00 00 01 00 00
debug libnfc.driver.acr122_usb RX: 80 14 00 00 00 00 00 00 81 00 3b 8f 80 01 80 4f 0c a0 00 00 03 06 03 00 01 00 00 00 00 6a
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 90 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 00 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 00 81 00 d5 13 90 00
debug libnfc.general "ACS / ACR122U PICC Interface" (acr122_usb:002:012) has been claimed.
NFC emulator device: ACS / ACR122U PICC Interface opened
debug libnfc.general set_property_bool NP_ACCEPT_INVALID_FRAMES False
debug libnfc.general set_property_bool NP_ACCEPT_MULTIPLE_FRAMES False
debug libnfc.general set_property_bool NP_HANDLE_CRC True
debug libnfc.general set_property_bool NP_HANDLE_PARITY True
debug libnfc.general set_property_bool NP_AUTO_ISO14443_4 True
debug libnfc.general set_property_bool NP_EASY_FRAMING True
debug libnfc.general set_property_bool NP_ACTIVATE_CRYPTO1 False
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 00 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 00 81 00 d5 33 90 00
debug libnfc.chip.pn53x ReadRegister
debug libnfc.driver.acr122_usb TX: 6f 0b 00 00 00 00 00 00 00 00 ff 00 00 00 06 d4 06 63 38 63 3d
debug libnfc.driver.acr122_usb RX: 80 06 00 00 00 00 00 00 81 00 d5 07 00 00 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 10
debug libnfc.driver.acr122_usb RX: 80 04 00 00 00 00 00 00 81 00 d5 13 90 00
debug libnfc.chip.pn53x ReadRegister
debug libnfc.driver.acr122_usb TX: 6f 09 00 00 00 00 00 00 00 00 ff 00 00 00 04 d4 06 63 05
debug libnfc.driver.acr122_usb RX: 80 05 00 00 00 00 00 00 81 00 d5 07 00 90 00
debug libnfc.chip.pn53x PN53X_REG_CIU_TxAuto (Controls the settings of the antenna driver)
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 05 04
debug libnfc.driver.acr122_usb RX: 80 04 00 00 00 00 00 00 81 00 d5 09 90 00
debug libnfc.chip.pn53x TgInitAsTarget
debug libnfc.chip.pn53x No timeout
debug libnfc.driver.acr122_usb TX: 6f 2c 00 00 00 00 00 00 00 00 ff 00 00 00 27 d4 8c 01 04 00 18 40 00 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
debug libnfc.driver.acr122_usb RX: 80 07 00 00 00 00 00 00 81 00 d5 8d 00 60 00 90 00
Done, relaying frames now!
debug libnfc.chip.pn53x TgGetInitiatorCommand
debug libnfc.chip.pn53x No timeout
debug libnfc.driver.acr122_usb TX: 6f 07 00 00 00 00 00 00 00 00 ff 00 00 00 02 d4 88
debug libnfc.driver.acr122_usb RX: 80 05 00 00 00 00 00 00 81 00 d5 89 02 90 00
debug libnfc.chip.pn53x Chip error: "CRC Error" (02), returned error: "RF Transmission Error" (-20))
nfc_target_receive_bytes: RF Transmission 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 00 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 05 00 00 00 00 00 00 81 00 d5 53 00 90 00
debug libnfc.general set_property_bool NP_ACTIVATE_FIELD False
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 00 81 00 d5 33 90 00
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 00 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 05 00 00 00 00 00 00 81 00 d5 53 00 90 00

Dig the trouble, understand how it work and why it fails will help you to fix the code.

Have a look to the example manpage, AFAICR there are some notes and stability.