[FL-3706], [FL-3674] NFC NTAG and ISO14443-3b reading fix (#3285)

* mf ultralight poller: reset field after reading tearing flags
* iso14443-3b poller: change cid comparison in ATTRIB cmd

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2023-12-12 19:24:06 +04:00
committed by GitHub
parent 90cb1c4f2e
commit 155e4e9fa4
2 changed files with 12 additions and 7 deletions

View File

@@ -117,12 +117,13 @@ Iso14443_3bError iso14443_3b_poller_activate(Iso14443_3bPoller* instance, Iso144
bit_buffer_reset(instance->rx_buffer);
// Send ATTRIB
uint8_t cid = 0;
bit_buffer_append_byte(instance->tx_buffer, 0x1d);
bit_buffer_append_bytes(instance->tx_buffer, data->uid, ISO14443_3B_UID_SIZE);
bit_buffer_append_byte(instance->tx_buffer, 0x00);
bit_buffer_append_byte(instance->tx_buffer, ISO14443_3B_ATTRIB_FRAME_SIZE_256);
bit_buffer_append_byte(instance->tx_buffer, 0x01);
bit_buffer_append_byte(instance->tx_buffer, 0x00);
bit_buffer_append_byte(instance->tx_buffer, cid);
ret = iso14443_3b_poller_frame_exchange(
instance, instance->tx_buffer, instance->rx_buffer, iso14443_3b_get_fwt_fc_max(data));
@@ -138,11 +139,10 @@ Iso14443_3bError iso14443_3b_poller_activate(Iso14443_3bPoller* instance, Iso144
bit_buffer_get_size_bytes(instance->rx_buffer));
}
if(bit_buffer_get_byte(instance->rx_buffer, 0) != 0) {
FURI_LOG_D(
TAG,
"Incorrect CID in ATTRIB response: %02X",
bit_buffer_get_byte(instance->rx_buffer, 0));
uint8_t cid_received = bit_buffer_get_byte(instance->rx_buffer, 0);
// 15 bit is RFU
if((cid_received & 0x7f) != cid) {
FURI_LOG_D(TAG, "Incorrect CID in ATTRIB response: %02X", cid_received);
instance->state = Iso14443_3bPollerStateActivationFailed;
ret = Iso14443_3bErrorCommunication;
break;