send/receive callbacks from internal chip io return now libnfc error code on failure.

This commit is contained in:
Audrey Diacre 2012-01-05 13:24:41 +00:00
parent 81d76c8c70
commit c30e9eed36
11 changed files with 80 additions and 79 deletions

View file

@ -135,7 +135,7 @@ pn53x_transceive (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szT
// Call the send/receice callback functions of the current driver
if ((res = CHIP_DATA (pnd)->io->send (pnd, pbtTx, szTx, timeout)) < 0) {
return pnd->last_error;
return res;
}
// Command is sent, we store the command
@ -147,7 +147,7 @@ pn53x_transceive (struct nfc_device *pnd, const uint8_t *pbtTx, const size_t szT
}
if ((res = CHIP_DATA(pnd)->io->receive (pnd, pbtRx, *pszRx, timeout)) < 0) {
return pnd->last_error;
return res;
}
if ((CHIP_DATA(pnd)->type == PN532) && (TgInitAsTarget == pbtTx[0])) { // PN532 automatically wakeup on external RF field

View file

@ -127,7 +127,7 @@ typedef enum {
} pn53x_operating_mode;
struct pn53x_io {
bool (*send)(struct nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout);
int (*send)(struct nfc_device *pnd, const uint8_t *pbtData, const size_t szData, int timeout);
int (*receive)(struct nfc_device *pnd, uint8_t *pbtData, const size_t szDataLen, int timeout);
};