diff --git a/lib/nfc/helpers/bit_buffer.c b/lib/nfc/helpers/bit_buffer.c index 3de216d1c45..7325af13596 100644 --- a/lib/nfc/helpers/bit_buffer.c +++ b/lib/nfc/helpers/bit_buffer.c @@ -36,6 +36,7 @@ void bit_buffer_reset(BitBuffer* buf) { furi_assert(buf); memset(buf->data, 0, buf->capacity_bytes); + memset(buf->parity, 0, buf->capacity_bytes); buf->size_bits = 0; } diff --git a/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller.c b/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller.c index bac2d493cc0..3ea74f60cf9 100644 --- a/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller.c +++ b/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller.c @@ -70,8 +70,7 @@ static NfcCommand iso14443_3b_poller_run(NfcGenericEvent event, void* context) { if(nfc_event->type == NfcEventTypePollerReady) { if(instance->state != Iso14443_3bPollerStateActivated) { - Iso14443_3bData data = {}; - Iso14443_3bError error = iso14443_3b_poller_async_activate(instance, &data); + Iso14443_3bError error = iso14443_3b_poller_async_activate(instance, instance->data); if(error == Iso14443_3bErrorNone) { instance->iso14443_3b_event.type = Iso14443_3bPollerEventTypeReady; instance->iso14443_3b_event_data.error = error; @@ -105,7 +104,7 @@ static bool iso14443_3b_poller_detect(NfcGenericEvent event, void* context) { furi_assert(instance->state == Iso14443_3bPollerStateIdle); if(nfc_event->type == NfcEventTypePollerReady) { - Iso14443_3bError error = iso14443_3b_poller_async_activate(instance, NULL); + Iso14443_3bError error = iso14443_3b_poller_async_activate(instance, instance->data); protocol_detected = (error == Iso14443_3bErrorNone); } diff --git a/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller_i.c b/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller_i.c index d0ce99578e1..35c67c43cdc 100644 --- a/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller_i.c +++ b/lib/nfc/protocols/iso14443_3b/iso14443_3b_poller_i.c @@ -65,7 +65,7 @@ Iso14443_3bError furi_assert(instance); furi_assert(instance->nfc); - iso14443_3b_reset(instance->data); + iso14443_3b_reset(data); Iso14443_3bError ret; @@ -99,16 +99,16 @@ Iso14443_3bError const Iso14443_3bAtqB* atqb = (const Iso14443_3bAtqB*)bit_buffer_get_data(instance->rx_buffer); - memcpy(instance->data->uid, atqb->uid, ISO14443_3B_UID_SIZE); - memcpy(instance->data->app_data, atqb->app_data, ISO14443_3B_APP_DATA_SIZE); - memcpy(instance->data->protocol_info, atqb->protocol_info, ISO14443_3B_PROTOCOL_INFO_SIZE); + memcpy(data->uid, atqb->uid, ISO14443_3B_UID_SIZE); + memcpy(data->app_data, atqb->app_data, ISO14443_3B_APP_DATA_SIZE); + memcpy(data->protocol_info, atqb->protocol_info, ISO14443_3B_PROTOCOL_INFO_SIZE); bit_buffer_reset(instance->tx_buffer); bit_buffer_reset(instance->rx_buffer); // Send ATTRIB bit_buffer_append_byte(instance->tx_buffer, 0x1d); - bit_buffer_append_bytes(instance->tx_buffer, atqb->uid, ISO14443_3B_UID_SIZE); + 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); @@ -130,11 +130,6 @@ Iso14443_3bError } instance->state = Iso14443_3bPollerStateActivated; - - if(data) { - iso14443_3b_copy(data, instance->data); - } - } while(false); return ret;