nfc_initiator_target_is_present(): improve MFC support for 7-byte UID
This commit is contained in:
parent
9d63a93dd8
commit
095f945224
1 changed files with 21 additions and 1 deletions
|
@ -1808,7 +1808,27 @@ pn53x_initiator_target_is_present(struct nfc_device *pnd, const nfc_target *pnt)
|
||||||
} else {
|
} else {
|
||||||
// Limitation: re-select will lose authentication of already authenticated sector
|
// Limitation: re-select will lose authentication of already authenticated sector
|
||||||
// TODO: buggy when card is removed on Tikitag
|
// 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) {
|
uint8_t pbtInitiatorData[12];
|
||||||
|
uint8_t szInitiatorData = 0;
|
||||||
|
switch (CHIP_DATA(pnd)->current_target->nti.nai.szUidLen) {
|
||||||
|
case 4:
|
||||||
|
memcpy(pbtInitiatorData, CHIP_DATA(pnd)->current_target->nti.nai.abtUid, 4);
|
||||||
|
szInitiatorData = 4;
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
pbtInitiatorData[0] = 0x88;
|
||||||
|
memcpy(&pbtInitiatorData[1], CHIP_DATA(pnd)->current_target->nti.nai.abtUid, 7);
|
||||||
|
szInitiatorData = 8;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
pbtInitiatorData[0] = 0x88;
|
||||||
|
memcpy(&pbtInitiatorData[1], CHIP_DATA(pnd)->current_target->nti.nai.abtUid, 3);
|
||||||
|
pbtInitiatorData[4] = 0x88;
|
||||||
|
memcpy(&pbtInitiatorData[5], &CHIP_DATA(pnd)->current_target->nti.nai.abtUid[3], 7);
|
||||||
|
szInitiatorData = 12;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ((ret = pn53x_initiator_select_passive_target_ext(pnd, CHIP_DATA(pnd)->current_target->nm, pbtInitiatorData, szInitiatorData, 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;
|
||||||
|
|
Loading…
Reference in a new issue