From 844e0f10e59ef53a6be2b71106b9d143fafeab01 Mon Sep 17 00:00:00 2001 From: Georgii Surkov <37121527+gsurkov@users.noreply.github.com> Date: Sat, 28 Oct 2023 16:56:49 +0300 Subject: [PATCH] [FL-3639] Fix MF DESFire record file handling (#3167) --- .../nfc/helpers/protocol_support/mf_desfire/mf_desfire_render.c | 1 + lib/nfc/protocols/mf_desfire/mf_desfire.h | 1 + lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/applications/main/nfc/helpers/protocol_support/mf_desfire/mf_desfire_render.c b/applications/main/nfc/helpers/protocol_support/mf_desfire/mf_desfire_render.c index 883ea720b..b5ca0d138 100644 --- a/applications/main/nfc/helpers/protocol_support/mf_desfire/mf_desfire_render.c +++ b/applications/main/nfc/helpers/protocol_support/mf_desfire/mf_desfire_render.c @@ -197,6 +197,7 @@ void nfc_render_mf_desfire_file_settings_data( furi_string_cat_printf(str, "size %lu\n", record_size); break; case MfDesfireFileTypeValue: + record_size = MF_DESFIRE_VALUE_SIZE; furi_string_cat_printf( str, "lo %lu hi %lu\n", settings->value.lo_limit, settings->value.hi_limit); furi_string_cat_printf( diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire.h b/lib/nfc/protocols/mf_desfire/mf_desfire.h index 4d09dc851..8505b792a 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire.h +++ b/lib/nfc/protocols/mf_desfire/mf_desfire.h @@ -29,6 +29,7 @@ extern "C" { #define MF_DESFIRE_UID_SIZE (7) #define MF_DESFIRE_BATCH_SIZE (5) #define MF_DESFIRE_APP_ID_SIZE (3) +#define MF_DESFIRE_VALUE_SIZE (4) typedef struct { uint8_t hw_vendor; diff --git a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c index e86cb4c68..17377d66e 100644 --- a/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c +++ b/lib/nfc/protocols/mf_desfire/mf_desfire_poller_i.c @@ -353,7 +353,7 @@ MfDesfireError mf_desfire_poller_async_read_file_records( furi_assert(instance); bit_buffer_reset(instance->input_buffer); - bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_READ_DATA); + bit_buffer_append_byte(instance->input_buffer, MF_DESFIRE_CMD_READ_RECORDS); bit_buffer_append_byte(instance->input_buffer, id); bit_buffer_append_bytes(instance->input_buffer, (const uint8_t*)&offset, 3); bit_buffer_append_bytes(instance->input_buffer, (const uint8_t*)&size, 3);