timmerk / nfc-tools

Automatically exported from code.google.com/p/nfc-tools
0 stars 0 forks source link

nfc_initiator_init: Input/output error #118

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/nfc-tools/issues/detail?id=70  was not fix,

I'm running LIBNFC-1.7.1 and MFOC-0.10.7 with ACR122u
and used TDM-GCC-64 (mingw32-4.8.1) in winxp
mfoc.exe often end up with "nfc_initiator_init: Input/output error"

but mfocgui_v29.exe (not LIBNFC-1.7.1) works

I add some debug line and found that nfc_initiator_init() -> 
nfc_device_set_property_bool(pnd, NP_ACTIVATE_FIELD, false) return the err.

debug   libnfc.chip.pn53x       PN53X_REG_CIU_BitFraming (Adjustments for bit or
iented frames)
debug   libnfc.chip.pn53x       WriteRegister
debug   libnfc.driver.acr122_pcsc       TX: ff 00 00 00 05 d4 08 63 3d 04
debug   libnfc.driver.acr122_pcsc       RX: d5 09 90 00
debug   libnfc.chip.pn53x       InCommunicateThru
debug   libnfc.driver.acr122_pcsc       TX: ff 00 00 00 07 d4 42 01 6f e0 db 04

debug   libnfc.driver.acr122_pcsc       RX: d5 43 00 8d e9 bf 22 04 90 00
debug   libnfc.chip.pn53x       PN53X_REG_CIU_Control (Contains miscellaneous co
ntrol bits)
debug   libnfc.chip.pn53x       ReadRegister
debug   libnfc.driver.acr122_pcsc       TX: ff 00 00 00 04 d4 06 63 3c
debug   libnfc.driver.acr122_pcsc       RX: d5 07 14 90 00
debug   nfc_initiator_init      NP_ACTIVATE_FIELD_false
debug   libnfc.chip.pn53x       ReadRegister
debug   libnfc.driver.acr122_pcsc       TX: ff 00 00 00 08 d4 06 63 02 63 03 63
0d
nfc_initiator_init: Input / Output Error

finally, add some line in pn53x_RFConfiguration__RF_field() 

int
pn53x_RFConfiguration__RF_field(struct nfc_device *pnd, bool bEnable)
{
  uint8_t  abtCmd[] = { RFConfiguration, RFCI_FIELD, (bEnable) ? 0x01 : 0x00 };
+  if(!bEnable) {
+    CHIP_DATA(pnd)->timeout_command = 1000;
+    pn53x_reset_settings(pnd);
+  }
+  Sleep(100);
  return pn53x_transceive(pnd, abtCmd, sizeof(abtCmd), NULL, 0, -1);
}

it works in most of the time...... what is the next todo??

Original issue reported on code.google.com by gwnpe...@gmail.com on 27 Aug 2014 at 10:46