nfc_initiator_target_is_present(): improve MFC support

Increase timeout to support Tikitag & PN533
Fix support for MFC Mini on PN533
This commit is contained in:
Philippe Teuwen 2014-01-29 23:30:44 +01:00
parent 94f4e001f4
commit 9d63a93dd8

View file

@ -1802,11 +1802,13 @@ pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt)
} else if (CHIP_DATA(pnd)->current_target->nti.nai.btSak & 0x08) { } else if (CHIP_DATA(pnd)->current_target->nti.nai.btSak & 0x08) {
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "target_is_present(): Ping MFC"); log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%s", "target_is_present(): Ping MFC");
// MFC // MFC
if (CHIP_DATA(pnd)->type == PN533) { if ((CHIP_DATA(pnd)->type == PN533) && (CHIP_DATA(pnd)->current_target->nti.nai.btSak != 0x09)) {
//TODO MFC Mini (atqa0004/sak09) fails on PN533 // MFC Mini (atqa0004/sak09) fails on PN533, so we exclude it
ret = pn53x_Diagnose06(pnd); ret = pn53x_Diagnose06(pnd);
} else { } else {
if ((ret = pn53x_initiator_select_passive_target_ext(pnd, CHIP_DATA(pnd)->current_target->nm, CHIP_DATA(pnd)->current_target->nti.nai.abtUid, CHIP_DATA(pnd)->current_target->nti.nai.szUidLen, NULL, 50)) == 1) { // Limitation: re-select will lose authentication of already authenticated sector
// TODO: buggy when card is removed on Tikitag
if ((ret = pn53x_initiator_select_passive_target_ext(pnd, CHIP_DATA(pnd)->current_target->nm, CHIP_DATA(pnd)->current_target->nti.nai.abtUid, CHIP_DATA(pnd)->current_target->nti.nai.szUidLen, NULL, 300)) == 1) {
ret = NFC_SUCCESS; ret = NFC_SUCCESS;
} else if ((ret == 0) || (ret == NFC_ETIMEOUT)) { } else if ((ret == 0) || (ret == NFC_ETIMEOUT)) {
ret = NFC_ETGRELEASED; ret = NFC_ETGRELEASED;