From 655fdb569a79023f3cc45cadf0b5fd422458f424 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Fri, 13 Aug 2010 19:53:13 +0000 Subject: [PATCH] Fix nfc_initiator_mifare_cmd() in examples. In r509, a direct call to pn53x_transceive() was changed into a call to nfc_initiator_transceive_dep_bytes() which is part of the public API. The command to send was updated accordingly, but the code that extracts the response have not. Update issue 98 This should fix the problem: because the response was not the expected length, the actual card data was not copied to the buffer, so it was always the same 16 uninitialized bytes that where returned for any block. PR: Issue 98 Submitted by: zamby.ing Pointy hat to: me --- examples/mifare.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mifare.c b/examples/mifare.c index 0645429..cd8d811 100644 --- a/examples/mifare.c +++ b/examples/mifare.c @@ -69,7 +69,7 @@ bool nfc_initiator_mifare_cmd(const nfc_device_t* pnd, const mifare_cmd mc, cons if (!nfc_initiator_transceive_dep_bytes(pnd,abtCmd,2+szParamLen,abtRx,&szRxLen)) return false; // When we have executed a read command, copy the received bytes into the param - if (mc == MC_READ && szRxLen == 17) memcpy(pmp->mpd.abtData,abtRx+1,16); + if (mc == MC_READ && szRxLen == 16) memcpy(pmp->mpd.abtData,abtRx,16); // Command succesfully executed return true;