From 77d8de96fc793d5bbda744abe8914863c52c48dd Mon Sep 17 00:00:00 2001 From: Methodius Date: Tue, 2 Jan 2024 19:14:04 +0900 Subject: [PATCH] NFC Magic: Incorrect total blocks usage fix from (#102)[https://github.com/flipperdevices/flipperzero-good-faps/pull/102] --- .../nfc_magic/lib/magic/protocols/gen4/gen4_poller.c | 8 ++------ .../nfc_magic/lib/magic/protocols/gen4/gen4_poller_i.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/base_pack/nfc_magic/lib/magic/protocols/gen4/gen4_poller.c b/base_pack/nfc_magic/lib/magic/protocols/gen4/gen4_poller.c index bb724369..806058fd 100644 --- a/base_pack/nfc_magic/lib/magic/protocols/gen4/gen4_poller.c +++ b/base_pack/nfc_magic/lib/magic/protocols/gen4/gen4_poller.c @@ -1,5 +1,3 @@ -#include "core/check.h" -#include "core/log.h" #include "gen4_poller_i.h" #include "protocols/gen4/gen4_poller.h" #include @@ -7,8 +5,6 @@ #include #include -#include - #define GEN4_POLLER_THREAD_FLAG_DETECTED (1U << 0) typedef NfcCommand (*Gen4PollerStateHandler)(Gen4Poller* instance); @@ -280,7 +276,7 @@ static NfcCommand gen4_poller_write_mf_classic(Gen4Poller* instance) { instance->config[25] = iso3_data->atqa[1]; instance->config[26] = iso3_data->sak; instance->config[27] = 0x00; - instance->config[28] = instance->total_blocks; + instance->config[28] = instance->total_blocks - 1; instance->config[29] = Gen4PollerDirectWriteBlock0ModeDisabled; Gen4PollerError error = gen4_poller_set_config( @@ -359,7 +355,7 @@ static NfcCommand gen4_poller_write_mf_ultralight(Gen4Poller* instance) { instance->config[25] = iso3_data->atqa[1]; instance->config[26] = iso3_data->sak; instance->config[27] = 0x00; - instance->config[28] = instance->total_blocks; + instance->config[28] = instance->total_blocks - 1; instance->config[29] = Gen4PollerDirectWriteBlock0ModeDisabled; Gen4PollerError error = gen4_poller_set_config( diff --git a/base_pack/nfc_magic/lib/magic/protocols/gen4/gen4_poller_i.h b/base_pack/nfc_magic/lib/magic/protocols/gen4/gen4_poller_i.h index 03326b7a..3ef35144 100644 --- a/base_pack/nfc_magic/lib/magic/protocols/gen4/gen4_poller_i.h +++ b/base_pack/nfc_magic/lib/magic/protocols/gen4/gen4_poller_i.h @@ -3,7 +3,6 @@ #include "gen4_poller.h" #include #include -#include #define TAG "Gen4Poller"