Topic: nfc_target_receive_bytes fails with stdout/stderr in console

I am trying to use the Android transceive method for the IsoDep class to send APDU messages to my PN532 device running with Libnfc.

Something weird I noticed is that, when I have stdout and stderr of my program (running libnfc with PN532) piped to a file or /dev/null (away from console). It consistently works, meaning the program can receive the APDU message the Android sent and can respond. However, when stdout and stderr go to the console, it consistently fail to receive the APDU message. I tried increasing/decreasing the timeout on the nfc_target_receive_bytes call, adding retries on the Android transceiver method, and none of these helped.


I hope you can help me.
Thank you in advance,

- Edmund Lo

Re: nfc_target_receive_bytes fails with stdout/stderr in console

Hi,

IMHO, this is a timing problem : when you print on stderr and/or stdout it adds delays between frames.

If you want messages in these circumstances, I think you have to find a workaround like modifying the logging system to put messages in a FIFO that you flush when communication will be cleanly done or something to prevent from adding extra ms between frames.

Romuald Conty