Prevent from running polling on hardware that does not support it.

This commit is contained in:
Romuald Conty 2010-04-09 23:11:20 +00:00
parent 71341b871e
commit c9370e6fac
2 changed files with 8 additions and 0 deletions

View file

@ -111,6 +111,10 @@ int main(int argc, const char* argv[])
nfc_target_t antTargets[2]; nfc_target_t antTargets[2];
size_t szTargetFound; size_t szTargetFound;
if(pnd->nc == NC_PN531) {
// PN531 doesn't support hardware polling (InAutoPoll)
continue;
}
printf("PN53x will poll during %ld ms\n", btPollNr * szTargetTypes * btPeriod * 150); printf("PN53x will poll during %ld ms\n", btPollNr * szTargetTypes * btPeriod * 150);
bool res = nfc_initiator_poll_targets(pnd, &nttMifare, 1, btPollNr, btPeriod, antTargets, &szTargetFound); bool res = nfc_initiator_poll_targets(pnd, &nttMifare, 1, btPollNr, btPeriod, antTargets, &szTargetFound);
if( res ) { if( res ) {

View file

@ -587,6 +587,10 @@ nfc_initiator_poll_targets(const nfc_device_t* pnd,
const byte_t btPollNr, const byte_t btPeriod, const byte_t btPollNr, const byte_t btPeriod,
nfc_target_t* pntTargets, size_t* pszTargetFound) nfc_target_t* pntTargets, size_t* pszTargetFound)
{ {
if(pnd->nc == NC_PN531) {
// errno = ENOSUPP
return false;
}
// byte_t abtInAutoPoll[] = { 0xd4, 0x60, 0x0f, 0x01, 0x00 }; // byte_t abtInAutoPoll[] = { 0xd4, 0x60, 0x0f, 0x01, 0x00 };
size_t szTxInAutoPoll = 4 + szTargetTypes; size_t szTxInAutoPoll = 4 + szTargetTypes;
byte_t *pbtTxInAutoPoll = malloc( szTxInAutoPoll ); byte_t *pbtTxInAutoPoll = malloc( szTxInAutoPoll );