Small improvements to nfc-sam stuff.

This commit is contained in:
Emanuele Bertoldi 2010-07-26 08:55:43 +00:00
parent af584bd474
commit 9a7ffc38a1
2 changed files with 16 additions and 8 deletions

View file

@ -7,6 +7,8 @@ nfc-sam \- NFC SAM comunication command line tool based on libnfc
.B nfc-sam
utility attempts to test a simple connection with a SAM (Secure Access Module) in several modes.
To run this utility you must have a SAM (like the NXP's P5CN072 chip) successfully connected to your NFC chip.
.SH BUGS
Please report any bugs on the
.B libnfc

View file

@ -56,7 +56,12 @@ bool sam_connection(nfc_device_t* pnd, int mode)
int size = sizeof(pncmd_sam_config)-((mode == VIRTUAL_CARD_MODE) ? 0 : 1);
pncmd_sam_config[2] = mode;
return pnd->pdc->transceive(pnd->nds,pncmd_sam_config,size,abtRx,&szRxLen);
if (!pnd->pdc->transceive(pnd->nds,pncmd_sam_config,size,abtRx,&szRxLen)) {
ERR("%s %d", "Unable to execute SAMConfiguration command with mode byte:", mode);
return false;
}
return true;
}
void wait_one_minute()
@ -162,7 +167,8 @@ int main(int argc, const char* argv[])
byte_t abtRx[MAX_FRAME_LEN];
size_t szRxLen;
// FIXME: it does not work as expected...
// FIXME: it does not work as expected...Probably the issue is in "nfc_target_init"
// which doesn't provide a way to set custom data for SENS_RES, NFCID1, SEL_RES, etc.
if (!nfc_target_init(pnd,abtRx,&szRxLen))
return EXIT_FAILURE;
@ -172,7 +178,7 @@ int main(int argc, const char* argv[])
break;
}
// Disconnect from the SAM.
// Disconnect from the SAM
sam_connection(pnd, NORMAL_MODE);
// Disconnect from NFC device