Fix incorrect selected targets size in pn53x_InListPassive().
This commit is contained in:
parent
3f17e5e032
commit
7dd1053d03
3 changed files with 7 additions and 5 deletions
|
@ -279,7 +279,7 @@ bool
|
|||
pn53x_InListPassiveTarget(const nfc_device_t* pnd,
|
||||
const nfc_modulation_t nmInitModulation, const byte_t szMaxTargets,
|
||||
const byte_t* pbtInitiatorData, const size_t szInitiatorDataLen,
|
||||
size_t* pszTargets, byte_t* pbtTargetsData, size_t* pszTargetsData)
|
||||
byte_t* pbtTargetsData, size_t* pszTargetsData)
|
||||
{
|
||||
byte_t abtCmd[sizeof(pncmd_initiator_list_passive)];
|
||||
memcpy(abtCmd,pncmd_initiator_list_passive,sizeof(pncmd_initiator_list_passive));
|
||||
|
@ -294,7 +294,7 @@ pn53x_InListPassiveTarget(const nfc_device_t* pnd,
|
|||
size_t szRxLen = MAX_FRAME_LEN;
|
||||
// We can not use pn53x_transceive() because abtRx[0] gives no status info
|
||||
if(pnd->pdc->transceive(pnd->nds,abtCmd,4+szInitiatorDataLen,pbtTargetsData,&szRxLen)) {
|
||||
*pszTargetsData = szRxLen;
|
||||
*pszTargetsData = pbtTargetsData[0];
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
@ -77,6 +77,8 @@ bool pn53x_set_tx_bits(const nfc_device_t* pnd, uint8_t ui8Bits);
|
|||
bool pn53x_wrap_frame(const byte_t* pbtTx, const size_t szTxBits, const byte_t* pbtTxPar, byte_t* pbtFrame, size_t* pszFrameBits);
|
||||
bool pn53x_unwrap_frame(const byte_t* pbtFrame, const size_t szFrameBits, byte_t* pbtRx, size_t* pszRxBits, byte_t* pbtRxPar);
|
||||
bool pn53x_decode_target_data(const byte_t* pbtRawData, size_t szDataLen, nfc_chip_t nc, nfc_target_type_t ntt, nfc_target_info_t* pnti);
|
||||
bool pn53x_InListPassiveTarget(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t szMaxTargets, const byte_t* pbtInitiatorData, const size_t szInitiatorDataLen, size_t* pszTargets, byte_t* pbtTargetsData, size_t* pszTargetsData);
|
||||
|
||||
bool pn53x_InListPassiveTarget(const nfc_device_t* pnd, const nfc_modulation_t nmInitModulation, const byte_t szMaxTargets, const byte_t* pbtInitiatorData, const size_t szInitiatorDataLen, byte_t* pbtTargetsData, size_t* pszTargetsData);
|
||||
|
||||
#endif // __NFC_CHIPS_PN53X_H__
|
||||
|
||||
|
|
|
@ -461,10 +461,10 @@ bool nfc_initiator_select_passive_target(const nfc_device_t* pnd,
|
|||
break;
|
||||
}
|
||||
|
||||
size_t szTargetFound, szTargetsData;
|
||||
size_t szTargetsData;
|
||||
byte_t abtTargetsData[MAX_FRAME_LEN];
|
||||
|
||||
if(!pn53x_InListPassiveTarget(pnd, nmInitModulation, 1, pbtInitData, szInitDataLen, &szTargetFound, abtTargetsData, &szTargetsData)) return false;
|
||||
if(!pn53x_InListPassiveTarget(pnd, nmInitModulation, 1, pbtInitData, szInitDataLen, abtTargetsData, &szTargetsData)) return false;
|
||||
|
||||
// Make sure one tag has been found, the PN53X returns 0x00 if none was available
|
||||
if (abtTargetsData[0] == 0) return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue