fix some last_error with result of previous function.
This commit is contained in:
parent
cc8d4f68ab
commit
0e2c60d0fa
5 changed files with 24 additions and 33 deletions
|
|
@ -1244,6 +1244,7 @@ pn53x_initiator_transceive_bytes (struct nfc_device *pnd, const uint8_t *pbtTx,
|
|||
{
|
||||
size_t szExtraTxLen;
|
||||
uint8_t abtCmd[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||
int res = 0;
|
||||
|
||||
// We can not just send bytes without parity if while the PN53X expects we handled them
|
||||
if (!pnd->bPar) {
|
||||
|
|
@ -1264,8 +1265,8 @@ pn53x_initiator_transceive_bytes (struct nfc_device *pnd, const uint8_t *pbtTx,
|
|||
}
|
||||
|
||||
// To transfer command frames bytes we can not have any leading bits, reset this to zero
|
||||
if (pn53x_set_tx_bits (pnd, 0) < 0) {
|
||||
pnd->last_error = NFC_EIO; // FIXME pn53x_set_tx_bits should return an integer
|
||||
if ((res = pn53x_set_tx_bits (pnd, 0)) < 0) {
|
||||
pnd->last_error = res;
|
||||
return pnd->last_error;
|
||||
}
|
||||
|
||||
|
|
@ -1273,16 +1274,10 @@ pn53x_initiator_transceive_bytes (struct nfc_device *pnd, const uint8_t *pbtTx,
|
|||
// We have to give the amount of bytes + (the two command bytes 0xD4, 0x42)
|
||||
uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||
size_t szRx = sizeof(abtRx);
|
||||
int res = 0;
|
||||
|
||||
if ((res = pn53x_transceive (pnd, abtCmd, szTx + szExtraTxLen, abtRx, szRx, timeout)) < 0) {
|
||||
// FIXME pn53x_transceive should return an integer
|
||||
if (CHIP_DATA (pnd)->last_status_byte == EINVRXFRAM) {
|
||||
pnd->last_error = NFC_ERFTRANS;
|
||||
pnd->last_error = res;
|
||||
return pnd->last_error;
|
||||
} else {
|
||||
pnd->last_error = NFC_EIO;
|
||||
return pnd->last_error;
|
||||
}
|
||||
}
|
||||
szRx = (size_t) res;
|
||||
if (pbtRx != NULL) {
|
||||
|
|
|
|||
|
|
@ -299,7 +299,7 @@ int pn53x_initiator_select_dep_target (struct nfc_device *pnd,
|
|||
const int timeout);
|
||||
int pn53x_initiator_transceive_bits (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits,
|
||||
const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar);
|
||||
int pn53x_initiator_transceive_bytes (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx,
|
||||
int pn53x_initiator_transceive_bytes (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTx,
|
||||
uint8_t *pbtRx, size_t *pszRx, int timeout);
|
||||
int pn53x_initiator_transceive_bits_timed (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szTxBits,
|
||||
const uint8_t *pbtTxPar, uint8_t *pbtRx, uint8_t *pbtRxPar, uint32_t *cycles);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue