chips/pn53x.c: allow null reception buffers for transceive commands

This commit is contained in:
Philippe Teuwen 2011-05-05 23:13:49 +00:00
parent c0a38e6eb0
commit 77e522aade

View file

@ -752,6 +752,7 @@ pn53x_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const
// Recover the real frame length in bits
szFrameBits = ((szRx - 1 - ((ui8Bits == 0) ? 0 : 1)) * 8) + ui8Bits;
if (pbtRx != NULL) {
// Ignore the status byte from the PN53X here, it was checked earlier in pn53x_transceive()
// Check if we should recover the parity bits ourself
if (!pnd->bPar) {
@ -763,7 +764,7 @@ pn53x_initiator_transceive_bits (nfc_device_t * pnd, const byte_t * pbtTx, const
// Copy the received bytes
memcpy (pbtRx, abtRx + 1, szRx - 1);
}
}
// Everything went successful
return true;
}
@ -804,12 +805,13 @@ pn53x_initiator_transceive_bytes (nfc_device_t * pnd, const byte_t * pbtTx, cons
if (!pn53x_transceive (pnd, abtCmd, szTx + szExtraTxLen, abtRx, &szRx))
return false;
if (pbtRx != NULL) {
// Save the received byte count
*pszRx = szRx - 1;
// Copy the received bytes
memcpy (pbtRx, abtRx + 1, *pszRx);
}
// Everything went successful
return true;
}