examples: fix broken internal pn53x API.

This commit is contained in:
Romuald Conty 2011-03-01 11:26:00 +00:00
parent 4384d27f3e
commit 979fc1b5f5
3 changed files with 5 additions and 5 deletions

View file

@ -88,19 +88,19 @@ main (int argc, const char *argv[])
printf ("NFC device [%s] connected.\n", pnd->acName); printf ("NFC device [%s] connected.\n", pnd->acName);
result = pn53x_transceive (pnd, pncmd_diagnose_communication_line_test, sizeof (pncmd_diagnose_communication_line_test), abtRx, &szRx, false); result = pn53x_transceive (pnd, pncmd_diagnose_communication_line_test, sizeof (pncmd_diagnose_communication_line_test), abtRx, &szRx);
if (result) { if (result) {
result = (memcmp (pncmd_diagnose_communication_line_test + 2, abtRx, sizeof (pncmd_diagnose_communication_line_test) - 2) == 0); result = (memcmp (pncmd_diagnose_communication_line_test + 2, abtRx, sizeof (pncmd_diagnose_communication_line_test) - 2) == 0);
} }
printf (" Communication line test: %s\n", result ? "OK" : "Failed"); printf (" Communication line test: %s\n", result ? "OK" : "Failed");
result = pn53x_transceive (pnd, pncmd_diagnose_rom_test, sizeof (pncmd_diagnose_rom_test), abtRx, &szRx, false); result = pn53x_transceive (pnd, pncmd_diagnose_rom_test, sizeof (pncmd_diagnose_rom_test), abtRx, &szRx);
if (result) { if (result) {
result = ((szRx == 1) && (abtRx[0] == 0x00)); result = ((szRx == 1) && (abtRx[0] == 0x00));
} }
printf (" ROM test: %s\n", result ? "OK" : "Failed"); printf (" ROM test: %s\n", result ? "OK" : "Failed");
result = pn53x_transceive (pnd, pncmd_diagnose_ram_test, sizeof (pncmd_diagnose_ram_test), abtRx, &szRx, false); result = pn53x_transceive (pnd, pncmd_diagnose_ram_test, sizeof (pncmd_diagnose_ram_test), abtRx, &szRx);
if (result) { if (result) {
result = ((szRx == 1) && (abtRx[0] == 0x00)); result = ((szRx == 1) && (abtRx[0] == 0x00));
} }

View file

@ -93,7 +93,7 @@ sam_connection (nfc_device_t * pnd, int mode)
break; break;
} }
if (!pn53x_transceive (pnd, pncmd_sam_config, szCmd, abtRx, &szRx, false)) { if (!pn53x_transceive (pnd, pncmd_sam_config, szCmd, abtRx, &szRx)) {
nfc_perror(pnd, "pn53x_transceive"); nfc_perror(pnd, "pn53x_transceive");
ERR ("%s %d", "Unable to execute SAMConfiguration command with mode byte:", mode); ERR ("%s %d", "Unable to execute SAMConfiguration command with mode byte:", mode);
return false; return false;

View file

@ -167,7 +167,7 @@ int main(int argc, const char* argv[])
printf("Tx: "); printf("Tx: ");
print_hex((byte_t*)abtTx+1,szTx-1); print_hex((byte_t*)abtTx+1,szTx-1);
if (!pn53x_transceive (pnd, abtTx, szTx, abtRx, &szRx, false)) { if (!pn53x_transceive (pnd, abtTx, szTx, abtRx, &szRx)) {
free(cmd); free(cmd);
nfc_perror (pnd, "Rx"); nfc_perror (pnd, "Rx");
continue; continue;