nfc_initiator_select_dep_target() function returns nox libnf error code and fix some uses of nfc_initiator_transceive_bytes() function.

This commit is contained in:
Audrey Diacre 2011-12-21 09:15:44 +00:00
parent 0f5cc5683d
commit c41d7de8ca
12 changed files with 58 additions and 57 deletions

View file

@ -1082,7 +1082,7 @@ pn53x_initiator_poll_target (struct nfc_device *pnd,
return NFC_ECHIP;
}
bool
int
pn53x_initiator_select_dep_target(struct nfc_device *pnd,
const nfc_dep_mode ndm, const nfc_baud_rate nbr,
const nfc_dep_info *pndiInitiator,
@ -2243,7 +2243,7 @@ pn53x_InAutoPoll (struct nfc_device *pnd,
* @param szGBi count of General Bytes
* @param[out] pnt \a nfc_target which will be filled by this function
*/
bool
int
pn53x_InJumpForDEP (struct nfc_device *pnd,
const nfc_dep_mode ndm,
const nfc_baud_rate nbr,
@ -2271,7 +2271,7 @@ pn53x_InJumpForDEP (struct nfc_device *pnd,
case NBR_847:
case NBR_UNDEFINED:
pnd->last_error = NFC_EINVARG;
return false;
return pnd->last_error;
break;
}
@ -2291,7 +2291,7 @@ pn53x_InJumpForDEP (struct nfc_device *pnd,
case NBR_847:
case NBR_UNDEFINED:
pnd->last_error = NFC_EINVARG;
return false;
return pnd->last_error;
break;
}
}
@ -2310,13 +2310,14 @@ pn53x_InJumpForDEP (struct nfc_device *pnd,
uint8_t abtRx[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
size_t szRx = sizeof (abtRx);
int res = 0;
// Try to find a target, call the transceive callback function of the current device
if (pn53x_transceive (pnd, abtCmd, offset, abtRx, &szRx, timeout) < 0)
return false;
if ((res = pn53x_transceive (pnd, abtCmd, offset, abtRx, &szRx, timeout)) < 0)
return res;
// Make sure one target has been found, the PN53X returns 0x00 if none was available
if (abtRx[1] != 1)
return false;
return NFC_ECHIP;
// Is a target struct available
if (pnt) {
@ -2336,7 +2337,7 @@ pn53x_InJumpForDEP (struct nfc_device *pnd,
pnt->nti.ndi.szGB = 0;
}
}
return true;
return NFC_SUCCESS;
}
int

View file

@ -294,7 +294,7 @@ int pn53x_initiator_poll_target (struct nfc_device *pnd,
const nfc_modulation *pnmModulations, const size_t szModulations,
const uint8_t uiPollNr, const uint8_t uiPeriod,
nfc_target *pnt);
bool pn53x_initiator_select_dep_target (struct nfc_device *pnd,
int pn53x_initiator_select_dep_target (struct nfc_device *pnd,
const nfc_dep_mode ndm, const nfc_baud_rate nbr,
const nfc_dep_info *pndiInitiator,
nfc_target *pnt,
@ -335,7 +335,7 @@ int pn53x_InAutoPoll (struct nfc_device *pnd, const pn53x_target_type *ppttTa
const uint8_t btPollNr, const uint8_t btPeriod, nfc_target *pntTargets,
size_t *pszTargetFound,
const int timeout);
bool pn53x_InJumpForDEP (struct nfc_device *pnd,
int pn53x_InJumpForDEP (struct nfc_device *pnd,
const nfc_dep_mode ndm, const nfc_baud_rate nbr,
const uint8_t *pbtPassiveInitiatorData,
const uint8_t *pbtNFCID3i,